Merge pull request #30 from raquel-campuzano/magento-persistence-nami
Unify instructions in nami modules documentation
This commit is contained in:
commit
72dc02be88
|
|
@ -28,7 +28,7 @@ Running Magento with a database server is the recommended way. You can either us
|
|||
|
||||
This is the recommended way to run Magento. You can use the following docker compose template:
|
||||
|
||||
```
|
||||
```yaml
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
|
|
@ -65,22 +65,22 @@ If you want to run the application manually instead of using docker-compose, the
|
|||
|
||||
1. Create a new network for the application and the database:
|
||||
|
||||
```
|
||||
$ docker network create magento_network
|
||||
```bash
|
||||
$ docker network create magento-tier
|
||||
```
|
||||
|
||||
2. Start a MariaDB database in the network generated:
|
||||
|
||||
```
|
||||
$ docker run -d --name mariadb --net=magento_network bitnami/mariadb
|
||||
```bash
|
||||
$ docker run -d --name mariadb --net=magento-tier bitnami/mariadb
|
||||
```
|
||||
|
||||
*Note:* You need to give the container a name in order to Magento to resolve the host
|
||||
|
||||
3. Run the Magento container:
|
||||
|
||||
```
|
||||
$ docker run -d -p 80:80 --name magento --net=magento_network bitnami/magento
|
||||
```bash
|
||||
$ docker run -d -p 80:80 --name magento --net=magento-tier bitnami/magento
|
||||
```
|
||||
|
||||
Then you can access your application at http://your-ip/
|
||||
|
|
@ -89,56 +89,70 @@ 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 `mariadb_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 Magento deployment, the above examples define docker volumes namely `mariadb_data`, `magento_data`, `apache_data` and `php_data`. The Magento 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'
|
||||
|
||||
services:
|
||||
mariadb:
|
||||
image: 'bitnami/mariadb:latest'
|
||||
volumes:
|
||||
- '/path/to/your/local/mariadb_data:/bitnami/mariadb'
|
||||
application:
|
||||
- /path/to/mariadb-persistence:/bitnami/mariadb
|
||||
magento:
|
||||
image: 'bitnami/magento:latest'
|
||||
depends_on:
|
||||
- mariadb
|
||||
ports:
|
||||
- '80:80'
|
||||
- '443:443'
|
||||
volumes:
|
||||
- '/path/to/your/local/magento_data:/bitnami/magento'
|
||||
- '/path/to/your/local/php_data:/bitnami/php'
|
||||
- '/path/to/your/local/apache_data:/bitnami/apache'
|
||||
depends_on:
|
||||
- mariadb
|
||||
- '/path/to/magento-persistence:/bitnami/magento'
|
||||
- '/path/to/php-persistence:/bitnami/php'
|
||||
- '/path/to/apache-persistence:/bitnami/apache'
|
||||
|
||||
```
|
||||
|
||||
### 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 magento_network
|
||||
```bash
|
||||
$ docker network create magento-tier
|
||||
```
|
||||
|
||||
2. Start a MariaDB database in the previous network:
|
||||
2. Create a MariaDB container with host volume:
|
||||
|
||||
```
|
||||
$ docker run -d --name mariadb -v /your/local/path/bitnami/mariadb_data:/bitnami/mariadb --net=magento_network bitnami/mariadb
|
||||
```bash
|
||||
$ docker run -d --name mariadb \
|
||||
--net magento-tier \
|
||||
--volume /path/to/mariadb-persistence:/bitnami/mariadb \
|
||||
bitnami/mariadb:latest
|
||||
```
|
||||
|
||||
*Note:* You need to give the container a name in order to Magento to resolve the host
|
||||
|
||||
3. Run the Magento container:
|
||||
3. Create the Magento container with host volumes:
|
||||
|
||||
```
|
||||
$ docker run -d -p 80:80 --name magento -v /your/local/path/bitnami/magento:/bitnami/magento --net=magento_network bitnami/magento
|
||||
```bash
|
||||
$ docker run -d --name magento -p 80:80 -p 443:443 \
|
||||
--net magento-tier \
|
||||
--volume /path/to/magento-persistence:/bitnami/magento \
|
||||
--volume /path/to/apache-persistence:/bitnami/apache \
|
||||
--volume /path/to/php-persistence:/bitnami/php \
|
||||
bitnami/magento:latest
|
||||
```
|
||||
|
||||
# Upgrade this application
|
||||
|
|
@ -147,7 +161,7 @@ Bitnami provides up-to-date versions of MariaDB and Magento, including security
|
|||
|
||||
1. Get the updated images:
|
||||
|
||||
```
|
||||
```bash
|
||||
$ docker pull bitnami/magento:latest
|
||||
```
|
||||
|
||||
|
|
@ -173,7 +187,7 @@ Bitnami provides up-to-date versions of MariaDB and Magento, including security
|
|||
When you start the magento image, you can adjust the configuration of the instance by passing one or more environment variables either on the docker-compose file or on the docker run command line. If you want to add a new environment variable:
|
||||
|
||||
* For docker-compose add the variable name and value under the application section:
|
||||
```
|
||||
```yaml
|
||||
application:
|
||||
image: bitnami/magento:latest
|
||||
ports:
|
||||
|
|
@ -186,8 +200,8 @@ application:
|
|||
|
||||
* For manual execution add a `-e` option with each variable and value:
|
||||
|
||||
```
|
||||
$ docker run -d -e MAGENTO_PASSWORD=my_password1234 -p 80:80 --name magento -v /your/local/path/bitnami/magento:/bitnami/magento --net=magento_network bitnami/magento
|
||||
```bash
|
||||
$ docker run -d -e MAGENTO_PASSWORD=my_password1234 -p 80:80 --name magento -v /your/local/path/bitnami/magento:/bitnami/magento --net=magento-tier bitnami/magento
|
||||
```
|
||||
|
||||
Available variables:
|
||||
|
|
@ -216,7 +230,7 @@ To backup your application data follow these steps:
|
|||
|
||||
2. Copy the Magento data folder in the host:
|
||||
|
||||
```
|
||||
```bash
|
||||
$ docker cp /your/local/path/bitnami:/bitnami/magento
|
||||
```
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue