Skip to content

Commit 76b2261

Browse files
committed
chore(docker): add postgresql service properly
1 parent c2d3129 commit 76b2261

File tree

8 files changed

+34
-34
lines changed

8 files changed

+34
-34
lines changed

.env.tpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ ANSIBLE_VAULT_KEY=${ANSIBLE_VAULT_KEY}
22
ENV=${ENV}
33
FLOWER_PORT=${FLOWER_PORT}
44
FLOWER_PASSWORD=${FLOWER_PASSWORD}
5+
HOST_POSTGRES_DUMP=${HOST_POSTGRES_DUMP}
56
MAPBOX_API_KEY=${MAPBOX_API_KEY}
67
POSTGRES_HOST=${POSTGRES_HOST}
78
POSTGRES_PORT=${POSTGRES_PORT}

.github/workflows/main.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ env:
1010
ENV: dev
1111
FLOWER_PORT: 28888
1212
FLOWER_PASSWORD: flowerpass
13+
HOST_POSTGRES_DUMP: /tmp/dump
1314
POSTGRES_HOST: epigraphhub-db
1415
POSTGRES_PORT: 25432
1516
POSTGRES_USER: dev_epigraph

Makefile

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ CRON:=
88
DOCKER=docker-compose \
99
--env-file .env \
1010
--project-name eph-$(ENV) \
11-
--file docker/compose-base.yaml \
12-
--file docker/compose-$(ENV).yaml
11+
--file docker/compose.yaml
1312

1413
# DOCKER
1514

@@ -22,14 +21,19 @@ docker-build:
2221

2322
.PHONY:docker-start
2423
docker-start:
25-
$(DOCKER) up -d ${SERVICES}
24+
$(DOCKER) up --remove-orphans -d ${SERVICES}
2625

2726

2827
.PHONY:docker-stop
2928
docker-stop:
3029
$(DOCKER) stop ${SERVICES}
3130

3231

32+
.PHONY:docker-down
33+
docker-down:
34+
$(DOCKER) down --volumes
35+
36+
3337
.PHONY:docker-restart
3438
docker-restart: docker-stop docker-start
3539
echo "[II] Docker services restarted!"
@@ -38,6 +42,10 @@ docker-restart: docker-stop docker-start
3842
docker-logs-follow:
3943
$(DOCKER) logs --follow --tail 300 ${SERVICES}
4044

45+
.PHONY:docker-logs-follow
46+
docker-logs-follow:
47+
$(DOCKER) logs --follow --tail 100 ${SERVICES}
48+
4149
.PHONY:docker-logs
4250
docker-logs:
4351
$(DOCKER) logs --tail 300 ${SERVICES}

docker/compose-dev.yaml

Lines changed: 0 additions & 24 deletions
This file was deleted.

docker/compose-prod.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ services:
4141
ports:
4242
- ${SUPERSET_PORT}:8088
4343
depends_on:
44+
- epigraphhub-db
4445
- epigraphhub-redis
4546
- epigraphhub-celery
4647
- epigraphhub-celery-beat
@@ -167,3 +168,4 @@ services:
167168

168169
volumes:
169170
redis:
171+
pgdata:

docker/postgresql/dump.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
3+
PROJECT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd ../.. && pwd )"
4+
5+
if [ -f ${PROJECT_DIR}/.env ]; then
6+
# Load Environment Variables
7+
export $(cat ${PROJECT_DIR}/.env | grep -v '#' | sed 's/\r$//' | awk '/=/ {print $1}' )
8+
fi
9+
10+
HOST_POSTGRES_DUMP=${HOST_POSTGRES_DUMP:-/tmp/dump}
11+
mkdir -p ${HOST_POSTGRES_DUMP}
12+
13+
set -ex
14+
15+
PGPASSWORD=${POSTGRES_PASSWORD} pg_dumpall \
16+
--host ${POSTGRES_HOST} \
17+
--port ${POSTGRES_PORT} \
18+
--user ${POSTGRES_USER} \
19+
> ${HOST_POSTGRES_DUMP}/$(date --iso-8601).dump

docker/postgresql/restore.sh

Whitespace-only changes.

0 commit comments

Comments
 (0)