Added draft for central postgres and mariadb. variables and networks still need to be adapted

This commit is contained in:
2023-12-31 11:14:18 +01:00
parent 3fa052f71d
commit a112b67eda
48 changed files with 340 additions and 213 deletions

View File

@@ -5,6 +5,11 @@
loop_control:
loop_var: domain
- name: create database in central Postgres
include_role:
name: docker-postgres
when: enable_central_database | bool
- name: "create {{docker_compose_instance_directory}}"
file:
path: "{{docker_compose_instance_directory}}"

View File

@@ -1,19 +1,5 @@
version: '3'
services:
database:
restart: always
image: postgres:14-alpine
shm_size: 256mb
networks:
- internal_network
healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres']
volumes:
- database:/var/lib/postgresql/data
environment:
- 'POSTGRES_HOST_AUTH_METHOD=trust'
logging:
driver: journald
{% include 'templates/docker-redis-service.yml.j2' %}
@@ -34,7 +20,9 @@ services:
ports:
- "127.0.0.1:{{http_port}}:3000"
depends_on:
{% if not ( enable_central_database | lower | bool ) %}
- database
{% endif %}
- redis
volumes:
- data:/mastodon/public/system
@@ -54,7 +42,9 @@ services:
ports:
- "127.0.0.1:{{stream_port}}:4000"
depends_on:
{% if not ( enable_central_database | lower | bool ) %}
- database
{% endif %}
- redis
logging:
driver: journald
@@ -64,7 +54,9 @@ services:
env_file: .env.production
command: bundle exec sidekiq
depends_on:
{% if not ( enable_central_database | lower | bool ) %}
- database
{% endif %}
- redis
networks:
- external_network
@@ -75,8 +67,14 @@ services:
test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
logging:
driver: journald
{% if not ( enable_central_database | lower | bool ) %}
{% include 'templates/docker-postgres-service.yml.j2' %}
{% endif %}
volumes:
{% if not ( enable_central_database | lower | bool ) %}
database:
{% endif %}
redis:
data:
networks:

View File

@@ -1,6 +1,7 @@
docker_compose_project_name: "mastodon"
docker_compose_instance_directory: "{{path_docker_compose_instances}}{{docker_compose_project_name}}/"
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
database_databasename: "{{docker_compose_project_name}}"
database_username: "{{docker_compose_project_name}}"
database_password: "{{mastodon_database_password}}"
database_version: "{{ mastodon_database_version | default(postgres_default_version) }}"