The CONFIG
environment variable points to a configuration file.
{
/* The requestor defined in irmaserver.json in the IRMA server */
"requestorname": "openstad_voting_pk",
/* Every poll must have it's unique uuid, use a generator to create one */
"uuid": "06c5a013-4e71-439a-b8da-65e35b6419f0",
/* URL of the IRMA server */
"irma": "https://attr.auth.amsterdam.nl",
/* URL of Node server, optional with port number */
"nodeUrl": "http://localhost:8000",
/* Port number the Node server listens to */
"port": 8000,
/* Document root of site to serve, only for demo */
"docroot": "../openstad",
/* Keys of voting options */
"voting_options": ["community", "tech", "zen"]
}
cd voting_node
docker build -t voting_node .
- Make sure IRMA is running (see
https://github.com/Amsterdam/di-irma-server
) - Add the URL of IRMA to
server/*.json
) - Make sure PostgreSQL is running and a user is created:
cd dev/db
./postgres.sh
cd voting_node/server
npm install
cd ../../dev
./start.sh
cd voting_node
docker run --rm -p80:8000 -e NODE_ENV=production -e CONFIG=config-prod.json -e PRIVATE_KEY="$(cat ../dev/private_key.pem)" -e POSTGRES_HOST=localhost -e POSTGRES_DATABASE=postgres -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=hj21kjy --name voting_container voting_node
Replace POSTGRES_HOST=localhost with IP address of Postgres.
cd voting_node
cp ../dev/config-dev.json server
docker build -t voting_node .
docker run -it --rm -p80:8000 -e CONFIG=config-dev.json -e PRIVATE_KEY="$(cat ../dev/private_key.pem)" -e POSTGRES_HOST=localhost -e POSTGRES_DATABASE=postgres -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=hj21kjy --name voting_container voting_node
Replace POSTGRES_HOST=localhost with IP address of Postgres.
generate the keys
$ ./dev/keygen.sh
copy the public_key.pem to irma_server_constainer/config/public_key.pem
$ cp ./dev/keypair/public_key.pem ../irma_server_container/config/public_key.pem
copy the private_key.pem the the local express server ./voting_node/server
$ cp ./dev/keypair/private_key.pem ./voting_node/server
install ngrok
- run ./dev/ngrok/ngrok.sh in a separate terminal
- copy the url generated for port 8088 and set it in ./dev/config-dev.json (
irma
setting) and in the docker-compose.yml for the BASE_URL environment variable - the ngrok tunnel will be available for 8 hours or until the ngrok session is exited. The update of the
irma
setting in config-dev.json has to be done each time the ngrok session expires or is restarted.
create and configure the certificates
- run ./dev/keygen.sh to generate the certificates (public_key.pem en private_key.pem) in ./dev/keypair
- in irma_server_container project:
- copy the public_key.pem to the irma_server_container in de config folder
- configure "key_file": "./config/public_key.pem" in ./config/irmaserver.json
- this project:
- copy private_key.pem to ./dev/
run the dockers
-
run
docker-compose build
-
build the irma_server_container image and rename this to
irmaservercontainer_irma
- docker rename
<old-name>
irmaservercontainer_irma
- docker rename
-
run
docker-compose up
and go to http://localhost:8000