Changed roles to new docker backup procedure

This commit is contained in:
Kevin Veen-Birkenbach 2023-12-26 03:13:16 +01:00
parent c2fe8a95c0
commit 15bf140065
35 changed files with 215 additions and 228 deletions

View File

@ -34,10 +34,15 @@
notify: restart backup-docker-to-local.timer notify: restart backup-docker-to-local.timer
when: run_once_backup_docker_to_local is not defined when: run_once_backup_docker_to_local is not defined
- name: create {{backup_docker_to_local_folder}}databases.csv - name: seed database values
copy: command:
src: "{{ inventory_dir }}/files/{{ inventory_hostname }}{{backup_docker_to_local_folder}}databases.csv" cmd: "python database_entry_seeder.py databases.csv {{database_instance}} {{database_host}} {{database_databasename}} {{database_username}} {{database_password}}"
dest: "{{backup_docker_to_local_folder}}databases.csv" chdir: "{{backup_docker_to_local_folder}}"
- name: Set file permissions for databases.csv to be readable, writable, and executable by root only
ansible.builtin.file:
path: "{{ backup_docker_to_local_folder }}databases.csv"
mode: '0700'
owner: root owner: root
group: root group: root
when: run_once_backup_docker_to_local is not defined when: run_once_backup_docker_to_local is not defined

View File

@ -1,9 +1,9 @@
# These could be changed # These could be changed
MYSQL_DATABASE=akaunting MYSQL_DATABASE={{database_databasename}}
MYSQL_USER=admin MYSQL_USER={{database_username}}
# This should definitely be changed to something long and random # This should definitely be changed to something long and random
MYSQL_PASSWORD={{akaunting_database_password}} MYSQL_PASSWORD={{database_password}}
# You should probably leave this # You should probably leave this
MYSQL_ROOT_PASSWORD={{akaunting_database_password}} MYSQL_ROOT_PASSWORD={{database_password}}

View File

@ -1 +1,6 @@
docker_compose_instance_directory: "{{path_docker_compose_instances}}akaunting/" docker_compose_instance_directory: "{{path_docker_compose_instances}}akaunting/"
database_instance: "akaunting"
database_host: "akaunting-db"
database_databasename: "{{database_instance}}"
database_username: "admin"
database_password: "{{akaunting_database_password}}"

View File

@ -24,24 +24,9 @@ services:
volumes: volumes:
- .:/usr/share/nginx/html - .:/usr/share/nginx/html
- .:/var/www - .:/var/www
database:
logging: {% include 'templates/docker-mariadb-service.yml.j2' %}
driver: journald
image: mariadb
restart: always
environment:
MYSQL_DATABASE: "attendize"
MYSQL_USER: "attendize"
MYSQL_PASSWORD: "{{attendize_database_password}}"
MYSQL_ROOT_PASSWORD: "{{attendize_database_password}}"
MARIADB_AUTO_UPGRADE: "1"
volumes:
- database:/var/lib/mysql
healthcheck:
test: "/usr/bin/mariadb --user=attendize --password={{attendize_database_password}} --execute \"SHOW DATABASES;\""
interval: 3s
timeout: 1s
retries: 5
maildev: maildev:
image: maildev/maildev image: maildev/maildev
ports: ports:

View File

@ -1,3 +1,8 @@
--- ---
docker_compose_instance_directory: "{{path_docker_compose_instances}}attendize/" docker_compose_instance_directory: "{{path_docker_compose_instances}}attendize/"
mail_interface_domain: "mail.{{domain}}" mail_interface_domain: "mail.{{domain}}"
database_instance: "attendize"
database_host: "database"
database_databasename: "{{database_instance}}"
database_username: "{{database_instance}}"
database_password: "{{attendize_database_password}}"

View File

@ -1 +1,6 @@
docker_compose_instance_directory: "{{path_docker_compose_instances}}bigbluebutton/" docker_compose_instance_directory: "{{path_docker_compose_instances}}bigbluebutton/"
database_instance: "bigbluebutton"
database_host: "postgres"
database_databasename: "greenlight-v3"
database_username: "postgres"
database_password: ""

View File

@ -10,10 +10,10 @@ services:
- USER_UID=1000 - USER_UID=1000
- USER_GID=1000 - USER_GID=1000
- DB_TYPE=mysql - DB_TYPE=mysql
- DB_HOST=database:3306 - DB_HOST={{database_host}}:3306
- DB_NAME=gitea - DB_NAME={{database_databasename}}
- DB_USER=gitea - DB_USER={{database_username}}
- DB_PASSWD={{gitea_database_password}} - DB_PASSWD={{database_password}}
- SSH_PORT={{ssh_port}} - SSH_PORT={{ssh_port}}
- SSH_LISTEN_PORT=22 - SSH_LISTEN_PORT=22
- DOMAIN={{domain}} - DOMAIN={{domain}}
@ -31,24 +31,7 @@ services:
- /etc/localtime:/etc/localtime:ro - /etc/localtime:/etc/localtime:ro
depends_on: depends_on:
- database - database
database: {% include 'templates/docker-mariadb-service.yml.j2' %}
logging:
driver: journald
image: mariadb
restart: always
environment:
MYSQL_DATABASE: "gitea"
MYSQL_USER: "gitea"
MYSQL_PASSWORD: "{{gitea_database_password}}"
MYSQL_ROOT_PASSWORD: "{{gitea_database_password}}"
MARIADB_AUTO_UPGRADE: "1"
volumes:
- database:/var/lib/mysql
healthcheck:
test: "/usr/bin/mariadb --user=gitea --password={{gitea_database_password}} --execute \"SHOW DATABASES;\""
interval: 3s
timeout: 1s
retries: 5
volumes: volumes:
database: database:
data: data:

View File

@ -1 +1,6 @@
docker_compose_instance_directory: "{{path_docker_compose_instances}}gitea/" docker_compose_instance_directory: "{{path_docker_compose_instances}}gitea/"
database_instance: "gitea"
database_host: "{{database_instance}}"
database_databasename: "{{database_instance}}"
database_username: "{{database_instance}}"
database_password: "{{gitea_database_password}}"

View File

@ -6,10 +6,10 @@ services:
logging: logging:
driver: journald driver: journald
environment: environment:
JOOMLA_DB_HOST: "database:3306" JOOMLA_DB_HOST: "{{database_host}}:3306"
JOOMLA_DB_USER: "joomla" JOOMLA_DB_USER: "{{database_username}}"
JOOMLA_DB_PASSWORD: "{{joomla_database_password}}" JOOMLA_DB_PASSWORD: "{{database_password}}"
JOOMLA_DB_NAME: "joomla" JOOMLA_DB_NAME: "{{database_databasename}}"
restart: always restart: always
links: links:
- database - database
@ -17,19 +17,9 @@ services:
- data:/var/www/html - data:/var/www/html
ports: ports:
- "127.0.0.1:{{http_port}}:80" - "127.0.0.1:{{http_port}}:80"
database:
image: mariadb {% include 'templates/docker-mariadb-service.yml.j2' %}
logging:
driver: journald
environment:
MYSQL_DATABASE: "joomla"
MYSQL_USER: "joomla"
MYSQL_PASSWORD: "{{joomla_database_password}}"
MYSQL_ROOT_PASSWORD: "{{joomla_database_password}}"
MARIADB_AUTO_UPGRADE: "1"
volumes:
- database:/var/lib/mysql
restart: always
volumes: volumes:
database: database:
data: data:

View File

@ -1 +1,6 @@
docker_compose_instance_directory: "{{path_docker_compose_instances}}joomla/" docker_compose_instance_directory: "{{path_docker_compose_instances}}joomla/"
database_instance: "joomla"
database_host: "database"
database_databasename: "{{database_instance}}"
database_username: "{{database_instance}}"
database_password: "{{joomla_database_password}}"

View File

@ -1,35 +1,22 @@
version: "3.7" version: "3.7"
x-application-defaults: &application-defaults
restart: unless-stopped
image: listmonk/listmonk:latest
ports:
- "127.0.0.1:{{http_port}}:9000"
networks:
- listmonk
environment:
- TZ=Etc/UTC
x-database-defaults: &database-defaults
image: postgres:13-alpine
ports:
- "9432:5432"
networks:
- listmonk
environment:
- POSTGRES_PASSWORD={{listmonk_database_password}}
- POSTGRES_USER=listmonk
- POSTGRES_DB=listmonk
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U listmonk"]
interval: 10s
timeout: 5s
retries: 6
services: services:
database: database:
<<: *database-defaults image: postgres:13-alpine
ports:
- "9432:5432"
networks:
- listmonk
environment:
- POSTGRES_PASSWORD={{database_password}}
- POSTGRES_USER={{database_username}}
- POSTGRES_DB={{database_databasename}}
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U {{database_username}}"]
interval: 10s
timeout: 5s
retries: 6
container_name: database container_name: database
volumes: volumes:
- type: volume - type: volume
@ -37,7 +24,14 @@ services:
target: /var/lib/postgresql/data target: /var/lib/postgresql/data
application: application:
<<: *application-defaults restart: unless-stopped
image: listmonk/listmonk:latest
ports:
- "127.0.0.1:{{http_port}}:9000"
networks:
- listmonk
environment:
- TZ=Etc/UTC
container_name: listmonk_application container_name: listmonk_application
depends_on: depends_on:
- database - database

View File

@ -1 +1,6 @@
docker_compose_instance_directory: "{{path_docker_compose_instances}}listmonk/" docker_compose_instance_directory: "{{path_docker_compose_instances}}listmonk/"
database_instance: "listmonk"
database_host: "database"
database_databasename: "{{database_instance}}"
database_username: "{{database_instance}}"
database_password: "{{listmonk_database_password}}"

View File

@ -21,24 +21,7 @@ services:
dns: dns:
- 192.168.203.254 - 192.168.203.254
database: {% include 'templates/docker-mariadb-service.yml.j2' %}
image: mariadb
restart: always
environment:
MYSQL_DATABASE: "mailu"
MYSQL_USER: "mailu"
MYSQL_PASSWORD: "{{mailu_database_password}}"
MYSQL_ROOT_PASSWORD: "{{mailu_database_password}}"
MARIADB_AUTO_UPGRADE: "1"
volumes:
- database:/var/lib/mysql
healthcheck:
test: "/usr/bin/mariadb --user=mailu --password={{mailu_database_password}} --execute \"SHOW DATABASES;\""
interval: 3s
timeout: 1s
retries: 5
logging:
driver: journald
depends_on: depends_on:
- resolver - resolver
dns: dns:

View File

@ -140,15 +140,15 @@ LOG_LEVEL=WARNING
# Database settings # Database settings
################################### ###################################
DB_FLAVOR=mysql DB_FLAVOR=mysql
DB_USER=mailu DB_USER={{database_username}}
DB_PW={{mailu_database_password}} DB_PW={{database_password}}
DB_HOST=database:3306 DB_HOST={{database_host}}:3306
DB_NAME=mailu DB_NAME={{database_databasename}}
ROUNDCUBE_DB_FLAVOR=mysql ROUNDCUBE_DB_FLAVOR=mysql
ROUNDCUBE_DB_USER=mailu ROUNDCUBE_DB_USER={{database_username}}
ROUNDCUBE_DB_PW={{mailu_database_password}} ROUNDCUBE_DB_PW={{database_password}}
ROUNDCUBE_DB_NAME=mailu ROUNDCUBE_DB_NAME={{database_databasename}}
ROUNDCUBE_DB_HOST=database:3306 ROUNDCUBE_DB_HOST={{database_host}}:3306
API_TOKEN={{mailu_api_token}} API_TOKEN={{mailu_api_token}}

View File

@ -1 +1,6 @@
docker_compose_instance_directory: "{{path_docker_compose_instances}}mailu/" docker_compose_instance_directory: "{{path_docker_compose_instances}}mailu/"
database_instance: "mailu"
database_host: "database"
database_databasename: "{{database_instance}}"
database_username: "{{database_instance}}"
database_password: "{{mailu_database_password}}"

View File

@ -5,11 +5,11 @@ SECRET_KEY_BASE={{mastodon_secret_key_base}}
OTP_SECRET={{mastodon_otp_secret}} OTP_SECRET={{mastodon_otp_secret}}
VAPID_PRIVATE_KEY={{mastodon_vapid_private_key}} VAPID_PRIVATE_KEY={{mastodon_vapid_private_key}}
VAPID_PUBLIC_KEY={{mastodon_vapid_public_key}} VAPID_PUBLIC_KEY={{mastodon_vapid_public_key}}
DB_HOST=database DB_HOST={{database_host}}
DB_PORT=5432 DB_PORT=5432
DB_NAME=postgres DB_NAME={{database_databasename}}
DB_USER=postgres DB_USER={{database_username}}
DB_PASS= DB_PASS={{database_password}}
REDIS_HOST=redis REDIS_HOST=redis
REDIS_PORT=6379 REDIS_PORT=6379
REDIS_PASSWORD= REDIS_PASSWORD=

View File

@ -1 +1,6 @@
docker_compose_instance_directory: "{{path_docker_compose_instances}}mastodon/" docker_compose_instance_directory: "{{path_docker_compose_instances}}mastodon/"
database_instance: "mastodon"
database_host: "database"
database_databasename: "postgres" # todo: Change this to standart name scheme for future setups
database_username: "postgres" # todo: Change this to standart name scheme for future setups
database_password: "" # todo: Change this to standart name scheme for future setups

View File

@ -9,35 +9,20 @@ services:
ports: ports:
- "127.0.0.1:{{http_port}}:80" - "127.0.0.1:{{http_port}}:80"
environment: environment:
MATOMO_DATABASE_HOST: "database:3306" MATOMO_DATABASE_HOST: "{{database_host}}:3306"
MATOMO_DATABASE_ADAPTER: "mysql" MATOMO_DATABASE_ADAPTER: "mysql"
MATOMO_DATABASE_USERNAME: "matomo" MATOMO_DATABASE_USERNAME: "{{database_username}}"
MATOMO_DATABASE_PASSWORD: "{{matomo_database_password}}" MATOMO_DATABASE_PASSWORD: "{{database_password}}"
MATOMO_DATABASE_DBNAME: "matomo" MATOMO_DATABASE_DBNAME: "{{database_databasename}}"
links: links:
- database - database
depends_on: depends_on:
- database - database
volumes: volumes:
- data:/var/www/html - data:/var/www/html
database:
logging: {% include 'templates/docker-mariadb-service.yml.j2' %}
driver: journald
image: mariadb
restart: always
environment:
MYSQL_DATABASE: "matomo"
MYSQL_USER: "matomo"
MYSQL_PASSWORD: "{{matomo_database_password}}"
MYSQL_ROOT_PASSWORD: "{{matomo_database_password}}"
MARIADB_AUTO_UPGRADE: "1"
volumes:
- database:/var/lib/mysql
healthcheck:
test: "/usr/bin/mariadb --user=matomo --password={{matomo_database_password}} --execute \"SHOW DATABASES;\""
interval: 3s
timeout: 1s
retries: 5
volumes: volumes:
database: database:
data: data:

View File

@ -1,2 +1,7 @@
--- ---
docker_compose_instance_directory: "{{path_docker_compose_instances}}matomo/" docker_compose_instance_directory: "{{path_docker_compose_instances}}matomo/"
database_instance: "matomo"
database_host: "database"
database_databasename: "{{database_instance}}"
database_username: "{{database_instance}}"
database_password: "{{matomo_database_password}}"

View File

@ -26,12 +26,12 @@ services:
volumes: volumes:
- database:/var/lib/postgresql/data - database:/var/lib/postgresql/data
environment: environment:
- POSTGRES_DB=matrix - POSTGRES_DB={{database_databasename}}
- POSTGRES_USER=matrix - POSTGRES_USER={{database_username}}
- POSTGRES_PASSWORD={{matrix_database_password}} - POSTGRES_PASSWORD={{database_password}}
- POSTGRES_INITDB_ARGS=--encoding=UTF8 --locale=C - POSTGRES_INITDB_ARGS=--encoding=UTF8 --locale=C
healthcheck: healthcheck:
test: ["CMD-SHELL", "pg_isready -U matrix"] test: ["CMD-SHELL", "pg_isready -U {{database_username}}"]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 6 retries: 6

View File

@ -1,2 +1,7 @@
--- ---
docker_compose_instance_directory: "{{path_docker_compose_instances}}matrix/" docker_compose_instance_directory: "{{path_docker_compose_instances}}matrix/"
database_instance: "matrix"
database_host: "database"
database_databasename: "{{database_instance}}"
database_username: "{{database_instance}}"
database_password: "{{matrix_database_password}}"

View File

@ -25,24 +25,9 @@ services:
volumes: volumes:
- "{{docker_compose_instance_confd_directory}}:{{target_mount_conf_d_directory}}:ro" - "{{docker_compose_instance_confd_directory}}:{{target_mount_conf_d_directory}}:ro"
- "data:/var/www/html:ro" - "data:/var/www/html:ro"
database:
logging: {% include 'templates/docker-mariadb-service.yml.j2' %}
driver: journald
image: mariadb
restart: always
environment:
MYSQL_DATABASE: "mybb"
MYSQL_USER: "mybb"
MYSQL_PASSWORD: "{{mybb_database_password}}"
MYSQL_ROOT_PASSWORD: "{{mybb_database_password}}"
MARIADB_AUTO_UPGRADE: "1"
volumes:
- database:/var/lib/mysql
healthcheck:
test: "/usr/bin/mariadb --user=mybb --password={{mybb_database_password}} --execute \"SHOW DATABASES;\""
interval: 3s
timeout: 1s
retries: 5
volumes: volumes:
database: database:
data: data:

View File

@ -4,3 +4,8 @@ docker_compose_instance_confd_directory: "{{docker_compose_instance_directory}}c
docker_compose_instance_confd_defaultconf_file: "{{docker_compose_instance_confd_directory}}default.conf" docker_compose_instance_confd_defaultconf_file: "{{docker_compose_instance_confd_directory}}default.conf"
target_mount_conf_d_directory: "{{nginx_servers_directory}}" target_mount_conf_d_directory: "{{nginx_servers_directory}}"
source_domain: "mybb.{{top_domain}}" source_domain: "mybb.{{top_domain}}"
database_instance: "mybb"
database_host: "database"
database_databasename: "{{database_instance}}"
database_username: "{{database_instance}}"
database_password: "{{mybb_database_password}}"

View File

@ -11,26 +11,26 @@ services:
volumes: volumes:
- data:/var/www/html - data:/var/www/html
environment: environment:
MYSQL_DATABASE: "nextcloud" MYSQL_DATABASE: "{{database_databasename}}"
MYSQL_USER: "nextcloud" MYSQL_USER: "{{database_username}}"
MYSQL_PASSWORD: "{{nextcloud_database_password}}" MYSQL_PASSWORD: "{{database_password}}"
MYSQL_HOST: database:3306 MYSQL_HOST: {{database_host}}:3306
database: database:
logging: logging:
driver: journald driver: journald
image: mariadb:10.5 image: mariadb:10.5
command: "--transaction-isolation=READ-COMMITTED --binlog-format=ROW" command: "--transaction-isolation=READ-COMMITTED --binlog-format=ROW"
environment: environment:
MYSQL_DATABASE: "nextcloud" MYSQL_DATABASE: "{{database_databasename}}"
MYSQL_USER: "nextcloud" MYSQL_USER: "{{database_username}}"
MYSQL_PASSWORD: "{{nextcloud_database_password}}" MYSQL_PASSWORD: "{{database_password}}"
MYSQL_ROOT_PASSWORD: "{{nextcloud_database_password}}" MYSQL_ROOT_PASSWORD: "{{database_password}}"
MARIADB_AUTO_UPGRADE: "1" MARIADB_AUTO_UPGRADE: "1"
volumes: volumes:
- database:/var/lib/mysql - database:/var/lib/mysql
restart: always restart: always
healthcheck: healthcheck:
test: "/usr/bin/mariadb --user=nextcloud --password={{nextcloud_database_password}} --execute \"SHOW DATABASES;\"" test: "/usr/bin/mariadb --user={{database_username}} --password={{database_password}} --execute \"SHOW DATABASES;\""
interval: 3s interval: 3s
timeout: 1s timeout: 1s
retries: 5 retries: 5

View File

@ -1,2 +1,7 @@
--- ---
docker_compose_instance_directory: "{{path_docker_compose_instances}}nextcloud/" docker_compose_instance_directory: "{{path_docker_compose_instances}}nextcloud/"
database_instance: "nextcloud"
database_host: "database"
database_databasename: "{{database_instance}}"
database_username: "{{database_instance}}"
database_password: "{{nextcloud_database_password}}"

View File

@ -12,8 +12,8 @@ OPENPROJECT_HOST__NAME={{domain}}
PORT=127.0.0.1:{{http_port}} PORT=127.0.0.1:{{http_port}}
OPENPROJECT_RAILS__RELATIVE__URL__ROOT= OPENPROJECT_RAILS__RELATIVE__URL__ROOT=
IMAP_ENABLED=false IMAP_ENABLED=false
POSTGRES_PASSWORD="{{ openproject_database_password }}" POSTGRES_PASSWORD="{{ database_password }}"
DATABASE_URL="postgres://postgres:{{ openproject_database_password }}@db/openproject?pool=20&encoding=unicode&reconnect=true" DATABASE_URL="postgres://{{ database_username }}:{{ database_password }}@{{database_host}}/{{database_databasename}}?pool=20&encoding=unicode&reconnect=true"
RAILS_MIN_THREADS=4 RAILS_MIN_THREADS=4
RAILS_MAX_THREADS=16 RAILS_MAX_THREADS=16

View File

@ -2,3 +2,8 @@ repository_directory: "{{ path_docker_compose_instances }}openproject/"
docker_compose_instance_directory: "{{repository_directory}}compose/" docker_compose_instance_directory: "{{repository_directory}}compose/"
docker_compose_file_path: "{{docker_compose_instance_directory}}docker-compose.yml" docker_compose_file_path: "{{docker_compose_instance_directory}}docker-compose.yml"
docker_compose_backup_path: "/tmp/openproject-docker-compose-backup.yml" docker_compose_backup_path: "/tmp/openproject-docker-compose-backup.yml"
database_instance: "openproject"
database_host: "db"
database_databasename: "{{database_instance}}"
database_username: "postgres"
database_password: "{{openproject_database_password}}"

View File

@ -1,11 +1,11 @@
# Database / Postgres service configuration # Database / Postgres service configuration
POSTGRES_USER=peertube POSTGRES_USER={{database_username}}
POSTGRES_PASSWORD={{peertube_database_password}} POSTGRES_PASSWORD={{peertube_database_password}}
POSTGRES_DB=peertube POSTGRES_DB={{database_databasename}}
PEERTUBE_DB_USERNAME=peertube PEERTUBE_DB_USERNAME={{database_username}}
PEERTUBE_DB_PASSWORD={{peertube_database_password}} PEERTUBE_DB_PASSWORD={{peertube_database_password}}
PEERTUBE_DB_SSL=false PEERTUBE_DB_SSL=false
PEERTUBE_DB_HOSTNAME=database PEERTUBE_DB_HOSTNAME={{database_host}}
# PeerTube server configuration # PeerTube server configuration
PEERTUBE_WEBSERVER_HOSTNAME={{domain}} PEERTUBE_WEBSERVER_HOSTNAME={{domain}}

View File

@ -1 +1,6 @@
docker_compose_instance_directory: "{{path_docker_compose_instances}}peertube/" docker_compose_instance_directory: "{{path_docker_compose_instances}}peertube/"
database_instance: "peertube"
database_host: "database"
database_databasename: "{{database_instance}}"
database_username: "{{database_instance}}"
database_password: "{{peertube_database_password}}"

View File

@ -38,20 +38,9 @@ services:
interval: 60s interval: 60s
timeout: 5s timeout: 5s
retries: 1 retries: 1
database:
logging: {% include 'templates/docker-mariadb-service.yml.j2' %}
driver: journald
image: mariadb
restart: always
env_file:
- ./env
volumes:
- database:/var/lib/mysql
healthcheck:
test: "/usr/bin/mariadb --user=pixelfed --password={{pixelfed_database_password}} --execute \"SHOW DATABASES;\""
interval: 3s
timeout: 1s
retries: 5
redis: redis:
image: redis:alpine image: redis:alpine
restart: always restart: always

View File

@ -1,2 +1,7 @@
docker_compose_instance_directory: "{{path_docker_compose_instances}}pixelfed/" docker_compose_instance_directory: "{{path_docker_compose_instances}}pixelfed/"
nginx_docker_reverse_proxy_extra_configuration: "client_max_body_size 512M;" nginx_docker_reverse_proxy_extra_configuration: "client_max_body_size 512M;"
database_instance: "pixelfed"
database_host: "{{database_instance}}"
database_databasename: "{{database_instance}}"
database_username: "{{database_instance}}"
database_password: "{{pixelfed_database_password}}"

View File

@ -11,34 +11,19 @@ services:
ports: ports:
- "127.0.0.1:{{http_port}}:80" - "127.0.0.1:{{http_port}}:80"
environment: environment:
WORDPRESS_DB_HOST: database:3306 WORDPRESS_DB_HOST: "{{database_host}}:3306"
WORDPRESS_DB_USER: "wordpress" WORDPRESS_DB_USER: "{{database_username}}"
WORDPRESS_DB_PASSWORD: "{{wordpress_database_password}}" WORDPRESS_DB_PASSWORD: "{{database_password}}"
WORDPRESS_DB_NAME: "wordpress" WORDPRESS_DB_NAME: "{{database_databasename}}"
links: links:
- database - database
volumes: volumes:
- data:/var/www/html - data:/var/www/html
depends_on: depends_on:
- database - database
database:
logging: {% include 'templates/docker-mariadb-service.yml.j2' %}
driver: journald
image: mariadb
restart: always
environment:
MYSQL_DATABASE: "wordpress"
MYSQL_USER: "wordpress"
MYSQL_PASSWORD: "{{wordpress_database_password}}"
MYSQL_ROOT_PASSWORD: "{{wordpress_database_password}}"
MARIADB_AUTO_UPGRADE: "1"
volumes:
- database:/var/lib/mysql
healthcheck:
test: "/usr/bin/mariadb --user=wordpress --password={{wordpress_database_password}} --execute \"SHOW DATABASES;\""
interval: 3s
timeout: 1s
retries: 5
volumes: volumes:
database: database:
data: data:

View File

@ -1,2 +1,7 @@
docker_compose_instance_directory: "{{path_docker_compose_instances}}wordpress/" docker_compose_instance_directory: "{{path_docker_compose_instances}}wordpress/"
wordpress_max_upload_size: "64M" wordpress_max_upload_size: "64M"
database_instance: "wordpress"
database_host: "database"
database_databasename: "{{database_instance}}"
database_username: "{{database_instance}}"
database_password: "{{wordpress_database_password}}"

View File

@ -1 +1,6 @@
docker_compose_instance_directory: "{{path_docker_compose_instances}}yourls/" docker_compose_instance_directory: "{{path_docker_compose_instances}}yourls/"
database_instance: "yourls"
database_host: "database"
database_databasename: "{{database_instance}}"
database_username: "{{database_instance}}"
database_password: "{{yourls_database_password}}"

View File

@ -0,0 +1,18 @@
database:
logging:
driver: journald
image: mariadb
restart: always
environment:
MYSQL_DATABASE: "{{database_databasename}}"
MYSQL_USER: "{{database_username}}"
MYSQL_PASSWORD: "{{database_password}}"
MYSQL_ROOT_PASSWORD: "{{database_password}}"
MARIADB_AUTO_UPGRADE: "1"
volumes:
- database:/var/lib/mysql
healthcheck:
test: "/usr/bin/mariadb --user={{database_username}} --password={{database_password}} --execute \"SHOW DATABASES;\""
interval: 3s
timeout: 1s
retries: 5