From 854b7a23382825fc558e8c18a1a011f6f4b18b7f Mon Sep 17 00:00:00 2001 From: finn Date: Thu, 19 Mar 2026 14:52:24 -0700 Subject: [PATCH] update db helper --- compose.yaml | 38 +++++--------------------------------- db/init/01-databases.sql | 7 +++++-- 2 files changed, 10 insertions(+), 35 deletions(-) diff --git a/compose.yaml b/compose.yaml index 420439d..896c92d 100644 --- a/compose.yaml +++ b/compose.yaml @@ -31,7 +31,7 @@ services: #tty: true restart: always # Comment following line to use flask (1worker, dev), uncomment to use uwsgi (wsgi) - command: ["uwsgi", "--http", "0.0.0.0:8000", "--master", "-p", "4", "-w", "microblog:app"] + #command: ["uwsgi", "--http", "0.0.0.0:8000", "--master", "-p", "4", "-w", "microblog:app"] container_name: backend environment: - MYSQL_USER=flasku @@ -81,7 +81,7 @@ services: - GITEA__server__LANDING_PAGE=explore - GITEA__ui__REACTIONS="+1, -1, fu, heart, laugh, confused, hooray, eyes, gun, boom, poop, kiss, rocket, bomb, chart_with_downwards_trend, eggplant" # To disable new users after setup: - - GITEA__service__DISABLE_REGISTRATION=true + - GITEA__service__DISABLE_REGISTRATION=false networks: - backnet - frontnet @@ -99,9 +99,9 @@ services: proxy: build: proxy restart: always - volumes: - - /home/finn/d/cert/var/lib/letsencrypt:/var/lib/letsencrypt:ro - - /home/finn/d/cert/etc/letsencrypt:/etc/letsencrypt:ro + #volumes: + # - /home/finn/d/cert/var/lib/letsencrypt:/var/lib/letsencrypt:ro + # - /home/finn/d/cert/etc/letsencrypt:/etc/letsencrypt:ro ports: - "80:80" - "443:443" @@ -152,37 +152,9 @@ services: networks: - frontnet - nextcloud: - image: nextcloud:latest - restart: always - container_name: nextcloud - volumes: - - nextcloud-data:/var/www/html - - nextcloud-apps:/var/www/html/custom_apps - - nextcloud-config:/var/www/html/config - - nextcloud-data:/var/www/html/data - environment: - - NEXTCLOUD_TRUSTED_DOMAINS=nextcloud.oily.dad - - MYSQL_HOST=db - - MYSQL_DATABASE=nextcloud - - MYSQL_USER=nextcloud - - MYSQL_PASSWORD=${DOTENV_MYSQL_NEXTCLOUD_PASSWORD} - - NEXTCLOUD_ADMIN_USER=admin - - NEXTCLOUD_ADMIN_PASSWORD=${DOTENV_NEXTCLOUD_ADMIN_PASSWORD} - - NEXTCLOUD_DATA_DIR=/var/www/html/data - networks: - - backnet - - frontnet - depends_on: - db: - condition: service_healthy - volumes: db-data: pmb-root: - nextcloud-data: - nextcloud-apps: - nextcloud-config: networks: backnet: diff --git a/db/init/01-databases.sql b/db/init/01-databases.sql index a3cbbfc..9c484e4 100644 --- a/db/init/01-databases.sql +++ b/db/init/01-databases.sql @@ -1,12 +1,15 @@ -- create databases CREATE DATABASE IF NOT EXISTS `gitea`; CREATE DATABASE IF NOT EXISTS `flask`; +CREATE DATABASE IF NOT EXISTS `nextcloud`; -- create root user and grant rights -CREATE USER 'gitea'@'gitea.backnet' IDENTIFIED BY 'giteap'; -CREATE USER 'flasku'@'backend.backnet' IDENTIFIED BY 'flaskp'; +CREATE USER IF NOT EXISTS 'gitea'@'gitea.backnet' IDENTIFIED BY 'giteap'; +CREATE USER IF NOT EXISTS 'flasku'@'backend.backnet' IDENTIFIED BY 'flaskp'; +CREATE USER IF NOT EXISTS 'nextcloud'@'nextcloud.backnet' IDENTIFIED BY 'nextcloudp'; --CREATE USER 'gitea'@'localhost' IDENTIFIED BY 'gitea'; --GRANT ALL ON `gitea` TO 'gitea'@'localhost'; GRANT ALL ON gitea.* TO 'gitea'@'gitea.backnet'; GRANT ALL ON flask.* TO 'flasku'@'backend.backnet'; +GRANT ALL ON nextcloud.* TO 'nextcloud'@'nextcloud.backnet';