From 0011366a8a408c1cd22e95174d5002b67fd78e94 Mon Sep 17 00:00:00 2001 From: missytake Date: Sun, 7 Jun 2020 15:13:08 +0200 Subject: [PATCH] podman-compose doesn't work, added run script --- backup.sh | 18 ++++++++++++++++++ docker-compose.yml | 30 ------------------------------ run-wordpress.sh | 31 +++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 30 deletions(-) create mode 100755 backup.sh delete mode 100644 docker-compose.yml create mode 100644 run-wordpress.sh diff --git a/backup.sh b/backup.sh new file mode 100755 index 0000000..6c9dd69 --- /dev/null +++ b/backup.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +. ./.env +# stop the containers to make sure the data doesn't change during backup. +podman stop wordpress_wordpress_1 wordpress_db_1 + +# Example backup command: +# backup: is the remote backup server, defined in ~/.ssh/config - ends with a : +# repositories-borg/synthikat is the path on the remote server - ends with a :: +# 'backup{now:%Y%m%d}' is the backup name, this includes today's date in the name +# the rest are the file paths. You can append as many as you want. +borg create --stats --progress backup:repositories-borg/synthikat::'backup{now:%Y%m%d-%M}' wp-content db_data + +# restart the containers +podman start wordpress_wordpress_1 wordpress_db_1 + +# Delete all the backups which are too old, to save space in the long term. +borg prune --keep-daily=7 --keep-weekly=4 backup:repositories-borg/synthikat diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 29359dd..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,30 +0,0 @@ -version: '3.3' - -services: - db: - image: mysql:5.7 - volumes: - - ../db_data/_data/:/var/lib/mysql - restart: always - environment: - MYSQL_ROOT_PASSWORD: $MYSQL_ROOT_PASSWORD - MYSQL_DATABASE: wordpress - MYSQL_USER: wordpress - MYSQL_PASSWORD: $MYSQL_PASSWORD - - wordpress: - depends_on: - - db - image: wordpress:latest - links: - - db - ports: - - 80:80 - restart: unless-stopped - environment: - WORDPRESS_DB_HOST: db:3306 - WORDPRESS_DB_USER: wordpress - WORDPRESS_DB_PASSWORD: $MYSQL_PASSWORD - volumes: - - ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini - diff --git a/run-wordpress.sh b/run-wordpress.sh new file mode 100644 index 0000000..4844b39 --- /dev/null +++ b/run-wordpress.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +# include environment variables +. ./.env +# stop and remove old containers +podman rm -f wordpress_db_1 wordpress_wordpress_1 + +# run db container +podman run --name=wordpress_db_1 --detach \ + -e MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} \ + -e MYSQL_DATABASE=wordpress \ + -e MYSQL_USER=wordpress \ + -e MYSQL_PASSWORD=${MYSQL_PASSWORD} \ + --mount type=bind,source=/home/${USER}/db_data/_data/,destination=/var/lib/mysql \ + -p ${MYSQL_PORT}:3306 \ + mysql:5.7 + +# run wordpress container +podman run --name=wordpress_wordpress_1 --detach \ + -e WORDPRESS_DB_HOST=78.46.128.202:${MYSQL_PORT} \ + -e WORDPRESS_DB_USER=wordpress \ + -e WORDPRESS_DB_PASSWORD=${MYSQL_PASSWORD} \ + -e WORDPRESS_DB_NAME=wordpress \ + --mount type=bind,source=/home/${USER}/wp-content,destination=/var/www/html/wp-content \ + --mount type=bind,source=/home/${USER}/uploads.ini,destination=/usr/local/etc/php/conf.d/uploads.ini \ + -p 127.0.0.1:${NGINX_PORT}:80 \ + wordpress:${WORDPRESS_VERSION} + +# show running containers +podman ps +podman logs -ft wordpress_wordpress_1