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
84 : host: remote server, must provide
85 user: user used to access to remote server, default to root
86 port: exposed port used to access to testapi, default to 8000
87 image: testapi's docker image, default to opnfv/testapi:latest
88 update_path: templates directory in remote server, default to /tmp/testapi
89 mongodb_url: url of mongodb, default to 172.17.0.1, docker0 ip
90 swagger_url: swagger access url, default to http://host:port
94 ansible-playbook update.yml --extra-vars "
100 update_path=/tmp/testapi
101 mongodb_url=mongodb://172.17.0.1:27017
102 swagger_url=http://10.63.243.17:8000"```
105 > - If documents need to be changed, please modify file
106 templates/changes_in_mongodb.py, and refer section **update mongodb**