From da759b81167b31a3fe2cc2d7e24e7317362df847 Mon Sep 17 00:00:00 2001 From: Thomas Vanbesien Date: Fri, 19 Dec 2025 17:29:18 +0100 Subject: [PATCH] WIP --- docker-compose.yaml | 60 +++++++++++++---------------------- services/mariadb/Dockerfile | 4 +++ services/mariadb/init.sql | 7 ++++ services/mariadb/my.cnf | 40 +++++++++++++++++++++++ services/nextcloud/Dockerfile | 3 ++ services/nextcloud/mysql.ini | 16 ++++++++++ services/nginx/default.conf | 6 ++-- 7 files changed, 95 insertions(+), 41 deletions(-) create mode 100644 services/mariadb/Dockerfile create mode 100644 services/mariadb/init.sql create mode 100644 services/mariadb/my.cnf create mode 100644 services/nextcloud/Dockerfile create mode 100644 services/nextcloud/mysql.ini diff --git a/docker-compose.yaml b/docker-compose.yaml index f878d41..ae10535 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -9,12 +9,11 @@ networks: gitea-backend: volumes: - nextcloud-db: + db: nextcloud: - openproject-db: - openproject: - gitea-db: gitea: + openproject: + openproject-db: x-op-restart-policy: &restart_policy restart: unless-stopped @@ -56,13 +55,24 @@ services: - openproject - gitea - # NextCloud + db: + build: + context: ./services/mariadb + environment: + - MARIADB_ROOT_PASSWORD=password + networks: + - nextcloud-backend + - gitea-backend + volumes: + - db:/var/lib/mysql nextcloud: image: nextcloud:31-fpm + build: + context: ./services/nextcloud environment: - - MYSQL_HOST=nextcloud-db - - MYSQL_PASSWORD=pswd + - MYSQL_HOST=db + - MYSQL_PASSWORD=password - MYSQL_DATABASE=nextcloud - MYSQL_USER=nextcloud networks: @@ -71,32 +81,18 @@ services: volumes: - nextcloud:/var/www/html depends_on: - - nextcloud-db - - nextcloud-db: - image: mariadb:11-ubi - command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW - environment: - - MARIADB_ROOT_PASSWORD=pswd - - MARIADB_AUTO_UPGRADE=1 - - MARIADB_DISABLE_UPGRADE_BACKUP=1 - networks: - - nextcloud-backend - volumes: - - nextcloud-db:/var/lib/mysql - - # Gitea + - db gitea: image: docker.gitea.com/gitea:1.25.2 environment: - USER_UID=1000 - USER_GID=1000 - - GITEA__database__DB_TYPE=postgres - - GITEA__database__HOST=gitea-db:5432 + - GITEA__database__DB_TYPE=mysql + - GITEA__database__HOST=db:3306 - GITEA__database__NAME=gitea - GITEA__database__USER=gitea - - GITEA__database__PASSWD=gitea + - GITEA__database__PASSWD=password restart: always networks: - gitea-frontend @@ -108,19 +104,7 @@ services: ports: - "222:22" depends_on: - - gitea-db - - gitea-db: - image: docker.io/library/postgres:14 - restart: always - environment: - - POSTGRES_USER=gitea - - POSTGRES_PASSWORD=gitea - - POSTGRES_DB=gitea - networks: - - gitea-backend - volumes: - - gitea-db:/var/lib/postgresql/data + - db # OpenProject diff --git a/services/mariadb/Dockerfile b/services/mariadb/Dockerfile new file mode 100644 index 0000000..f9edc9a --- /dev/null +++ b/services/mariadb/Dockerfile @@ -0,0 +1,4 @@ +FROM mariadb:11.4 + +COPY ./init.sql /docker-entrypoint-initdb.d/init.sql +COPY ./my.cnf /etc/mysql/conf.d/my.cnf diff --git a/services/mariadb/init.sql b/services/mariadb/init.sql new file mode 100644 index 0000000..17485bb --- /dev/null +++ b/services/mariadb/init.sql @@ -0,0 +1,7 @@ +CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'password'; +CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; +GRANT ALL PRIVILEGES on nextcloud.* to 'nextcloud'@'localhost'; + +CREATE USER 'gitea'@'localhost' IDENTIFIED BY 'password'; +CREATE DATABASE gitea CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; +GRANT ALL PRIVILEGES ON gitea.* TO 'gitea'@'localhost'; diff --git a/services/mariadb/my.cnf b/services/mariadb/my.cnf new file mode 100644 index 0000000..c328943 --- /dev/null +++ b/services/mariadb/my.cnf @@ -0,0 +1,40 @@ +[mariadb] +host-cache-size = 128 +skip-name-resolve = true + +[mysqld] +transaction_isolation = READ-COMMITTED +binlog_format = ROW + +[server] +skip_name_resolve = 1 +innodb_buffer_pool_size = 128M +innodb_buffer_pool_instances = 1 +innodb_flush_log_at_trx_commit = 2 +innodb_log_buffer_size = 32M +innodb_max_dirty_pages_pct = 90 +query_cache_type = 1 +query_cache_limit = 2M +query_cache_min_res_unit = 2k +query_cache_size = 64M +tmp_table_size= 64M +max_heap_table_size= 64M +slow_query_log = 1 +slow_query_log_file = /var/log/mysql/slow.log +long_query_time = 1 + +[client-server] +!includedir /etc/mysql/conf.d/ +!includedir /etc/mysql/mariadb.conf.d/ + +[client] +default-character-set = utf8mb4 + +[mysqld] +character_set_server = utf8mb4 +collation_server = utf8mb4_general_ci +transaction_isolation = READ-COMMITTED +binlog_format = ROW +innodb_large_prefix=on +innodb_file_format=barracuda +innodb_file_per_table=1 diff --git a/services/nextcloud/Dockerfile b/services/nextcloud/Dockerfile new file mode 100644 index 0000000..c0b198e --- /dev/null +++ b/services/nextcloud/Dockerfile @@ -0,0 +1,3 @@ +FROM nextcloud:31-fpm + +COPY ./mysql.ini /usr/local/etc/php/conf.d/mysql.ini diff --git a/services/nextcloud/mysql.ini b/services/nextcloud/mysql.ini new file mode 100644 index 0000000..a3500bc --- /dev/null +++ b/services/nextcloud/mysql.ini @@ -0,0 +1,16 @@ +# configuration for PHP MySQL module +extension=pdo_mysql.so + +[mysql] +mysql.allow_local_infile=On +mysql.allow_persistent=On +mysql.cache_size=2000 +mysql.max_persistent=-1 +mysql.max_links=-1 +mysql.default_port= +mysql.default_socket=/var/lib/mysql/mysql.sock # Debian squeeze: /var/run/mysqld/mysqld.sock +mysql.default_host= +mysql.default_user= +mysql.default_password= +mysql.connect_timeout=60 +mysql.trace_mode=Off diff --git a/services/nginx/default.conf b/services/nginx/default.conf index ee1d80c..242ccf9 100644 --- a/services/nginx/default.conf +++ b/services/nginx/default.conf @@ -20,7 +20,7 @@ server { server { listen 443 ssl; - server_name openproject.yourdomain.com; + server_name openproject.localhost; ssl_certificate /etc/ssl/crt/server.crt; ssl_certificate_key /etc/ssl/crt/server.key; @@ -40,7 +40,7 @@ server { server { listen 443 ssl; - server_name gitea.yourdomain.com; + server_name gitea.localhost; ssl_certificate /etc/ssl/crt/server.crt; ssl_certificate_key /etc/ssl/crt/server.key; @@ -61,7 +61,7 @@ server { # https://github.com/nextcloud/docker/blob/master/.examples/docker-compose/with-nginx-proxy/mariadb/fpm/web/nginx.conf server { listen 443 ssl; - server_name nextcloud.yourdomain.com; + server_name nextcloud.localhost; ssl_certificate /etc/ssl/crt/server.crt; ssl_certificate_key /etc/ssl/crt/server.key;