Skip to content

Commit

Permalink
migrate pg main cluster
Browse files Browse the repository at this point in the history
* fix permissions
  • Loading branch information
k0gen committed Dec 4, 2023
1 parent 653c449 commit 3729cc8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ RUN pnpm run build

FROM nginx:bookworm

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends postgresql-15 && rm -rf /var/lib/apt/lists/*
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends postgresql-15 && rm -rf /var/lib/apt/lists/* && mv /var/lib/postgresql/15/main /var/lib/

# Copy binaries
COPY --from=rust-builder /build/vss-rs/target/release/vss-rs /app/vss-rs
Expand Down
8 changes: 5 additions & 3 deletions docker_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ RUST_LOG=debug

#Start and Configure PostgreSQL
echo 'Starting PostgreSQL database server for the first time...'
mkdir -p $POSTGRES_DATADIR $POSTGRES_CONFIG
mv /var/lib/main $POSTGRES_DATADIR
chown -R postgres:postgres $POSTGRES_DATADIR
chown -R postgres:postgres $POSTGRES_CONFIG
chmod -R 700 $POSTGRES_DATADIR
Expand All @@ -30,9 +32,9 @@ RUST_LOG=debug
echo 'Granting db permissions...'
su - postgres -c 'psql -c "grant all privileges on database '$POSTGRES_DB' to '$POSTGRES_USER';"'
echo 'Creating .pgpass file...'
su - postgres -c 'echo "localhost:5432:'$POSTGRES_USER':'$POSTGRES_PASSWORD'" >> .pgpass'
su - postgres -c "chmod -R 0600 .pgpass"
chmod -R 0600 /var/lib/postgresql/.pgpass
echo "localhost:5432:'$POSTGRES_USER':'$POSTGRES_PASSWORD'" > $POSTGRES_DATADIR/../.pgpass
chmod -R 0600 $POSTGRES_DATADIR/../.pgpass
chown postgres:postgres $POSTGRES_DATADIR/../.pgpass

/app/vss-rs &
/app/ln-websocket-proxy &
Expand Down

0 comments on commit 3729cc8

Please sign in to comment.