replace mariadb with postgresql

load postgres and nextcloud db config from secrets to auto-configure
This commit is contained in:
James 2022-01-31 21:30:08 +00:00
parent 57a0f09110
commit 4193d7ac4b
5 changed files with 39 additions and 20 deletions

View File

@ -4,8 +4,8 @@ VOLUME_PATH=/data/nextcloud
# nextcloud # nextcloud
NEXTCLOUD_TAG=23-apache NEXTCLOUD_TAG=23-apache
# mariadb # postgres
MARIADB_TAG=10 POSTGRES_TAG=14
# nginx # nginx
NGINX_HOST=localhost # REPLACE NGINX_HOST=localhost # REPLACE

5
.gitignore vendored
View File

@ -1,2 +1,5 @@
.env .env
mariadb_password.txt
# Secrets
secrets/postgres_password.txt
secrets/nextcloud*

View File

@ -1,21 +1,29 @@
secrets: secrets:
mariadb_password: postgres_db:
file: ./mariadb_password.txt file: ./secrets/postgres_db.txt
postgres_user:
file: ./secrets/postgres_user.txt
postgres_password:
file: ./secrets/postgres_password.txt
nextcloud_admin_user:
file: ./secrets/nextcloud_admin_user.txt
nextcloud_admin_password:
file: ./secrets/nextcloud_admin_password.txt
services: services:
db: db:
image: mariadb:${MARIADB_TAG} image: postgres:${POSTGRES_TAG}
restart: unless-stopped restart: unless-stopped
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW --innodb-file-per-table=1 --skip-innodb-read-only-compressed
secrets:
- mariadb_password
volumes: volumes:
- ${VOLUME_PATH}/var/lib/mysql:/var/lib/mysql - ${VOLUME_PATH}/var/lib/postgresql/data:/var/lib/postgresql/data:rw
secrets:
- postgres_db
- postgres_user
- postgres_password
environment: environment:
MARIADB_RANDOM_ROOT_PASSWORD: "yes" POSTGRES_DB_FILE: /run/secrets/postgres_db
MARIADB_PASSWORD_FILE: /run/secrets/mariadb_password POSTGRES_USER_FILE: /run/secrets/postgres_user
MARIADB_DATABASE: nextcloud POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
MARIADB_USER: nextcloud
redis: redis:
image: redis:alpine image: redis:alpine
@ -28,14 +36,20 @@ services:
NEXTCLOUD_TAG: ${NEXTCLOUD_TAG} NEXTCLOUD_TAG: ${NEXTCLOUD_TAG}
restart: unless-stopped restart: unless-stopped
volumes: volumes:
- ${VOLUME_PATH}/var/www/html:/var/www/html - ${VOLUME_PATH}/var/www/html:/var/www/html:rw
secrets: secrets:
- mariadb_password - postgres_db
- postgres_user
- postgres_password
- nextcloud_admin_user
- nextcloud_admin_password
environment: environment:
MYSQL_PASSWORD_FILE: /run/secrets/mariadb_password POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
MYSQL_DATABASE: nextcloud POSTGRES_DB_FILE: /run/secrets/postgres_db
MYSQL_USER: nextcloud POSTGRES_USER_FILE: /run/secrets/postgres_user
MYSQL_HOST: db POSTGRES_HOST: db
NEXTCLOUD_ADMIN_PASSWORD_FILE: /run/secrets/nextcloud_admin_password
NEXTCLOUD_ADMIN_USER_FILE: /run/secrets/nextcloud_admin_user
REDIS_HOST: redis REDIS_HOST: redis
NEXTCLOUD_TRUSTED_DOMAINS: ${NGINX_HOST} NEXTCLOUD_TRUSTED_DOMAINS: ${NGINX_HOST}
OVERWRITEPROTOCOL: https OVERWRITEPROTOCOL: https

1
secrets/postgres_db.txt Normal file
View File

@ -0,0 +1 @@
nextcloud

View File

@ -0,0 +1 @@
nextcloud