OSM DB Update Charm
[osm/devops.git] / installers / charm / osm-update-db-operator / README.md
1 <!-- Copyright 2022 Canonical Ltd.
2
3 Licensed under the Apache License, Version 2.0 (the "License"); you may
4 not use this file except in compliance with the License. You may obtain
5 a copy of the License at
6
7         http://www.apache.org/licenses/LICENSE-2.0
8
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 License for the specific language governing permissions and limitations
13 under the License.
14 -->
15
16 # OSM Update DB Operator
17
18 [![code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black/tree/main)
19
20 ## Description
21
22 Charm used to update the OSM databases during an OSM upgrade process. To be used you should have an instance of OSM running that you may want to upgrade
23
24 ## Usage
25
26 ### Deploy the charm (locally)
27
28 ```shell
29 juju add-model update-db
30 juju deploy osm-update-db-operator --series focal
31 ```
32
33 Set MongoDB and MySQL URIs:
34
35 ```shell
36 juju config osm-update-db-operator mysql-uri=<mysql_uri>
37 juju config osm-update-db-operator mongodb-uri=<mongodb_uri>
38 ```
39
40 ### Updating the databases
41
42 In case we want to update both databases, we need to run the following command:
43
44 ```shell
45 juju run-action osm-update-db-operator/0 update-db current-version=<Number_of_current_version> target-version=<Number_of_target_version>
46 # Example:
47 juju run-action osm-update-db-operator/0 update-db current-version=9 target-version=10
48 ```
49
50 In case only you just want to update MongoDB, then we can use a flag 'mongodb-only=True':
51
52 ```shell
53 juju run-action osm-update-db-operator/0 update-db current-version=9 target-version=10 mongodb-only=True
54 ```
55
56 In case only you just want to update MySQL database, then we can use a flag 'mysql-only=True':
57
58 ```shell
59 juju run-action osm-update-db-operator/0 update-db current-version=9 target-version=10 mysql-only=True
60 ```
61
62 You can check if the update of the database was properly done checking the result of the command:
63
64 ```shell
65 juju show-action-output <Number_of_the_action>
66 ```
67
68 ### Fixes for bugs
69
70 Updates de database to apply the changes needed to fix a bug. You need to specify the bug number. Example:
71
72 ```shell
73 juju run-action osm-update-db-operator/0 apply-patch bug-number=1837
74 ```
75
76 ## Contributing
77
78 Please see the [Juju SDK docs](https://juju.is/docs/sdk) for guidelines
79 on enhancements to this charm following best practice guidelines, and
80 `CONTRIBUTING.md` for developer guidance.