feature: Fixes all backup and API related things to make everything work in production.
All checks were successful
Release code / build (push) Successful in 14m13s
All checks were successful
Release code / build (push) Successful in 14m13s
This commit is contained in:
parent
c2eb2d15aa
commit
d334878599
4 changed files with 8 additions and 5 deletions
|
@ -2,7 +2,7 @@ FROM golang:latest AS build
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
COPY . /build
|
COPY . /build
|
||||||
RUN bash build.sh
|
RUN bash build.sh
|
||||||
FROM scratch AS run
|
FROM busybox:stable AS run
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=build /build/backends.prod.json /app/backends.json
|
COPY --from=build /build/backends.prod.json /app/backends.json
|
||||||
COPY --from=build /build/api/api /app/hermes
|
COPY --from=build /build/api/api /app/hermes
|
||||||
|
|
|
@ -2,6 +2,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
@ -249,7 +250,7 @@ func backupRestoreEntrypoint(cCtx *cli.Context) error {
|
||||||
Name: backend.Name,
|
Name: backend.Name,
|
||||||
Description: backend.Description,
|
Description: backend.Description,
|
||||||
Backend: backend.Backend,
|
Backend: backend.Backend,
|
||||||
BackendParameters: backend.BackendParameters,
|
BackendParameters: base64.StdEncoding.EncodeToString([]byte(backend.BackendParameters)),
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := dbcore.DB.Create(backendDatabase).Error; err != nil {
|
if err := dbcore.DB.Create(backendDatabase).Error; err != nil {
|
||||||
|
|
|
@ -3,8 +3,10 @@ services:
|
||||||
image: ghcr.io/imterah/hermes:latest
|
image: ghcr.io/imterah/hermes:latest
|
||||||
container_name: hermes-api
|
container_name: hermes-api
|
||||||
restart: always
|
restart: always
|
||||||
env_file:
|
environment:
|
||||||
- .env
|
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:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
ports:
|
ports:
|
||||||
|
|
|
@ -29,7 +29,7 @@ CREATE DATABASE $HERMES_MIGRATE_POSTGRES_DATABASE;
|
||||||
\c nextnet
|
\c nextnet
|
||||||
DROP DATABASE temp;
|
DROP DATABASE temp;
|
||||||
EOF
|
EOF
|
||||||
psql "$HERMES_POSTGRES_DATABASE" < /tmp/wipe.sql
|
psql "$HERMES_POSTGRES_DSN" < /tmp/wipe.sql
|
||||||
rm -rf /tmp/wipe.sql
|
rm -rf /tmp/wipe.sql
|
||||||
echo "Restoring backup..."
|
echo "Restoring backup..."
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue