Solved authentification bug and added draft for socket

This commit is contained in:
Kevin Veen-Birkenbach 2024-01-03 18:01:58 +01:00
parent cd87e7a38c
commit 3af533a17c
4 changed files with 26 additions and 14 deletions

View File

@ -4,6 +4,11 @@
state: present state: present
when: run_once_docker_mariadb is not defined when: run_once_docker_mariadb is not defined
- name: Create a volume for MariaDB socket
docker_volume:
name: mariadb_socket
when: run_once_docker_mariadb is not defined
- name: install MariaDB - name: install MariaDB
docker_container: docker_container:
name: central-mariadb name: central-mariadb
@ -15,26 +20,27 @@
networks: networks:
- name: central_mariadb_network - name: central_mariadb_network
volumes: volumes:
- database:/var/lib/mysql - central_mariadb_database:/var/lib/mysql
- central_mariadb_socket:/var/run/mysqld
published_ports: published_ports:
- "127.0.0.1:3306:3306" - "127.0.0.1:3306:3306" # can be that this will be removed if all applications use sockets
command: "--transaction-isolation=READ-COMMITTED --binlog-format=ROW" #for nextcloud command: "--transaction-isolation=READ-COMMITTED --binlog-format=ROW" #for nextcloud
when: run_once_docker_mariadb is not defined when: run_once_docker_mariadb is not defined
- name: wait for availability of mariadb
wait_for:
host: "127.0.0.1"
port: "3306"
delay: 0
timeout: 120
when: run_once_docker_mariadb is not defined
- name: install python-mysqlclient - name: install python-mysqlclient
pacman: pacman:
name: python-mysqlclient name: python-mysqlclient
state: present state: present
when: run_once_docker_mariadb is not defined when: run_once_docker_mariadb is not defined
- name: wait for database
wait_for:
host: 127.0.0.1
port: 3306
delay: 10
timeout: 300
when: run_once_docker_mariadb is not defined
- name: create database - name: create database
mysql_db: mysql_db:
name: "{{ database_databasename }}" name: "{{ database_databasename }}"
@ -44,10 +50,12 @@
login_host: 127.0.0.1 login_host: 127.0.0.1
login_port: 3306 login_port: 3306
- name: create database user - name: create database user
mysql_user: mysql_user:
name: "{{database_username}}" name: "{{database_username}}"
password: "{{database_password}}" password: "{{database_password}}"
host: "%"
priv: '{{database_databasename}}.*:ALL' priv: '{{database_databasename}}.*:ALL'
state: present state: present
login_user: root login_user: root

View File

@ -12,13 +12,14 @@ services:
ports: ports:
- "127.0.0.1:{{http_port}}:80" - "127.0.0.1:{{http_port}}:80"
environment: environment:
YOURLS_DB_HOST: "{{database_host}}:3306" YOURLS_DB_HOST: "{{database_host}}"
YOURLS_DB_USER: "{{database_username}}" YOURLS_DB_USER: "{{database_username}}"
YOURLS_DB_PASS: "{{database_password}}" YOURLS_DB_PASS: "{{database_password}}"
YOURLS_DB_NAME: "{{database_databasename}}" YOURLS_DB_NAME: "{{database_databasename}}"
YOURLS_SITE: "https://{{domain}}" YOURLS_SITE: "https://{{domain}}"
YOURLS_USER: "{{yourls_user}}" YOURLS_USER: "{{yourls_user}}"
YOURLS_PASS: "{{yourls_user_password}}" YOURLS_PASS: "{{yourls_user_password}}"
{% include 'templates/docker-container-depends-on-just-database.yml.j2' %} {% include 'templates/docker-container-depends-on-just-database.yml.j2' %}
{% include 'templates/docker-container-networks.yml.j2' %} {% include 'templates/docker-container-networks.yml.j2' %}

View File

@ -1,5 +1,8 @@
# This needs to be included in docker-compose.yml which just contain a database volume # This needs to be included in docker-compose.yml which just contain a database volume
#volumes:
{% if not enable_central_database | bool %} {% if not enable_central_database | bool %}
volumes: volumes:
database: database:
#{% else %}
# mariadb_socket:
{% endif %} {% endif %}