From 4bf44b32756585666cd1a0e4d062743022ec2aa3 Mon Sep 17 00:00:00 2001 From: apk Date: Thu, 1 Aug 2024 22:05:36 +0300 Subject: [PATCH] fix(docker-compose): issue with volumes, issue with database connection --- apps/dokploy/templates/teable/docker-compose.yml | 14 +++++++++----- apps/dokploy/templates/teable/index.ts | 5 +++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/apps/dokploy/templates/teable/docker-compose.yml b/apps/dokploy/templates/teable/docker-compose.yml index 62de19a11..9be0b4d32 100644 --- a/apps/dokploy/templates/teable/docker-compose.yml +++ b/apps/dokploy/templates/teable/docker-compose.yml @@ -1,4 +1,4 @@ -version: '3.9' +version: "3.9" services: teable: @@ -7,7 +7,7 @@ services: ports: - ${TEABLE_PORT} volumes: - - teable-data:/app/.assets:rw + - teable-data:/app/.assets # you may use a bind-mounted host directory instead, # so that it is harder to accidentally remove the volume and lose all your data! # - ./docker/teable/data:/app/.assets:rw @@ -39,9 +39,9 @@ services: image: postgres:15.4 restart: always ports: - - '42345:5432' + - "${TEABLE_DB_PORT}:${POSTGRES_PORT}" volumes: - - teable-db:/var/lib/postgresql/data:rw + - teable-db:/var/lib/postgresql/data # you may use a bind-mounted host directory instead, # so that it is harder to accidentally remove the volume and lose all your data! # - ./docker/db/data:/var/lib/postgresql/data:rw @@ -54,7 +54,11 @@ services: - dokploy-network - teable-standalone healthcheck: - test: ['CMD-SHELL', "sh -c 'pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}'"] + test: + [ + "CMD-SHELL", + "sh -c 'pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}'", + ] interval: 10s timeout: 3s retries: 3 diff --git a/apps/dokploy/templates/teable/index.ts b/apps/dokploy/templates/teable/index.ts index 598a34df4..3eb3ca603 100644 --- a/apps/dokploy/templates/teable/index.ts +++ b/apps/dokploy/templates/teable/index.ts @@ -13,6 +13,7 @@ export function generate(schema: Schema): Template { const envs = [ `TEABLE_HOST=${randomDomain}`, "TEABLE_PORT=3000", + "TEABLE_DB_PORT=42345", `HASH=${mainServiceHash}`, "TIMEZONE=UTC", "# Postgres", @@ -22,9 +23,9 @@ export function generate(schema: Schema): Template { "POSTGRES_USER=teable", `POSTGRES_PASSWORD=${password}`, "# App", - "PUBLIC_ORIGIN=https://${TAEBLE_HOST}", + "PUBLIC_ORIGIN=https://${TEABLE_HOST}", "PRISMA_DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}", - "PUBLIC_DATABASE_PROXY=127.0.0.1:42345", + "PUBLIC_DATABASE_PROXY=${TEABLE_HOST}:${TEABLE_DB_PORT}", "# Need to support sending emails to enable the following configurations", "# You need to modify the configuration according to the actual situation, otherwise it will not be able to send emails correctly.", "#BACKEND_MAIL_HOST=smtp.teable.io",