Implemented vars, tasks and templates for central database setup until mastodon role

This commit is contained in:
2024-01-02 21:13:34 +01:00
parent 4e09fbd3fb
commit ab7ca07ac9
76 changed files with 431 additions and 467 deletions

View File

@@ -1,19 +1,18 @@
---
- name: include docker vars
include_vars: vars/docker-database-service.yml.j2
- name: create central database
include_role:
name: docker-{{database_type}}
when: enable_central_database | bool
- name: "include tasks nginx-docker-proxy-domain.yml"
include_tasks: nginx-docker-proxy-domain.yml
- name: Create database in central MariaDB
include_role:
name: docker-mariadb
when: enable_central_database | bool
- name: "include tasks update-repository-with-docker-compose.yml"
include_tasks: update-repository-with-docker-compose.yml
- name: configure db.env
template: src=db.env.j2 dest={{docker_compose_instance_directory}}/env/db.env
notify: docker compose project setup
- name: configure run.env
template: src=run.env.j2 dest={{docker_compose_instance_directory}}/env/run.env
notify: docker compose project setup

View File

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

View File

@@ -1,6 +1,9 @@
version: '3.7'
services:
{% include 'templates/docker-{{ database_type }}-service.yml.j2' %}
application:
image: docker.io/akaunting/akaunting:{{version_akaunting}}
build:
@@ -14,15 +17,11 @@ services:
- env/run.env
environment:
- AKAUNTING_SETUP
{% if not enable_central_database %}
depends_on:
- database
{% include 'templates/docker-mariadb-service.yml.j2' %}
{% endif %}
{% include 'templates/docker-networks-for-container.yml.j2' %}
{% include 'templates/docker-depends-on-central-database.yml.j2' %}
volumes:
data:
{% if not enable_central_database %}
database:
{% endif %}
{% include 'templates/docker-database-volume.yml.j2' %}
{% include 'templates/docker-networks-for-role.yml.j2' %}

View File

@@ -3,12 +3,12 @@ APP_URL=https://{{domain}}
LOCALE=en-US
# Don't change this unless you rename your database container or use rootless podman, in case of using rootless podman you should set it to 127.0.0.1 (NOT localhost)
DB_HOST=akaunting-db
DB_HOST={{database_host}}
# Change these to match env/db.env
DB_DATABASE=akaunting
DB_USERNAME=admin
DB_PASSWORD={{akaunting_database_password}}
DB_DATABASE={{database_databasename}}
DB_USERNAME={{database_username}}
DB_PASSWORD={{database_password}}
# You should change this to a random string of three numbers or letters followed by an underscore
DB_PREFIX=asd_

View File

@@ -1,9 +1,6 @@
docker_compose_project_name: "akaunting"
docker_compose_instance_directory: "{{path_docker_compose_instances}}{{docker_compose_project_name}}/"
docker_compose_file_path: "{{docker_compose_instance_directory}}docker-compose.yml"
docker_compose_backup_path: "/tmp/{{docker_compose_project_name}}-docker-compose-backup.yml"
database_host: "database"
database_databasename: "{{docker_compose_project_name}}"
database_username: "admin"
database_type: "mariadb"
database_password: "{{akaunting_database_password}}"
repository_address: "https://github.com/akaunting/docker.git"