diff --git a/backend/Dockerfile b/backend/Dockerfile index 457fccf..cd1c390 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -2,7 +2,7 @@ FROM golang:latest AS build WORKDIR /build COPY . /build RUN bash build.sh -FROM scratch AS run +FROM busybox:stable AS run WORKDIR /app COPY --from=build /build/backends.prod.json /app/backends.json COPY --from=build /build/api/api /app/hermes diff --git a/backend/api/backup.go b/backend/api/backup.go index 37e9ffa..5e19c60 100644 --- a/backend/api/backup.go +++ b/backend/api/backup.go @@ -2,6 +2,7 @@ package main import ( "compress/gzip" + "encoding/base64" "encoding/json" "fmt" "io" @@ -249,7 +250,7 @@ func backupRestoreEntrypoint(cCtx *cli.Context) error { Name: backend.Name, Description: backend.Description, Backend: backend.Backend, - BackendParameters: backend.BackendParameters, + BackendParameters: base64.StdEncoding.EncodeToString([]byte(backend.BackendParameters)), } if err := dbcore.DB.Create(backendDatabase).Error; err != nil { diff --git a/docker-compose.yml b/docker-compose.yml index 565e8f8..7ac3334 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,8 +3,10 @@ services: image: ghcr.io/imterah/hermes:latest container_name: hermes-api restart: always - env_file: - - .env + environment: + DATABASE_URL: postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@nextnet-postgres:5432/${POSTGRES_DB}?schema=nextnet + HERMES_POSTGRES_DSN: postgres://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@nextnet-postgres:5432/${POSTGRES_DB} + HERMES_DATABASE_BACKEND: postgresql depends_on: - db ports: diff --git a/migration-entrypoint.sh b/migration-entrypoint.sh index 1904e2b..c1eb766 100755 --- a/migration-entrypoint.sh +++ b/migration-entrypoint.sh @@ -29,7 +29,7 @@ CREATE DATABASE $HERMES_MIGRATE_POSTGRES_DATABASE; \c nextnet DROP DATABASE temp; EOF -psql "$HERMES_POSTGRES_DATABASE" < /tmp/wipe.sql +psql "$HERMES_POSTGRES_DSN" < /tmp/wipe.sql rm -rf /tmp/wipe.sql echo "Restoring backup..."