diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index 0d39230..3cd1d92 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -1,7 +1,7 @@ services: pg-compeng: container_name: datalens-pg-compeng - image: postgres:13-alpine + image: postgres:16-alpine environment: POSTGRES_PASSWORD: "postgres" POSTGRES_DB: postgres @@ -47,7 +47,7 @@ services: pg-demo-connection: container_name: datalens-pg-demo-connection - image: postgres:13-alpine + image: postgres:16-alpine environment: POSTGRES_DB: demo POSTGRES_USER: demo @@ -58,7 +58,7 @@ services: pg-us: container_name: datalens-pg-us - image: postgres:13-alpine + image: postgres:16-alpine environment: POSTGRES_DB: us-db-ci_purgeable POSTGRES_USER: us diff --git a/docker-compose.yml b/docker-compose.yml index 36ebf5f..9695b37 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ services: pg-compeng: container_name: datalens-pg-compeng - image: postgres:13-alpine + image: postgres:16-alpine environment: POSTGRES_PASSWORD: "postgres" POSTGRES_DB: postgres @@ -43,24 +43,24 @@ services: pg-demo-connection: container_name: datalens-pg-demo-connection - image: postgres:13-alpine + image: postgres:16-alpine environment: POSTGRES_DB: demo POSTGRES_USER: demo POSTGRES_PASSWORD: demo volumes: - - ./pg-demo-connection/data:/var/lib/postgresql/data + - ${VOLUME_DEMO:-./pg-demo-connection/data}:/var/lib/postgresql/data - ./pg-demo-connection/init:/docker-entrypoint-initdb.d pg-us: container_name: datalens-pg-us - image: postgres:13-alpine + image: postgres:16-alpine environment: POSTGRES_DB: us-db-ci_purgeable POSTGRES_USER: us POSTGRES_PASSWORD: us volumes: - - ./metadata:/var/lib/postgresql/data + - ${VOLUME_US:-./metadata}:/var/lib/postgresql/data us: container_name: datalens-us diff --git a/docker-compose.zitadel.yml b/docker-compose.zitadel.yml index a8c7722..b37722e 100644 --- a/docker-compose.zitadel.yml +++ b/docker-compose.zitadel.yml @@ -1,7 +1,7 @@ services: pg-compeng: container_name: datalens-pg-compeng - image: postgres:13-alpine + image: postgres:16-alpine environment: POSTGRES_PASSWORD: "postgres" POSTGRES_DB: postgres @@ -59,24 +59,24 @@ services: pg-demo-connection: container_name: datalens-pg-demo-connection - image: postgres:13-alpine + image: postgres:16-alpine environment: POSTGRES_DB: demo POSTGRES_USER: demo POSTGRES_PASSWORD: demo volumes: - ./pg-demo-connection/init:/docker-entrypoint-initdb.d - - ./pg-demo-connection/data:/var/lib/postgresql/data + - ${VOLUME_DEMO:-./pg-demo-connection/data}:/var/lib/postgresql/data pg-us: container_name: datalens-pg-us - image: postgres:13-alpine + image: postgres:16-alpine environment: POSTGRES_DB: us-db-ci_purgeable POSTGRES_USER: us POSTGRES_PASSWORD: us volumes: - - ./metadata:/var/lib/postgresql/data + - ${VOLUME_US:-./metadata}:/var/lib/postgresql/data us: container_name: datalens-us @@ -120,7 +120,7 @@ services: ports: - "8087:5432" volumes: - - ./zitadel-db:/var/lib/postgresql/data + - ${VOLUME_ZITADEL:-./zitadel-db}:/var/lib/postgresql/data zitadel: restart: 'always' @@ -194,3 +194,8 @@ services: ZITADEL_COOKIE_SECRET: ${ZITADEL_COOKIE_SECRET:?missed ZITADEL_COOKIE_SECRET env}" SERVICE_CLIENT_ID: "charts" SERVICE_CLIENT_SECRET: "${CHARTS_SERVICE_CLIENT_SECRET}" + +volumes: + db-us: + db-zitadel: + db-demo: diff --git a/init.sh b/init.sh index 9bdbf3f..974aff4 100755 --- a/init.sh +++ b/init.sh @@ -440,6 +440,12 @@ delete_admin_service_user() { start_compose() { DOCKER_COMPOSE_CONFIG=docker-compose.zitadel.yml + if [ "${USE_DOCKER_VOLUMES}" == "true" ]; then + export VOLUME_ZITADEL="db-zitadel" + export VOLUME_US="db-us" + export VOLUME_DEMO="db-demo" + fi + $(get_docker_compose_command) -f ${DOCKER_COMPOSE_CONFIG} up -d } @@ -473,6 +479,13 @@ install_zitadel() { generate_secret ZITADEL_COOKIE_SECRET 32 generate_secret US_MASTER_TOKEN 32 + if [ "${USE_DOCKER_VOLUMES}" == "true" ]; then + write_env USE_DOCKER_VOLUMES "${USE_DOCKER_VOLUMES}" + export VOLUME_ZITADEL="db-zitadel" + export VOLUME_US="db-us" + export VOLUME_DEMO="db-demo" + fi + start_zitadel if [ ! -z "${ZITADEL_ADMIN_ACCESS_TOKEN}" ]; then diff --git a/templates/docker-compose.j2 b/templates/docker-compose.j2 index 87090c9..6bc9652 100644 --- a/templates/docker-compose.j2 +++ b/templates/docker-compose.j2 @@ -1,7 +1,7 @@ services: pg-compeng: container_name: datalens-pg-compeng - image: postgres:13-alpine + image: postgres:16-alpine environment: POSTGRES_PASSWORD: "postgres" POSTGRES_DB: postgres @@ -51,7 +51,7 @@ services: pg-demo-connection: container_name: datalens-pg-demo-connection - image: postgres:13-alpine + image: postgres:16-alpine environment: POSTGRES_DB: demo POSTGRES_USER: demo @@ -61,13 +61,13 @@ services: - db-demo:/var/lib/postgresql/data - ./pg-demo-connection/init:/docker-entrypoint-initdb.d {%- else %} - - ./pg-demo-connection/data:/var/lib/postgresql/data + - ${VOLUME_DEMO:-./pg-demo-connection/data}:/var/lib/postgresql/data - ./pg-demo-connection/init:/docker-entrypoint-initdb.d {%- endif %} pg-us: container_name: datalens-pg-us - image: postgres:13-alpine + image: postgres:16-alpine environment: POSTGRES_DB: us-db-ci_purgeable POSTGRES_USER: us @@ -76,7 +76,7 @@ services: {%- if env.get('DEV_MODE') %} - db-us:/var/lib/postgresql/data {%- else %} - - ./metadata:/var/lib/postgresql/data + - ${VOLUME_US:-./metadata}:/var/lib/postgresql/data {%- endif %} {%- if env.get('DEV_MODE') %} ports: diff --git a/templates/docker-compose.zitadel.j2 b/templates/docker-compose.zitadel.j2 index 96cfb18..c73a741 100644 --- a/templates/docker-compose.zitadel.j2 +++ b/templates/docker-compose.zitadel.j2 @@ -1,7 +1,7 @@ services: pg-compeng: container_name: datalens-pg-compeng - image: postgres:13-alpine + image: postgres:16-alpine environment: POSTGRES_PASSWORD: "postgres" POSTGRES_DB: postgres @@ -70,24 +70,24 @@ services: pg-demo-connection: container_name: datalens-pg-demo-connection - image: postgres:13-alpine + image: postgres:16-alpine environment: POSTGRES_DB: demo POSTGRES_USER: demo POSTGRES_PASSWORD: demo volumes: - ./pg-demo-connection/init:/docker-entrypoint-initdb.d - - ./pg-demo-connection/data:/var/lib/postgresql/data + - ${VOLUME_DEMO:-./pg-demo-connection/data}:/var/lib/postgresql/data pg-us: container_name: datalens-pg-us - image: postgres:13-alpine + image: postgres:16-alpine environment: POSTGRES_DB: us-db-ci_purgeable POSTGRES_USER: us POSTGRES_PASSWORD: us volumes: - - ./metadata:/var/lib/postgresql/data + - ${VOLUME_US:-./metadata}:/var/lib/postgresql/data {%- if env.get('DEV_MODE') %} ports: - "8086:5432" @@ -140,7 +140,7 @@ services: ports: - "8087:5432" volumes: - - ./zitadel-db:/var/lib/postgresql/data + - ${VOLUME_ZITADEL:-./zitadel-db}:/var/lib/postgresql/data zitadel: restart: 'always' @@ -214,3 +214,8 @@ services: ZITADEL_COOKIE_SECRET: ${ZITADEL_COOKIE_SECRET:?missed ZITADEL_COOKIE_SECRET env}" SERVICE_CLIENT_ID: "charts" SERVICE_CLIENT_SECRET: "${CHARTS_SERVICE_CLIENT_SECRET}" + +volumes: + db-us: + db-zitadel: + db-demo: