#73 add init for db
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 3m8s
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 3m8s
This commit is contained in:
21
create-db.sh
Executable file
21
create-db.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
|
||||
PW_POSTGRES=$(openssl rand -base64 32)
|
||||
PW_UMAMI=$(openssl rand -base64 32)
|
||||
PW_KEYCLOAK=$(openssl rand -base64 32)
|
||||
PW_APP=$(openssl rand -base64 32)
|
||||
|
||||
printf "DATABASE_URL=postgresql://umami:$PW_UMAMI@postgres:5432/umami\nDATABASE_TYPE=postgresql\nAPP_SECRET=$(openssel rand -base64 128)" > .env.umami
|
||||
printf "KC_DB_URL=postgresql://keycloak:$PW_KEYCLOAK@postgres:5432/keycloak" > .env.keycloak
|
||||
|
||||
psql -U postgres -c "CREATE ROLE umami WITH LOGIN PASSWORD '$PW_UMAMI';"
|
||||
psql -U postgres -c "CREATE ROLE keycloak WITH LOGIN PASSWORD '$PW_KEYCLOAK';"
|
||||
psql -U postgres -c "CREATE ROLE app WITH LOGIN PASSWORD '$PW_APP';"
|
||||
|
||||
psql -U postgres -c "CREATE DATABASE umami WITH OWNER umami ENCODING 'UTF8' LC_COLLATE='en_US.utf8' LC_CTYPE='en_US.utf8';"
|
||||
psql -U postgres -c "CREATE DATABASE keycloak WITH OWNER keycloak ENCODING 'UTF8' LC_COLLATE='en_US.utf8' LC_CTYPE='en_US.utf8';"
|
||||
psql -U postgres -c "CREATE DATABASE app WITH OWNER app ENCODING 'UTF8' LC_COLLATE='en_US.utf8' LC_CTYPE='en_US.utf8';"
|
||||
|
||||
psql -U postgres -c "ALTER ROLE postgres WITH PASSWORD '$PW_POSTGRES';"
|
||||
|
||||
|
||||
echo "Postgres password: $PW_POSTGRES"
|
||||
Reference in New Issue
Block a user