#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:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.env*
|
||||
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"
|
||||
22
docker-compose.yml
Normal file
22
docker-compose.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
services:
|
||||
postgres:
|
||||
image: 'postgres:latest'
|
||||
ports:
|
||||
- "5432:5432"
|
||||
environment:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
# POSTGRES_DB: ${POSTGRES_DB}
|
||||
# volumes:
|
||||
# - ${PWD}/db-data/:/var/lib/postgresql/data/
|
||||
# - ${PWD}/init.sql:/docker-entrypoint-initdb.d/init.sql
|
||||
|
||||
pgadmin:
|
||||
image: dpage/pgadmin4
|
||||
ports:
|
||||
- 8080:80
|
||||
environment:
|
||||
PGADMIN_DEFAULT_EMAIL: admin@admin.de
|
||||
PGADMIN_DEFAULT_PASSWORD: admin
|
||||
# volumes:
|
||||
# - ${PWD}/pgadmin-data/:/var/lib/pgadmin/
|
||||
Reference in New Issue
Block a user