1 <!-- Copyright 2022 Canonical Ltd.
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
7 http://www.apache.org/licenses/LICENSE-2.0
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
16 # OSM Update DB Operator
18 [![code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black/tree/main)
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
26 ### Deploy the charm (locally)
29 juju add-model update-db
30 juju deploy osm-update-db-operator --series focal
33 Set MongoDB and MySQL URIs:
36 juju config osm-update-db-operator mysql-uri=<mysql_uri>
37 juju config osm-update-db-operator mongodb-uri=<mongodb_uri>
40 ### Updating the databases
42 In case we want to update both databases, we need to run the following command:
45 juju run-action osm-update-db-operator/0 update-db current-version=<Number_of_current_version> target-version=<Number_of_target_version>
47 juju run-action osm-update-db-operator/0 update-db current-version=9 target-version=10
50 In case only you just want to update MongoDB, then we can use a flag 'mongodb-only=True':
53 juju run-action osm-update-db-operator/0 update-db current-version=9 target-version=10 mongodb-only=True
56 In case only you just want to update MySQL database, then we can use a flag 'mysql-only=True':
59 juju run-action osm-update-db-operator/0 update-db current-version=9 target-version=10 mysql-only=True
62 You can check if the update of the database was properly done checking the result of the command:
65 juju show-action-output <Number_of_the_action>
70 Updates de database to apply the changes needed to fix a bug. You need to specify the bug number. Example:
73 juju run-action osm-update-db-operator/0 apply-patch bug-number=1837
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.