Skip to content

Commit

Permalink
multisite
Browse files Browse the repository at this point in the history
  • Loading branch information
storytellerF committed Jan 12, 2025
1 parent 7b5f93b commit 618573f
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/alpha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
cache: gradle

- name: Build mini app
run: ./scripts/build_scripts/build-app-on-ci.sh mini acommunity.link/
run: ./scripts/build_scripts/build-app-on-ci.sh mini www.acommunity.link/

- name: Build koyeb app
run: ./scripts/build_scripts/build-app-on-ci.sh koyeb respectable-jobie-anabn-3d54150c.koyeb.app/server/
Expand Down

Large diffs are not rendered by default.

49 changes: 42 additions & 7 deletions deploy/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
volumes:
bw-data:
db-data:
minio-data:
certs:
driver: local
Expand Down Expand Up @@ -59,23 +60,29 @@ services:
labels:
- "bunkerweb.INSTANCE=yes"
environment:
- SERVER_NAME=acommunity.link
- SERVER_NAME=www.acommunity.link ui.acommunity.link
- MULTISITE=yes
- DATABASE_URI=${BUNKER_DB_URI}
- API_WHITELIST_IP=127.0.0.0/8 10.20.30.0/24
- USE_REVERSE_PROXY=yes
- REVERSE_PROXY_URL=/
- REVERSE_PROXY_HOST=http://server:8811
- AUTO_LETS_ENCRYPT=yes
- EMAIL_LETS_ENCRYPT=34095089+storytellerF@users.noreply.github.com
- LETS_ENCRYPT_CLEAR_OLD_CERTS=yes
- DISABLE_DEFAULT_SERVER=no
- DISABLE_DEFAULT_SERVER=yes
- USE_LIMIT_REQ=no
- SERVE_FILES=no
- INTERCEPTED_ERROR_CODES=
- REVERSE_PROXY_WS=yes
- REVERSE_PROXY_INTERCEPT_ERRORS=no
- USE_BAD_BEHAVIOR=yes
- BAD_BEHAVIOR_STATUS_CODES=400 403 404 405 429 444
- USE_MODSECURITY_CRS=no
- ui.acommunity.link_USE_UI=yes
- ui.acommunity.link_REVERSE_PROXY_HOST=http://bw-ui:7000
- ui.acommunity.link_INTERCEPTED_ERROR_CODES=400 404 405 413 429 500 501 502 503 504
- ui.acommunity.link_MAX_CLIENT_SIZE=50m
- www.acommunity.link_REVERSE_PROXY_HOST=http://server:8811
- www.acommunity.link_REVERSE_PROXY_INTERCEPT_ERRORS=no
- www.acommunity.link_INTERCEPTED_ERROR_CODES=
networks:
- bw-universe
- bw-services
Expand All @@ -87,9 +94,8 @@ services:
depends_on:
- bunkerweb
- bw-docker
volumes:
- bw-data:/data
environment:
- DATABASE_URI=${BUNKER_DB_URI}
- DOCKER_HOST=tcp://bw-docker:2375
networks:
- bw-universe
Expand All @@ -108,6 +114,33 @@ services:
- bw-docker
profiles:
- bunker
bw-ui:
image: bunkerity/bunkerweb-ui:1.5.12
depends_on:
- bw-docker
environment:
- DATABASE_URI=${BUNKER_DB_URI}
- DOCKER_HOST=tcp://bw-docker:2375
- ADMIN_USERNAME=${BUNKER_ADMIN}
- ADMIN_PASSWORD=${BUNKER_PASS}
networks:
- bw-universe
- bw-docker
profiles:
- bunker-ui

bw-db:
image: postgres
# set shared memory limit when using docker-compose
shm_size: 128mb
environment:
- POSTGRES_DB=${BUNKER_DB}
- POSTGRES_USER=${BUNKER_DB_USER}
- POSTGRES_PASSWORD=${BUNKER_DB_PASS}
volumes:
- bw-data:/var/lib/postgresql/data
networks:
- bw-docker

db:
image: postgres
Expand All @@ -124,6 +157,8 @@ services:
test: [ "CMD-SHELL", "pg_isready -U $$POSTGRES_USER" ]
interval: 1s
start_period: 5s
volumes:
- db-data:/var/lib/postgresql/data
networks:
- bw-services
profiles:
Expand Down
22 changes: 22 additions & 0 deletions deploy/postgres-init/create-multiple-postgresql-databases.sh
Original file line number Diff line number Diff line change
@@ -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;
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
6 changes: 6 additions & 0 deletions dev.env
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ HMAC_KEY=c7b3d44999587eaf7d76b991a995e9068cc3fe1565d9329c8171a2480107bf422b2f346
BUNKER_VERSION=1.5.12
BUNKER_PORT=8080
BUNKER_PORT_SECRET=8443
BUNKER_ADMIN=
BUNKER_PASS=
BUNKER_DB=
BUNKER_DB_URI=
BUNKER_DB_USER=
BUNKER_DB_PASS=

SERVER_PORT=8811
SERVER_URL=http://192.168.2.93:8811/
Expand Down
6 changes: 6 additions & 0 deletions dev.win.env
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ HMAC_KEY=c7b3d44999587eaf7d76b991a995e9068cc3fe1565d9329c8171a2480107bf422b2f346
BUNKER_VERSION=1.5.12
BUNKER_PORT=8080
BUNKER_PORT_SECRET=8443
BUNKER_ADMIN=
BUNKER_PASS=
BUNKER_DB=
BUNKER_DB_URI=
BUNKER_DB_USER=
BUNKER_DB_PASS=

SERVER_PORT=8811
SERVER_URL=http://192.168.31.44:8811/
Expand Down
6 changes: 6 additions & 0 deletions env-filter
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ HMAC_KEY
BUNKER_VERSION
BUNKER_PORT
BUNKER_PORT_SECRET
BUNKER_ADMIN
BUNKER_PASS
BUNKER_DB
BUNKER_DB_URI
BUNKER_DB_USER
BUNKER_DB_PASS
SERVER_PORT
SERVER_URL
WS_SERVER_URL
Expand Down
6 changes: 6 additions & 0 deletions server/src/test/resources/.env
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ HMAC_KEY=c7b3d44999587eaf7d76b991a995e9068cc3fe1565d9329c8171a2480107bf422b2f346
BUNKER_VERSION=
BUNKER_PORT=
BUNKER_PORT_SECRET=
BUNKER_ADMIN=
BUNKER_PASS=
BUNKER_DB=
BUNKER_DB_URI=
BUNKER_DB_USER=
BUNKER_DB_PASS=

SERVER_PORT=8811
SERVER_URL=http://192.168.31.44:8811
Expand Down
3 changes: 0 additions & 3 deletions shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ kotlin {
sourceSets {
androidMain.dependencies {
implementation(libs.bcprov.jdk18on)
// implementation(libs.bcpkix.jdk18on)
implementation(projects.cryptoJvm)
// implementation(libs.bctls.jdk18on)
implementation(libs.cryptography.provider.jdk)
}
commonMain.dependencies {
Expand All @@ -64,7 +62,6 @@ kotlin {
jvmMain.dependencies {
implementation(projects.cryptoJvm)
implementation(libs.bcprov.jdk18on)
// implementation(libs.bcpkix.jdk18on)
implementation(libs.cryptography.provider.jdk)
}
}
Expand Down

0 comments on commit 618573f

Please sign in to comment.