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

feat: minor improvements in the Docker environment #317

Merged
merged 2 commits into from
Aug 31, 2023
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
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.git
.github
Dockerfiles
docker-compose*.yml
web/*/node_modules
15 changes: 7 additions & 8 deletions README.docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The relevant files are:
You need to create a local .env file with the following content:

```
DELA_NODE_URL=http://127.0.0.1:80 # reverse proxy within backend container
DELA_NODE_URL=http://172.19.44.254:80 # DELA node
DATABASE_USERNAME=dvoting # choose any PostgreSQL username
DATABASE_PASSWORD= # choose any PostgreSQL password
DATABASE_HOST=db # PostgreSQL host *within the Docker network*
Expand All @@ -23,7 +23,7 @@ BACKEND_PORT=5000 # backend port
SESSION_SECRET= # choose any secret
PUBLIC_KEY= # pre-generated key pair
PRIVATE_KEY= # pre-generated key pair
PROXYPORT=8080 # port of Dela proxy (must be one in DELA_PROXY_PORT_RANGE)
PROXYPORT=8080 # port of DELA proxy
```

You can then run
Expand Down Expand Up @@ -51,16 +51,15 @@ to delete the volumes (this will reset your instance).
## Post-install commands

1. `./init_dela.sh`
2. `docker compose exec backend /bin/bash`
3. execute `npx cli addAdmin --sciper 123455` with your SCIPER to add yourself as admin
5. exit the container and run `docker compose down && docker compose up -d`
2. run `docker compose exec backend npx cli addAdmin --sciper 123455` with your SCIPER to add yourself as admin
3. run `docker compose down && docker compose up -d` to restart the containers and load the new permissions

## Go debugging environment

To use the Go debugging environment, pass the
To use the Go debugging environment, set the environment variable

```
--file docker-compose.debug.yml
COMPOSE_FILE=docker-compose.debug.yml
```

flag to all `docker compose` invocations.
to use this environment in all `docker compose` invocations.
26 changes: 13 additions & 13 deletions docker-compose.debug.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:

dela-worker-0: # inital DELA leader node
image: dela
image: dela:latest
build:
dockerfile: ./Dockerfiles/Dockerfile.dela.debug
environment:
Expand All @@ -19,9 +19,9 @@ services:
- SYS_PTRACE
networks:
d-voting:
ipv4_address: 172.19.0.255
ipv4_address: 172.19.44.254
dela-worker-1: # DELA worker node
image: dela
image: dela:latest
build:
dockerfile: ./Dockerfiles/Dockerfile.dela.debug
environment:
Expand All @@ -39,9 +39,9 @@ services:
- SYS_PTRACE
networks:
d-voting:
ipv4_address: 172.19.0.254
ipv4_address: 172.19.44.253
dela-worker-2: # DELA worker node
image: dela
image: dela:latest
build:
dockerfile: ./Dockerfiles/Dockerfile.dela.debug
environment:
Expand All @@ -59,10 +59,10 @@ services:
- SYS_PTRACE
networks:
d-voting:
ipv4_address: 172.19.0.253
ipv4_address: 172.19.44.252

frontend: # web service frontend
image: frontend
image: frontend:latest
build:
dockerfile: ./Dockerfiles/Dockerfile.frontend
ports:
Expand All @@ -74,10 +74,10 @@ services:
BACKEND_PORT: ${BACKEND_PORT}
networks:
d-voting:
ipv4_address: 172.19.0.2
ipv4_address: 172.19.44.2

backend: # web service backend
image: backend
image: backend:latest
build:
dockerfile: ./Dockerfiles/Dockerfile.backend
environment:
Expand All @@ -102,7 +102,7 @@ services:
- ./web/backend/src:/web/backend/src
networks:
d-voting:
ipv4_address: 172.19.0.3
ipv4_address: 172.19.44.3

db: # PostgreSQL database
image: postgres:15
Expand All @@ -114,7 +114,7 @@ services:
- ./web/backend/src/migration.sql:/docker-entrypoint-initdb.d/init.sql
networks:
d-voting:
ipv4_address: 172.19.0.4
ipv4_address: 172.19.44.4

volumes:
postgres-data: # PostgreSQL database
Expand All @@ -127,5 +127,5 @@ networks:
d-voting:
ipam:
config:
- subnet: 172.19.0.0/16
gateway: 172.19.0.1
- subnet: 172.19.44.0/24
gateway: 172.19.44.1
26 changes: 13 additions & 13 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:

dela-worker-0: # inital DELA leader node
image: dela
image: dela:latest
build:
dockerfile: ./Dockerfiles/Dockerfile.dela
environment:
Expand All @@ -13,9 +13,9 @@ services:
hostname: dela-worker-0
networks:
d-voting:
ipv4_address: 172.19.0.255
ipv4_address: 172.19.44.254
dela-worker-1: # DELA worker node
image: dela
image: dela:latest
build:
dockerfile: ./Dockerfiles/Dockerfile.dela
environment:
Expand All @@ -27,9 +27,9 @@ services:
hostname: dela-worker-1
networks:
d-voting:
ipv4_address: 172.19.0.254
ipv4_address: 172.19.44.253
dela-worker-2: # DELA worker node
image: dela
image: dela:latest
build:
dockerfile: ./Dockerfiles/Dockerfile.dela
environment:
Expand All @@ -41,10 +41,10 @@ services:
hostname: dela-worker-2
networks:
d-voting:
ipv4_address: 172.19.0.253
ipv4_address: 172.19.44.252

frontend: # web service frontend
image: frontend
image: frontend:latest
build:
dockerfile: ./Dockerfiles/Dockerfile.frontend
ports:
Expand All @@ -54,10 +54,10 @@ services:
BACKEND_PORT: ${BACKEND_PORT}
networks:
d-voting:
ipv4_address: 172.19.0.2
ipv4_address: 172.19.44.2

backend: # web service backend
image: backend
image: backend:latest
build:
dockerfile: ./Dockerfiles/Dockerfile.backend
environment:
Expand All @@ -80,7 +80,7 @@ services:
- backend-data:/data
networks:
d-voting:
ipv4_address: 172.19.0.3
ipv4_address: 172.19.44.3

db: # PostgreSQL database
image: postgres:15
Expand All @@ -92,7 +92,7 @@ services:
- ./web/backend/src/migration.sql:/docker-entrypoint-initdb.d/init.sql
networks:
d-voting:
ipv4_address: 172.19.0.4
ipv4_address: 172.19.44.4

volumes:
postgres-data: # PostgreSQL database
Expand All @@ -105,5 +105,5 @@ networks:
d-voting:
ipam:
config:
- subnet: 172.19.0.0/16
gateway: 172.19.0.1
- subnet: 172.19.44.0/24
gateway: 172.19.44.1