Skip to content

Commit 7f91c05

Browse files
authored
Merge pull request #899 from csamuele/end-to-end-test-2.0
fixed environment variables for web service in docker compose and removed keycloak configuration step
2 parents cc04671 + 97510fe commit 7f91c05

File tree

2 files changed

+36
-12
lines changed

2 files changed

+36
-12
lines changed

docker-compose.yml

+36-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,37 @@
22
version: "3.9"
33
services:
44
web:
5-
build: .
5+
build: .
66
ports:
77
- "5000:5000"
88
networks:
99
- star-net
1010
environment:
11-
- DATABASE_URL=postgresql://postgres:ChangeMeOrDontTest2020@my-db:5432/postgres
11+
- REACT_APP_FEATURED_ELECTIONS=''
12+
- REACT_APP_MAX_BALLOT_RANKS=10
13+
- REACT_APP_DEFAULT_BALLOT_RANKS=6
14+
- REACT_APP_BACKEND_URL=http://localhost:5000
15+
- REACT_APP_KEYCLOAK_URL=http://localhost:8080/realms/Dev/protocol/openid-connect
16+
- DANGEROUSLY_DISABLE_HOST_CHECK=true
17+
- FRONTEND_PORT=5000
18+
- DATABASE_URL=postgresql://postgres:ChangeMeOrDontTest2020@my-db:5432/postgres
19+
- DEV_DATABASE=FALSE
20+
- KEYCLOAK_SECRET=DefaultKeycloakSecret
21+
- KEYCLOAK_URL=http://keycloak:8080/realms/Dev/protocol/openid-connect
22+
- CLASSIC_ELECTION_COUNT=0
23+
- CLASSIC_VOTE_COUNT=0
24+
- SENDGRID_API_KEY='SG.<insert api key>'
25+
- SENDGRID_GROUP_ID='<insert group id>'
26+
- EMAIL_TEST_MODE=if defined will prevent emails from being sent from email service while testing
27+
28+
depends_on:
29+
my-db:
30+
condition: service_started
31+
keycloak:
32+
#If we don't specify this condition, the web service will start before keycloak is ready to accept requests.
33+
condition: service_healthy
34+
restart: true
35+
1236
my-db:
1337
image: postgres
1438
ports:
@@ -29,9 +53,19 @@ services:
2953
- --import-realm
3054
ports:
3155
- '8080:8080'
56+
networks:
57+
- star-net
3258
environment:
3359
- KEYCLOAK_ADMIN=admin
3460
- KEYCLOAK_ADMIN_PASSWORD=admin
61+
- KC_HEALTH_ENABLED=true
62+
healthcheck:
63+
#keycloak doesn't do curl -f internally so we have to use a shell command to check the health of the service. Found at https://gist.github.com/sarath-soman/5d9aec06953bbd0990c648605d4dba07
64+
#Note that if we update to v25 we will need to update the port to 9000
65+
test: ["CMD-SHELL", "exec 3<>/dev/tcp/127.0.0.1/8080;echo -e \"GET /health/ready HTTP/1.1\r\nhost: http://localhost\r\nConnection: close\r\n\r\n\" >&3;grep \"HTTP/1.1 200 OK\" <&3"]
66+
interval: 15s
67+
retries: 5
68+
start_period: 60s
3569
restart:
3670
always
3771
networks:

docs/contributions/developers/1_local_setup.md

-10
Original file line numberDiff line numberDiff line change
@@ -289,16 +289,6 @@ migration "2024_01_27_Create_Date" was executed successfully
289289
migration "2024_01_29_pkeys_and_heads" was executed successfully
290290
```
291291

292-
#### Configuring Keycloak
293-
294-
We need to manually configure the keycloak realm so that it can interface with the service properly.
295-
296-
1. [Download the Keycloak configuration](https://drive.google.com/file/d/1_S-MpnsxSr8oeA6MrNd3VSOGyKe7Qca_/view?usp=sharing)
297-
1. Navigate to localhost:8080 , select Administration Console
298-
1. Login with user=admin, password=admin
299-
1. Select the master dropdown in the top-left, select "Create Realm"
300-
1. Browse to select the configuration you downloaded
301-
1. Click "Create"
302292

303293
**Verification Steps**
304294
It's tricky to verify at the moment, but once you have the backend running you should be able to register with a username and password via your frontend at localhost:3000.

0 commit comments

Comments
 (0)