Skip to content

Commit 945200e

Browse files
authored
Merge pull request #352 from dedis/clean-up
Clean up
2 parents 30d8945 + 043b053 commit 945200e

File tree

7 files changed

+75
-99
lines changed

7 files changed

+75
-99
lines changed

.dockerignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.git
22
.github
33
Dockerfiles
4-
docker-compose*.yml
4+
docker-compose
5+
scripts
56
web/*/node_modules

Dockerfile

-25
This file was deleted.

README.docker.md

+49-28
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,54 @@
22

33
## Overview
44

5-
The relevant files are:
5+
The files related to the Docker environment can be found in
66

7-
* `docker-compose.yml`
8-
* `.env`
9-
* the Dockerfiles in ./Dockerfiles
7+
* `docker-compose/` (Docker Compose files)
8+
* `Dockerfiles/` (Dockerfiles)
9+
* `scripts/` (helper scripts)
1010

11-
You need to create a local .env file with the following content:
11+
You also need to either create a `.env` file in the project's root
12+
or point to another environment file using the `--env-file` flag
13+
when running `docker compose`.
14+
15+
The environment file needs to contain
1216

1317
```
14-
DELA_NODE_URL=http://172.19.44.254:80 # DELA node
15-
DATABASE_USERNAME=dvoting # choose any PostgreSQL username
16-
DATABASE_PASSWORD= # choose any PostgreSQL password
17-
DATABASE_HOST=db # PostgreSQL host *within the Docker network*
18-
DATABASE_PORT=5432 # PostgreSQL port
19-
DB_PATH=dvoting # LMDB database path
20-
FRONT_END_URL=http://localhost:3000 # frontend URL
21-
BACKEND_HOST=backend # backend host
22-
BACKEND_PORT=5000 # backend port
23-
SESSION_SECRET= # choose any secret
24-
PUBLIC_KEY= # pre-generated key pair
25-
PRIVATE_KEY= # pre-generated key pair
26-
PROXYPORT=8080 # port of DELA proxy
18+
DELA_NODE_URL=http://172.19.44.254:8080
19+
DATABASE_USERNAME=dvoting
20+
DATABASE_PASSWORD=XXX # choose any PostgreSQL password
21+
DATABASE_HOST=db
22+
DATABASE_PORT=5432
23+
DB_PATH=dvoting # LMDB database path
24+
FRONT_END_URL=http://127.0.0.1:3000
25+
BACKEND_HOST=backend
26+
BACKEND_PORT=5000
27+
SESSION_SECRET=XXX # choose any secret
28+
PUBLIC_KEY=XXX # public key of pre-generated key pair
29+
PRIVATE_KEY=XXX # private key of pre-generated key pair
30+
PROXYPORT=8080
2731
```
2832

29-
You can then run
33+
To run the currently released version, go to `docker-compose/` and
34+
run
3035

3136
```
3237
docker compose up
3338
```
3439

35-
to build the images and build and run the containers.
40+
this will pull the images from the GitHub container registry.
41+
42+
If you instead run
43+
44+
```
45+
export COMPOSE_FILE=docker-compose.debug.yml
46+
docker compose up
47+
```
48+
49+
the images will be build locally and you can debug your developments.
50+
51+
/!\ Any subsequent `docker compose` commands must be run with `COMPOSE_FILE` being
52+
set to the Docker Compose file that defines the current environment.
3653

3754
Use
3855

@@ -46,20 +63,24 @@ to shut off, and
4663
docker compose down -v
4764
```
4865

49-
to delete the volumes (this will reset your instance).
66+
to delete the volumes and reset your instance.
5067

5168
## Post-install commands
5269

53-
1. `./init_dela.sh`
54-
2. run `docker compose exec backend npx cli addAdmin --sciper 123455` with your SCIPER to add yourself as admin
55-
3. run `docker compose down && docker compose up -d` to restart the containers and load the new permissions
70+
To set up the DELA network, go to `scripts/` and run
71+
72+
```
73+
./init_dela.sh
74+
```
5675

57-
## Go debugging environment
76+
/!\ This script uses `docker compose` as well, so make sure that `COMPOSE_FILE` is
77+
set to the right value.
5878

59-
To use the Go debugging environment, set the environment variable
79+
To set up the permissions, run
6080

6181
```
62-
COMPOSE_FILE=docker-compose.debug.yml
82+
docker compose exec backend npx cli addAdmin --sciper XXX
83+
docker compose down && docker compose up -d
6384
```
6485

65-
to use this environment in all `docker compose` invocations.
86+
to add yourself as admin and clear the cached permissions.

docker-compose.debug.yml docker-compose/docker-compose.debug.yml

+17-10
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ services:
33
dela-worker-0: # inital DELA leader node
44
image: dela:latest
55
build:
6-
dockerfile: ./Dockerfiles/Dockerfile.dela.debug
6+
dockerfile: Dockerfiles/Dockerfile.dela.debug
7+
context: ../
78
environment:
89
PROXYKEY: ${PUBLIC_KEY}
910
PROXYPORT: ${PROXYPORT}
@@ -23,7 +24,8 @@ services:
2324
dela-worker-1: # DELA worker node
2425
image: dela:latest
2526
build:
26-
dockerfile: ./Dockerfiles/Dockerfile.dela.debug
27+
dockerfile: Dockerfiles/Dockerfile.dela.debug
28+
context: ../
2729
environment:
2830
PROXYKEY: ${PUBLIC_KEY}
2931
PROXYPORT: ${PROXYPORT}
@@ -43,7 +45,8 @@ services:
4345
dela-worker-2: # DELA worker node
4446
image: dela:latest
4547
build:
46-
dockerfile: ./Dockerfiles/Dockerfile.dela.debug
48+
dockerfile: Dockerfiles/Dockerfile.dela.debug
49+
context: ../
4750
environment:
4851
PROXYKEY: ${PUBLIC_KEY}
4952
PROXYPORT: ${PROXYPORT}
@@ -63,7 +66,8 @@ services:
6366
dela-worker-3: # DELA worker node
6467
image: dela:latest
6568
build:
66-
dockerfile: ./Dockerfiles/Dockerfile.dela.debug
69+
dockerfile: Dockerfiles/Dockerfile.dela.debug
70+
context: ../
6771
environment:
6872
PROXYKEY: ${PUBLIC_KEY}
6973
PROXYPORT: ${PROXYPORT}
@@ -83,7 +87,8 @@ services:
8387
dela-worker-4: # DELA worker node
8488
image: dela:latest
8589
build:
86-
dockerfile: ./Dockerfiles/Dockerfile.dela.debug
90+
dockerfile: Dockerfiles/Dockerfile.dela.debug
91+
context: ../
8792
environment:
8893
PROXYKEY: ${PUBLIC_KEY}
8994
PROXYPORT: ${PROXYPORT}
@@ -104,11 +109,12 @@ services:
104109
frontend: # web service frontend
105110
image: frontend:latest
106111
build:
107-
dockerfile: ./Dockerfiles/Dockerfile.frontend
112+
dockerfile: Dockerfiles/Dockerfile.frontend
113+
context: ../
108114
ports:
109115
- 127.0.0.1:3000:3000
110116
volumes:
111-
- ./web/frontend/src:/web/frontend/src
117+
- ../web/frontend/src:/web/frontend/src
112118
environment:
113119
BACKEND_HOST: ${BACKEND_HOST}
114120
BACKEND_PORT: ${BACKEND_PORT}
@@ -119,7 +125,8 @@ services:
119125
backend: # web service backend
120126
image: backend:latest
121127
build:
122-
dockerfile: ./Dockerfiles/Dockerfile.backend
128+
dockerfile: Dockerfiles/Dockerfile.backend
129+
context: ../
123130
environment:
124131
DATABASE_USERNAME: ${DATABASE_USERNAME}
125132
DATABASE_PASSWORD: ${DATABASE_PASSWORD}
@@ -139,7 +146,7 @@ services:
139146
condition: service_started
140147
volumes:
141148
- backend-data:/data
142-
- ./web/backend/src:/web/backend/src
149+
- ../web/backend/src:/web/backend/src
143150
networks:
144151
d-voting:
145152
ipv4_address: 172.19.44.3
@@ -151,7 +158,7 @@ services:
151158
POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
152159
volumes:
153160
- postgres-data:/var/lib/postgresql/data
154-
- ./web/backend/src/migration.sql:/docker-entrypoint-initdb.d/init.sql
161+
- ../web/backend/src/migration.sql:/docker-entrypoint-initdb.d/init.sql
155162
networks:
156163
d-voting:
157164
ipv4_address: 172.19.44.4

docker-compose.yml docker-compose/docker-compose.yml

+7-21
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
services:
22

33
dela-worker-0: # inital DELA leader node
4-
image: dela:latest
5-
build:
6-
dockerfile: ./Dockerfiles/Dockerfile.dela
4+
image: ghcr.io/c4dt/d-voting-dela:latest
75
environment:
86
PROXYKEY: ${PUBLIC_KEY}
97
PROXYPORT: ${PROXYPORT}
@@ -15,9 +13,7 @@ services:
1513
d-voting:
1614
ipv4_address: 172.19.44.254
1715
dela-worker-1: # DELA worker node
18-
image: dela:latest
19-
build:
20-
dockerfile: ./Dockerfiles/Dockerfile.dela
16+
image: ghcr.io/c4dt/d-voting-dela:latest
2117
environment:
2218
PROXYKEY: ${PUBLIC_KEY}
2319
PROXYPORT: ${PROXYPORT}
@@ -29,9 +25,7 @@ services:
2925
d-voting:
3026
ipv4_address: 172.19.44.253
3127
dela-worker-2: # DELA worker node
32-
image: dela:latest
33-
build:
34-
dockerfile: ./Dockerfiles/Dockerfile.dela
28+
image: ghcr.io/c4dt/d-voting-dela:latest
3529
environment:
3630
PROXYKEY: ${PUBLIC_KEY}
3731
PROXYPORT: ${PROXYPORT}
@@ -43,9 +37,7 @@ services:
4337
d-voting:
4438
ipv4_address: 172.19.44.252
4539
dela-worker-3: # DELA worker node
46-
image: dela:latest
47-
build:
48-
dockerfile: ./Dockerfiles/Dockerfile.dela
40+
image: ghcr.io/c4dt/d-voting-dela:latest
4941
environment:
5042
PROXYKEY: ${PUBLIC_KEY}
5143
PROXYPORT: ${PROXYPORT}
@@ -57,9 +49,7 @@ services:
5749
d-voting:
5850
ipv4_address: 172.19.44.251
5951
dela-worker-4: # DELA worker node
60-
image: dela:latest
61-
build:
62-
dockerfile: ./Dockerfiles/Dockerfile.dela
52+
image: ghcr.io/c4dt/d-voting-dela:latest
6353
environment:
6454
PROXYKEY: ${PUBLIC_KEY}
6555
PROXYPORT: ${PROXYPORT}
@@ -72,9 +62,7 @@ services:
7262
ipv4_address: 172.19.44.250
7363

7464
frontend: # web service frontend
75-
image: frontend:latest
76-
build:
77-
dockerfile: ./Dockerfiles/Dockerfile.frontend
65+
image: ghcr.io/c4dt/d-voting-frontend:latest
7866
ports:
7967
- 127.0.0.1:3000:3000
8068
environment:
@@ -85,9 +73,7 @@ services:
8573
ipv4_address: 172.19.44.2
8674

8775
backend: # web service backend
88-
image: backend:latest
89-
build:
90-
dockerfile: ./Dockerfiles/Dockerfile.backend
76+
image: ghcr.io/c4dt/d-voting-backend:latest
9177
environment:
9278
DATABASE_USERNAME: ${DATABASE_USERNAME}
9379
DATABASE_PASSWORD: ${DATABASE_PASSWORD}

init_dela.sh scripts/init_dela.sh

File renamed without changes.

web/backend/src/docker-compose.yml

-14
This file was deleted.

0 commit comments

Comments
 (0)