podman-compose doesn't work, added run script

missytake 2020-06-07 15:13:08 +02:00
parent c33682e5cd
commit 0011366a8a
3 changed files with 49 additions and 30 deletions

18
backup.sh Executable file
View File

@ -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

View File

@ -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

31
run-wordpress.sh Normal file
View File

@ -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