fix: update Liquibase volume paths to use relative paths

This commit is contained in:
Felix Zett 2025-10-18 21:49:24 +02:00
parent 14fd9e1f3a
commit 952e0c4b2c
6 changed files with 47 additions and 21 deletions

View file

@ -6,9 +6,9 @@ COPY . .
FROM base AS prod
EXPOSE 8000
COPY backend/entrypoint.py /app/backend/entrypoint.py
RUN chmod +x /app/backend/entrypoint.py
ENTRYPOINT ["python", "/app/backend/entrypoint.py"]
COPY entrypoint.py entrypoint.py
RUN chmod +x entrypoint.py
ENTRYPOINT ["python", "entrypoint.py"]
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "-k", "uvicorn.workers.UvicornWorker", "backend.main:app"]
FROM base AS dev

View file

@ -0,0 +1,26 @@
databaseChangeLog:
- changeSet:
id: 0002-add-category-to-tag
author: felix
preConditions:
onFail: MARK_RAN
onError: MARK_RAN
preConditions:
- not:
- columnExists:
tableName: tag
columnName: category
changes:
- addColumn:
tableName: tag
columns:
- column:
name: category
type: boolean
defaultValueBoolean: false
constraints:
nullable: false
rollback:
- dropColumn:
columnName: category
tableName: tag

View file

@ -10,4 +10,6 @@ databaseChangeLog:
name: id
type: uuid
constraints:
primaryKey: true
primaryKey: true
- include:
file: db.changelog-0002-add-category-to-tag.yaml

Binary file not shown.

View file

@ -5,7 +5,7 @@ from sqlalchemy import text
from database import engine # see backend/database.py
CHECK_INTERVAL = int(os.environ.get("LIQUIBASE_WAIT_INTERVAL", "1"))
TIMEOUT = int(os.environ.get("LIQUIBASE_WAIT_TIMEOUT", "120"))
TIMEOUT = int(os.environ.get("LIQUIBASE_WAIT_TIMEOUT", "10"))
def wait_for_liquibase(timeout=TIMEOUT):
deadline = time.time() + timeout
@ -27,13 +27,7 @@ if __name__ == "__main__":
if not ok:
print(f"Timeout waiting for Liquibase after {TIMEOUT}s, continuing anyway", file=sys.stderr)
# If the Docker CMD provides a command, exec that; otherwise exec default gunicorn
if len(sys.argv) > 1:
cmd = sys.argv[1:]
print("Executing CMD from Docker:", cmd)
os.execvp(cmd[0], cmd)
else:
os.execvp(
"gunicorn",
["gunicorn", "--bind", "0.0.0.0:8000", "-k", "uvicorn.workers.UvicornWorker", "backend.main:app"]
)
os.execvp(
"gunicorn",
["gunicorn", "--bind", "0.0.0.0:8000", "-k", "uvicorn.workers.UvicornWorker", "main:app"]
)

View file

@ -28,6 +28,7 @@ services:
- "8000"
environment:
- PYTHONUNBUFFERED=1
- LIQUIBASE_WAIT_TIMEOUT=60 # increase timeout to 60s
networks:
- nginx-proxy
packlist-liquibase:
@ -35,12 +36,15 @@ services:
depends_on:
- packlist-db
volumes:
- ./backend/db/changelog:/liquibase/changelog
environment:
- LIQUIBASE_URL=jdbc:postgresql://packlist-db:5432/postgres
- LIQUIBASE_USERNAME=postgres
- LIQUIBASE_PASSWORD=postgres
command: --changeLogFile=/liquibase/changelog/db.changelog-master.yaml update
- ./backend/db/changelog:/liquibase/changelog:ro
- ./backend/db/lib:/liquibase/lib:ro
command: >
--log-level=debug
--changeLogFile=db.changelog-master.yaml
--url=jdbc:postgresql://packlist-db:5432/postgres
--username=postgres
--password=postgres
update
restart: "no"
networks:
- nginx-proxy