Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-restructure docker compose #5

Merged
merged 3 commits into from
Jun 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: '3.8'

services:
wagtail:
ports:
- 8000:80
depends_on:
- db
environment:
OV_DB_HOST: db
env_file:
- ov_wag/.env
volumes:
- ./ov_wag:/app
front:
volumes:
- ./ov-frontend:/var/app
ports:
- 3000:3000
db:
env_file:
- ov_wag/.db
volumes:
- ./ov_wag/db:/var/lib/postgresql/data
wagtail-tests:
volumes:
- ./ov_wag:/app
25 changes: 25 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: '3.8'

services:
wagtail:
image: ov
build:
context: ./ov_wag
target: production

wagtail-tests:
image: ov-tests
build:
context: ./ov_wag
target: base

front:
image: ov-front
build:
context: ./ov-frontend
target: production
environment:
OV_API_URL: http://wagtail

db:
image: postgres:14.2-alpine
14 changes: 0 additions & 14 deletions front.yml

This file was deleted.

19 changes: 9 additions & 10 deletions ov
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,26 @@ COMMANDS:\n\n
OV_UID=$(id -u)
OV_GID=$(id -g)

COMPOSE="docker compose -f ov_wag/docker-compose.yml"
DEV="-f ov_wag/dev.yml"
FRONTEND="-f front.yml"
COMPOSE="docker compose -f docker-compose.yml -f ov_wag/docker-compose.yml"
DEPLOY="-f deploy.yml"
MANAGE="run wagtail python3 manage.py"

if [ -z $1 ]; then
echo -e $HELP

elif [ $1 = "build" -o $1 = "b" ]; then
shift
$COMPOSE $DEV $FRONTEND build "$@"
docker compose build "$@"

elif [ $1 = "cmd" -o $1 = "c" ]; then
shift
# docker run -it -v $(pwd)/:/app/ ov "$@"
$COMPOSE $DEV "$@"
$COMPOSE $DEPLOY "$@"

elif [ $1 = "dev" -o $1 = "d" ]; then
shift
# docker run -itp 8000:8000 -v $(pwd)/:/app/ ov "$@"
$COMPOSE $DEV $FRONTEND up
$COMPOSE $DEPLOY up

elif [ $1 = "init" -o $1 = "i" ]; then
shift
Expand All @@ -57,22 +56,22 @@ elif [ $1 = "init" -o $1 = "i" ]; then
elif [ $1 = "manage" -o $1 = "m" ]; then
shift
# docker run -it -v $(pwd)/:/app/ ov python3 manage.py "$@"
$COMPOSE $DEV $MANAGE "$@"
$COMPOSE $DEPLOY $MANAGE "$@"

elif [ $1 = "shell" -o $1 = "s" ]; then
shift
# docker run -it -v $(pwd)/:/app/ ov python3 manage.py shell "$@"
$COMPOSE $DEV $MANAGE shell "$@"
$COMPOSE $DEPLOY $MANAGE shell "$@"

elif [ $1 = "dump" -o $1 = "backup" ]; then
shift
TIMESTAMP=`date +%Y-%m-%d_%H-%M-%S`
$COMPOSE $DEV exec -it db pg_dump -Fc -U postgres postgres > db_$TIMESTAMP.sql
$COMPOSE $DEPLOY exec -it db pg_dump -Fc -U postgres postgres > db_$TIMESTAMP.sql

elif [ $1 = "load" -o $1 = "restore" ]; then
shift
# Restore a database from a dump file $1
$COMPOSE $DEV exec -iT db pg_restore --verbose --clean --no-acl --no-owner -U postgres -d postgres < $1
$COMPOSE $DEPLOY exec -iT db pg_restore --verbose --clean --no-acl --no-owner -U postgres -d postgres < $1

else echo -e $HELP

Expand Down
2 changes: 1 addition & 1 deletion ov_wag