~busykoala/wp_container_template

948de8810f37d9fe1a1545f2eabc381bbec1516d — Matthias Osswald 1 year, 11 months ago 3627f03
Move port to env file and update README.
3 files changed, 22 insertions(+), 15 deletions(-)

M .env.example
M README.md
M docker-compose.yml
M .env.example => .env.example +1 -0
@@ 1,3 1,4 @@
DB_ROOT_PW=example_root_password
DB_USER=example_user_name
DB_USER_PW=example_user_password
WP_PORT=4000

M README.md => README.md +18 -11
@@ 4,9 4,6 @@ This is a setup to just start another wordpress page in an instance.

## General Info

The application is exposed using the port `8888` by default. It can be
changed in `docker-compose.yml`.

The applications files will be located in the directory `./wordpress-files`.

The database volume can be found with `docker volume ls`.


@@ 14,17 11,27 @@ The database volume can be found with `docker volume ls`.
## Installtion & Start

- Add an `.env` file (there is an example provided).
    - mariadb root user pw
    - mariadb user name
    - mariadb user pw
    - exposed port for wp installation
- Start with `docker-compose up -d`.

## Docker Compose Commands
## Update Docker Setup

- `docker-compose up --force-recreate --build -d`
- `docker image prune -f`

## Backup Strategies

This has to be worked out in detail.

### Site Setup

- Start application: `docker-compose up -d`
- Stop application: `docker-compose kill`
- Delete volume: `docker-compose down --volumes`
The site setup can be copied (./wordpress-files). In there is the current code base.

## Update Container
### Volume (DB)

One method to update often seen is doing following steps:
The volume can be saved and loaded to and from a .tar file.

- `docker-compose pull && docker-compose up -d`
- `docker image prune`
https://stackoverflow.com/a/62704116/10750109

M docker-compose.yml => docker-compose.yml +3 -4
@@ 16,8 16,6 @@ services:
      - MYSQL_DATABASE=wordpress
      - MYSQL_USER=${DB_USER}
      - MYSQL_PASSWORD=${DB_USER_PW}
    ports:
      - 8889:3306
    networks:
      - wp-back
    restart: unless-stopped


@@ 26,11 24,12 @@ services:
      - db
    image: wordpress:latest
    ports:
      - 4000:80
      - ${WP_PORT}:80
    environment:
       - WORDPRESS_DB_HOST=db
       - WORDPRESS_DB_HOST=db:3306
       - WORDPRESS_DB_USER=${DB_USER}
       - WORDPRESS_DB_PASSWORD=${DB_USER_PW}
       - WORDPRESS_DB_NAME=wordpress
    volumes:
      - ./wordpress-files:/var/www/html
    container_name: edelstein_shop_app