1 Welcome to TESTAPI Update!
2 ========================
5 This file is used to describe how testapi update works
11 #### <i class="icon-file"></i> backup mongodb
14 : -u/--url: Mongo DB URL, default = mongodb://127.0.0.1:27017/
15 the backup output will be put under dir/db__XXXX_XX_XX_XXXXXX/db
16 -d/--db: database for the backup, default = test_results_collection
20 python backup_mongodb.py
23 #### <i class="icon-file"></i> restore mongodb
26 : -u/--url: Mongo DB URL, default = mongodb://127.0.0.1:27017/
27 -i/--input_dir: Input directory for the Restore, must be specified,
28 the restore input must be specified to dir/db__XXXX_XX_XX_XXXXXX/db
29 -d/--db: database name after the restore, default = basename of input_dir
33 python restore_mongodb.py
35 #### <i class="icon-file"></i> update mongodb
38 : -u/--url: Mongo DB URL, default = mongodb://127.0.0.1:27017/
39 -d/--db: database name to be updated, default = test_results_collection
41 changes need to be done:
42 change collection name, modify changes.collections_old2New
43 > collections_old2New = {
44 'old_collection': 'new_collection',
47 change field name, modify changes.fields_old2New
49 'collection': [(query, {'old_field': 'new_field'})]
52 change the doc, modify changes.docs_old2New
55 ({'field': 'old_value'}, {'field': 'new_value'}),
56 (query, {'field': 'new_value'}),
60 #### <i class="icon-file"></i> update opnfv-testapi process
61 This script must be run right in this directory and remember to
62 change ../etc/config.ini before running this script.
65 : kill running test_collection_api & opnfv-testapi
66 install or update dependencies according to ../requirements.txt
74 #### <i class="icon-file"></i> update opnfv/testapi container
75 Here ansible-playbook is used to implement auto update.
76 Please make sure that the remote server is accessible via ssh.
78 install ansible, please refer:
80 http://docs.ansible.com/ansible/intro_installation.html
86 : -h|--help show this help text
87 -r|--remote remote server
88 -u|--user ssh username used to access to remote server
89 -i|--identity ssh PublicKey file used to access to remote server
90 -e|--execute execute update, if not set just check the ansible connectivity
94 ssh-agent ./playbook-update.sh -r testresults.opnfv.org -u serena -i ~/.ssh/id_rsa -e
99 > - If documents need to be changed, please modify file
100 templates/changes_in_mongodb.py, and refer section **update mongodb**