diff --git a/README.md b/README.md index 23d32cd..4939f62 100755 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ You can check out [the Next.js GitHub repository](https://github.com/vercel/next # Deploy on Vercel The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. -Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. +Check out [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. # MongoDB This app currently requires MongoDB for its backend storage. To set up MongoDB for this app: @@ -42,18 +42,19 @@ This app currently requires MongoDB for its backend storage. To set up MongoDB f * From there create a collection, as well as a user with read and write permissions. * Copy `.env.example`, and rename the copy `.env` * Copy all the information from your Atlas cluster into the appropriate fields in the `.env` file. - * NOTE: If the app can't connect to your Mongo Atlas collection, make sure that you've added your server IP to the whitelist for your Mongo Atlas account. + +TROUBLESHOOTING: If the app can't connect to your Mongo Atlas collection, make sure that you've added your server IP to the whitelist for your Mongo Atlas account. # Docker We've provided both a sample Dockerfile and two sample docker compose files. - The docker compose files are identical except that the production version includes configuration for [nginxproxy/nginx-proxy](https://github.com/nginx-proxy/nginx-proxy) and [nginxproxy/acme-companion](https://github.com/nginx-proxy/acme-companion). + The two docker compose files are identical except that the production version includes configuration for [nginxproxy/nginx-proxy](https://github.com/nginx-proxy/nginx-proxy) and [nginxproxy/acme-companion](https://github.com/nginx-proxy/acme-companion). - Both compose files includes a HEALTHCHECK configuration that monitors the running web app container. If the healthcheck returns 'unhealthy' three times in a row, the the [willfarrell/autoheal](https://github.com/willfarrell/docker-autoheal) service restarts the container. + Both compose files include a HEALTHCHECK configuration that monitors the running web app container. If the healthcheck returns 'unhealthy' three times in a row, the the [willfarrell/autoheal](https://github.com/willfarrell/docker-autoheal) service restarts the container. You can also configure an SMTP email server, which the healtcheck will use to send emails to an email recipient whose address you can also configure. The healthcheck only sends emails if the check returns unhealthy. And finally you can set a webhook on both the healtcheck and the autoheal, to which the same notifications of unhealthy status will be sent. We use the Slack webhook for this. - We've set the configuation values in the 'environment' sections of the compose file, but you can also use a .env file. We've in fact also provided a .env file in which we've configured the mongo user, password, and host. Feel free to add environment variable either way - they are equivalent. The .env file may be more secure. \ No newline at end of file + We've set the configuation values in the 'environment' sections of the compose file, but you can also use a .env file, like the .env.example we provide. The .env file may be more secure. \ No newline at end of file diff --git a/docker-compose.example.prod.yml b/docker-compose.example.prod.yml index 3866f9a..68ec1fc 100644 --- a/docker-compose.example.prod.yml +++ b/docker-compose.example.prod.yml @@ -5,21 +5,24 @@ services: container_name: web-verifier-plus build: . environment: - - VIRTUAL_HOST=${URL} - - VIRTUAL_PORT=3000 - - LETSENCRYPT_HOST=${URL} - - HEALTH_CHECK_SMTP_HOST= + - HEALTH_CHECK_SMTP_HOST=add your email host, like smtp.sendgrid.net - HEALTH_CHECK_SMTP_USER= - HEALTH_CHECK_SMTP_PASS= - HEALTH_CHECK_EMAIL_FROM=Digital Credentials Consortium Demo Issuer - - HEALTH_CHECK_EMAIL_RECIPIENT= + - HEALTH_CHECK_EMAIL_RECIPIENT=the email addresss of whoever should receive unhealthy notications - HEALTH_CHECK_EMAIL_SUBJECT="DCC Dashboard Issuer Coordinator Microservice Healthcheck" - - HEALTH_CHECK_WEB_HOOK= - - HEALTH_CHECK_SERVICE_URL=http://localhost:3000/api/healthz + - HEALTH_CHECK_WEB_HOOK=a webhook like those of Slack + - HEALTH_CHECK_SERVICE_URL=http://testing.dcconsortium.org/api/healthz - the healthz endpoint - HEALTH_CHECK_SERVICE_NAME=VERIFIER-PLUS + - DB_USER=your mongo user + - DB_PASS=and mongo password + - DB_HOST=and mongo host + - VIRTUAL_HOST=testing.dcconsortium.org - replace with your server host + - VIRTUAL_PORT=3000 - and port + - LETSENCRYPT_HOST=testing.dcconsortium.org - usually the same as VIRTUAL_HOST healthcheck: test: ["CMD", "node", "healthcheck.mjs"] - interval: 120s + interval: 30m retries: 3 start_period: 30s timeout: 80s @@ -28,12 +31,12 @@ services: labels: autoheal: true autoheal: + image: willfarrell/autoheal:latest + restart: always environment: - AUTOHEAL_INTERVAL=60 - AUTOHEAL_START_PERIOD=30 - - WEBHOOK_URL= - image: willfarrell/autoheal:latest - restart: always + - WEBHOOK_URL=an optional webhook to report restarts volumes: - /etc/localtime:/etc/localtime:ro - /var/run/docker.sock:/var/run/docker.sock @@ -41,8 +44,8 @@ services: container_name: nginx-proxy image: nginxproxy/nginx-proxy ports: - - "${HTTPPORT}:80" - - "${HTTPSPORT}:443" + - "80:80" + - "443:443" volumes: - /var/run/docker.sock:/tmp/docker.sock:ro - ./certs:/etc/nginx/certs @@ -51,6 +54,9 @@ services: nginx-proxy-acme: container_name: nginx-proxy-acme image: nginxproxy/acme-companion + environment: + - DEFAULT_EMAIL=chartraj@mit.edu - replace with the admin/maintainer + - NGINX_PROXY_CONTAINER=nginx-proxy volumes: - /var/run/docker.sock:/var/run/docker.sock:ro - ./acme:/etc/acme.sh @@ -58,8 +64,6 @@ services: - ./certs:/etc/nginx/certs - ./vhost:/etc/nginx/vhost.d - ./html:/usr/share/nginx/html - environment: - - "DEFAULT_EMAIL=${EMAIL}" - - NGINX_PROXY_CONTAINER=nginx-proxy depends_on: - "nginx-proxy" + diff --git a/docker-compose.example.yml b/docker-compose.example.yml index b12ddcb..deb60c8 100644 --- a/docker-compose.example.yml +++ b/docker-compose.example.yml @@ -4,34 +4,38 @@ services: web-verifier-plus: container_name: web-verifier-plus build: . - healthcheck: - test: ["CMD", "node", "healthcheck.mjs"] - interval: 120s - retries: 3 - start_period: 30s - timeout: 80s environment: - - HEALTH_CHECK_SMTP_HOST= + - HEALTH_CHECK_SMTP_HOST=add your email host, like smtp.sendgrid.net - HEALTH_CHECK_SMTP_USER= - HEALTH_CHECK_SMTP_PASS= - HEALTH_CHECK_EMAIL_FROM=Digital Credentials Consortium Demo Issuer - - HEALTH_CHECK_EMAIL_RECIPIENT= + - HEALTH_CHECK_EMAIL_RECIPIENT=the email addresss of whoever should receive unhealthy notications - HEALTH_CHECK_EMAIL_SUBJECT="DCC Dashboard Issuer Coordinator Microservice Healthcheck" - - HEALTH_CHECK_WEB_HOOK= - - HEALTH_CHECK_SERVICE_URL=http://localhost:3000/api/healthz + - HEALTH_CHECK_WEB_HOOK=a webhook like those of Slack + - HEALTH_CHECK_SERVICE_URL=http://localhost:3000/api/healthz - the healthz endpoint - HEALTH_CHECK_SERVICE_NAME=VERIFIER-PLUS + - DB_USER=your mongo user + - DB_PASS=and mongo password + - DB_HOST=and mongo host + healthcheck: + test: ["CMD", "node", "healthcheck.mjs"] + interval: 30m + retries: 3 + start_period: 30s + timeout: 80s ports: - "3000:3000" labels: autoheal: true autoheal: + image: willfarrell/autoheal:latest + restart: always environment: - AUTOHEAL_INTERVAL=60 - AUTOHEAL_START_PERIOD=30 - - WEBHOOK_URL= - image: willfarrell/autoheal:latest - restart: always + - WEBHOOK_URL=an optional webhook to report restarts volumes: - /etc/localtime:/etc/localtime:ro - /var/run/docker.sock:/var/run/docker.sock - \ No newline at end of file + +