diff --git a/docker/deployment/db/Dockerfile b/docker/deployment/db/Dockerfile index 521f78a3..db9d9105 100644 --- a/docker/deployment/db/Dockerfile +++ b/docker/deployment/db/Dockerfile @@ -1 +1,3 @@ FROM postgres:12-alpine + +COPY scripts /docker-entrypoint-initdb.d/ diff --git a/docker/deployment/db/scripts/create_databases.sh b/docker/deployment/db/scripts/create_databases.sh new file mode 100644 index 00000000..7abee803 --- /dev/null +++ b/docker/deployment/db/scripts/create_databases.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +set -e +set -u + +function create_user_and_database() { + local database=$1 + echo " Creating user and database '$database'" + psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL + CREATE USER $database WITH PASSWORD '$database'; + CREATE DATABASE $database; + GRANT ALL PRIVILEGES ON DATABASE $database TO $database; +EOSQL +} + +if [ -n "$POSTGRES_MULTIPLE_DATABASES" ]; then + echo "Multiple database creation requested: $POSTGRES_MULTIPLE_DATABASES" + for db in $(echo $POSTGRES_MULTIPLE_DATABASES | tr ',' ' '); do + create_user_and_database $db + done + echo "Multiple databases created" +fi \ No newline at end of file diff --git a/docker/deployment/dev-db.yml b/docker/deployment/dev-db.yml deleted file mode 100644 index fe6a59e3..00000000 --- a/docker/deployment/dev-db.yml +++ /dev/null @@ -1,15 +0,0 @@ -version: '3.7' - -services: - db: - build: ./db - environment: - POSTGRES_USER: hangar - POSTGRES_PASSWORD: 'hangar' - POSTGRES_DB: hangar - ports: - - "5432:5432" - volumes: - - db_data:/var/lib/postgresql/data -volumes: - db_data: diff --git a/docker/deployment/docker-compose.yml b/docker/deployment/docker-compose.yml index 134e7d21..62f5ed21 100644 --- a/docker/deployment/docker-compose.yml +++ b/docker/deployment/docker-compose.yml @@ -13,20 +13,21 @@ services: stdin_open: true labels: - "traefik.enable=true" - - "traefik.http.services.hangarnew.loadbalancer.server.port=8080" - - "traefik.http.routers.hangarnew.rule=Host(`hangar-new.minidigger.me`)" - - "traefik.http.routers.hangarnew.entrypoints=web-secure" - - "traefik.http.routers.hangarnew.tls=true" - - "traefik.http.routers.hangarnew.tls.options=default" - - "traefik.http.routers.hangarnew.tls.certresolver=default" - - "traefik.http.routers.hangarnew.tls.domains[0].main=minidigger.me" - - "traefik.http.routers.hangarnew.tls.domains[0].sans=*.minidigger.me" + - "traefik.http.services.hangar.loadbalancer.server.port=8080" + - "traefik.http.routers.hangar.rule=Host(`hangar.minidigger.me`)" + - "traefik.http.routers.hangar.entrypoints=web-secure" + - "traefik.http.routers.hangar.tls=true" + - "traefik.http.routers.hangar.tls.options=default" + - "traefik.http.routers.hangar.tls.certresolver=default" + - "traefik.http.routers.hangar.tls.domains[0].main=minidigger.me" + - "traefik.http.routers.hangar.tls.domains[0].sans=*.minidigger.me" networks: - web db: image: registry.gitlab.com/minidigger/hangar2/db:latest build: ./db environment: + POSTGRES_MULTIPLE_DATABASES: hangar,hangarauth POSTGRES_USER: hangar POSTGRES_PASSWORD: 'hangar' POSTGRES_DB: hangar @@ -44,7 +45,7 @@ services: - "traefik.enable=true" - "traefik.http.services.hangar-mail.loadbalancer.server.port=8025" - "traefik.http.routers.hangar-mail.middlewares=basicauth@file" - - "traefik.http.routers.hangar-mail.rule=Host(`hangar-mail-new.minidigger.me`)" + - "traefik.http.routers.hangar-mail.rule=Host(`hangar-mail.minidigger.me`)" - "traefik.http.routers.hangar-mail.entrypoints=web-secure" - "traefik.http.routers.hangar-mail.tls=true" - "traefik.http.routers.hangar-mail.tls.options=default" @@ -60,7 +61,7 @@ services: labels: - "traefik.enable=true" - "traefik.http.services.hangar-auth.loadbalancer.server.port=8000" - - "traefik.http.routers.hangar-auth.rule=Host(`hangar-auth-new.minidigger.me`)" + - "traefik.http.routers.hangar-auth.rule=Host(`hangar-auth.minidigger.me`)" - "traefik.http.routers.hangar-auth.entrypoints=web-secure" - "traefik.http.routers.hangar-auth.tls=true" - "traefik.http.routers.hangar-auth.tls.options=default" @@ -75,9 +76,9 @@ services: EMAIL_TLS: "false" EMAIL_HOST_USER: "dum" EMAIL_HOST_PASSWORD: "dum" - DB_NAME: "spongeauth" - DB_USER: "spongeauth" - DB_PASSWORD: "spongeauth" + DB_NAME: "hangarauth" + DB_USER: "hangar" + DB_PASSWORD: "hangar" DB_HOST: "hangar_db" SSO_ENDPOINT_ore: "{ 'sync_sso_endpoint': ('http://hangar_app:9000/api/sync_sso'), 'sso_secret': 'changeme', 'api_key': 'changeme' }" DEBUG: "false" diff --git a/docker/deployment/hangar/application.yml b/docker/deployment/hangar/application.yml index f1fbbd40..de4ab336 100644 --- a/docker/deployment/hangar/application.yml +++ b/docker/deployment/hangar/application.yml @@ -10,8 +10,8 @@ fake-user: hangar: debug: true use-webpack: false - auth-url: "https://hangar-auth-new.minidigger.me" - base-url: "https://hangar-new.minidigger.me" + auth-url: "https://hangar-auth.minidigger.me" + base-url: "https://hangar.minidigger.me" sso: secret: "changeme" @@ -19,5 +19,5 @@ hangar: security: api: - url: "https://hangar-auth-new.minidigger.me" - avatar-url: "https://hangar-auth-new.minidigger.me/avatar/%s?size=120x120" + url: "https://hangar-auth.minidigger.me" + avatar-url: "https://hangar-auth.minidigger.me/avatar/%s?size=120x120" diff --git a/src/main/resources/messages.properties b/src/main/resources/messages.properties index a388730c..a9e5d86d 100644 --- a/src/main/resources/messages.properties +++ b/src/main/resources/messages.properties @@ -64,7 +64,7 @@ general.linkout.title = External Link Warning general.linkout.warning = You have clicked on an external link to "{0}". If you did not intend to visit this link, please go back. Otherwise, click continue. general.restore = Restore deleted general.harddelete = Hard delete -general.stagingWarning = This is a staging server for testing purposes. Data could be deleted at any time. Please use our production server at https://hangar.minidigger.me for uploading your plugins! +general.stagingWarning = This is a staging server for testing purposes. Data could be deleted at any time. Please use our production server at for uploading your plugins! admin.health.title = Hangar Health Report admin.health.discuss = Missing discussion topic