Fix persistence documentation in Nami modules

Fix errors in:

-Run the application using Docker Compose
-Persisting your application
This commit is contained in:
raquel-campuzano 2016-11-21 16:07:39 +01:00
parent c1add7bd6d
commit fba6fff8e1
1 changed files with 25 additions and 15 deletions

View File

@ -72,52 +72,62 @@ Then you can access your application at http://your-ip/
## Persisting your application
If you remove every container and volume all your data will be lost, and the next time you run the image the application will be reinitialized. To avoid this loss of data, you should mount a volume that will persist even after the container is removed. If you are using docker-compose your data will be persistent as long as you don't remove `postgresql_data` and `application_data` data volumes. If you have run the containers manually or you want to mount the folders with persistent data in your host follow the next steps:
If you remove every container and volume all your data will be lost, and the next time you run the image the application will be reinitialized. To avoid this loss of data, you should mount a volume that will persist even after the container is removed.
For persistence of the Odoo deployment, the above examples define docker volumes namely `postgresql_data` and `odoo_data`. The Odoo application state will persist as long as these volumes are not removed.
To avoid inadvertent removal of these volumes you can [mount host directories as data volumes](https://docs.docker.com/engine/tutorials/dockervolumes/). Alternatively you can make use of volume plugins to host the volume data.
> **Note!** If you have already started using your application, follow the steps on [backing](#backing-up-your-application) up to pull the data from your running container down to your host.
### Mount persistent folders in the host using docker-compose
### Mount host directories as data volumes with Docker Compose
This requires a sightly modification from the template previously shown:
```
This requires a minor change to the `docker-compose.yml` template previously shown:
```yaml
version: '2'
postgresql:
image: 'bitnami/postgresql:latest'
volumes:
- '/path/to/your/local/postgresql_data:/bitnami/postgresql'
application:
odoo:
image: bitnami/odoo:latest
depends_on:
- postgresql
ports:
- 80:8069
volumes:
- '/path/to/your/local/odoo_data:/bitnami/odoo'
depends_on:
- postgresql
- '/path/to/odoo-persistence:/bitnami/odoo'
```
### Mount persistent folders manually
### Mount host directories as data volumes using the Docker command line
In this case you need to specify the directories to mount on the run command. The process is the same than the one previously shown:
1. If you haven't done this before, create a new network for the application and the database:
1. Create a network (if it does not exist):
```
$ docker network create odoo_network
$ docker network create odoo-tier
```
2. Start a PostgreSQL database in the previous network:
2. Create a PostgreSQL container with host volume:
```
$ docker run -d --name postgresql -v /your/local/path/bitnami/postgresql:/bitnami/postgresql --network=odoo_network bitnami/postgresql
$ docker run -d --name postgresql \
--net odoo-tier \
--volume /path/to/postgresql-persistence:/bitnami/postgresql \
bitnami/postgresql:latest
```
*Note:* You need to give the container a name in order to Odoo to resolve the host
3. Run the Odoo container:
3. Create the Odoo container with hist volumes:
```
$ docker run -d -p 80:8069 --name odoo -v /your/local/path/bitnami/odoo:/bitnami/odoo --network=odoo_network bitnami/odoo
$ docker run -d --name odoo -p 80:8069 \
--net odoo-tier \
--volume /path/to/odoo-persistence:/bitnami/odoo \
bitnami/odoo:latest
```
# Upgrade this application