Compare commits
1 commit
doxa-maps-
...
feat/postg
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb3d3ddec1 |
4 changed files with 14095 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -17,6 +17,7 @@ logs
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.fleet
|
.fleet
|
||||||
.idea
|
.idea
|
||||||
|
*.dump
|
||||||
|
|
||||||
# Local env files
|
# Local env files
|
||||||
.env
|
.env
|
||||||
|
|
|
||||||
21
docker-compose.yml
Normal file
21
docker-compose.yml
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres:18.3-alpine
|
||||||
|
container_name: doxa-life-postgres
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
POSTGRES_PASSWORD: postgres
|
||||||
|
POSTGRES_DB: doxalife
|
||||||
|
ports:
|
||||||
|
- "127.0.0.1:5432:5432"
|
||||||
|
volumes:
|
||||||
|
- pgdata:/var/lib/postgresql
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U postgres -d doxalife"]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 3s
|
||||||
|
retries: 10
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
pgdata:
|
||||||
14049
package-lock.json
generated
Normal file
14049
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
24
refreshDB.sh
Executable file
24
refreshDB.sh
Executable file
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/usr/bin/bash
|
||||||
|
|
||||||
|
echo "Enter live url now: "
|
||||||
|
read -rs LIVE_URL # paste when prompted
|
||||||
|
|
||||||
|
echo "Dumping live DB"
|
||||||
|
docker run --rm -v "$PWD:/backup" postgres:18.3-alpine \
|
||||||
|
pg_dump "$LIVE_URL" \
|
||||||
|
--format=custom \
|
||||||
|
--no-owner \
|
||||||
|
--no-privileges \
|
||||||
|
--file=/backup/live.dump
|
||||||
|
|
||||||
|
echo "Waiting for container to be ready"
|
||||||
|
docker compose up -d
|
||||||
|
# wait for healthcheck
|
||||||
|
until docker compose exec -T postgres pg_isready -U postgres -d doxalife; do sleep 1; done
|
||||||
|
|
||||||
|
echo "Copying database into postgres"
|
||||||
|
docker compose cp live.dump postgres:/tmp/live.dump
|
||||||
|
docker compose exec -T postgres pg_restore \
|
||||||
|
-U postgres -d doxalife \
|
||||||
|
--clean --if-exists --no-owner --no-privileges \
|
||||||
|
/tmp/live.dump
|
||||||
Loading…
Reference in a new issue