From 5873d50e8572a7258dbbb1405cd6a0ddf03ec57e Mon Sep 17 00:00:00 2001 From: Nam Chu Hoai Date: Tue, 3 Dec 2019 11:29:51 -0800 Subject: [PATCH] Update docker image and instructions (#2000) --- .../running-attestation-service.md | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/packages/docs/getting-started/running-attestation-service.md b/packages/docs/getting-started/running-attestation-service.md index b7aba2dcd74..d26e1ddb7a9 100644 --- a/packages/docs/getting-started/running-attestation-service.md +++ b/packages/docs/getting-started/running-attestation-service.md @@ -27,7 +27,9 @@ The service needs the following environment variables: A part of that we are going to setup the following environment variable about the Attestation Service Docker image: ```bash -export CELO_IMAGE_ATTESTATION="us.gcr.io/celo-testnet/celo-monorepo:attestation-service-708ea8b24736a755c4dd3792e8973a6f0bf92b1f91edceb8e0b603ad66f2d70c" +export CELO_IMAGE_ATTESTATION="us.gcr.io/celo-testnet/celo-monorepo:attestation-service-8f87dda20f1854c9532a5cbcf8ff556f48dff413" +# if you followed the instruction of setting up the attestation signer +export CELO_PROVIDER=http://localhost:8545 ``` ## Sms Providers @@ -74,12 +76,21 @@ export DATABASE_URL="mysql://user:password@mysql.example.com:3306/attestation-se export DATABASE_URL="postgres://user:password@postgres.example.com:5432/attestation-service" ``` +**Example of setting up a local postgres database on Ubuntu**: + +```bash +apt install postgres +sudo -u postgres createdb attestation-service +sudo -u postgres psql -c "ALTER USER postgres PASSWORD '';" +export DATABASE_URL="postgres://postgres:@localhost:5432/attestation-service" +``` + ## Executing the Attestation Service -The following command for running the Attestation Service is using Nexmo, but you can adapt for using Twilio easily: +The following command for running the Attestation Service is using Twilio and uses `--network host` to access a local database (only works on Linux): ```bash -docker run --name celo-attestation-service -d --restart always --entrypoint /bin/bash -e ATTESTATION_SIGNER_ADDRESS=$ATTESTATION_SIGNER_ADDRESS -e CELO_VALIDATOR_ADDRESS=0x$CELO_VALIDATOR_ADDRESS -e CELO_PROVIDER=$CELO_PROVIDER -e DATABASE_URL=$DATABASE_URL -e SMS_PROVIDERS=nexmo -e NEXMO_KEY=$NEXMO_KEY -e NEXMO_SECRET=$NEXMO_SECRET -e NEXMO_BLACKLIST=$NEXMO_BLACKLIST -p 3000:80 $CELO_IMAGE_ATTESTATION -c " cd /celo-monorepo/packages/attestation-service && yarn run db:migrate && yarn start " +docker run --name celo-attestation-service --restart always --entrypoint /bin/bash --network host -e ATTESTATION_SIGNER_ADDRESS=$ATTESTATION_SIGNER_ADDRESS -e CELO_VALIDATOR_ADDRESS=0x$CELO_VALIDATOR_ADDRESS -e CELO_PROVIDER=$CELO_PROVIDER -e DATABASE_URL=$DATABASE_URL -e SMS_PROVIDERS=twilio -e TWILIO_MESSAGING_SERVICE_SID=$TWILIO_MESSAGING_SERVICE_SID -e TWILIO_ACCOUNT_SID=$TWILIO_ACCOUNT_SID -e TWILIO_BLACKLIST=$TWILIO_BLACKLIST -e TWILIO_AUTH_TOKEN=$TWILIO_AUTH_TOKEN -e PORT=80 -p 80:80 $CELO_IMAGE_ATTESTATION -c " cd /celo-monorepo/packages/attestation-service && yarn run db:migrate && yarn start " ``` ## Registering the Attestation Service