Skip to content

Deployment

Jakub Šindelář edited this page Jan 17, 2021 · 4 revisions

Methods of deployment

Directly on host machine

You can either pull this repository, modify .env file with your variables and launch it via npm start.

Docker container

You can pull this repository, run docker build -t your-name/small-business-fridge . to build image and then deploy it with your variables. Example with all required ENV variables can be found below.

Docker run

docker run -d -p 3000:3000 \
-e DB_CONNECTION_STRING=mongodb+srv://usr:[email protected]/lednice?retryWrites=true&w=majority \
-e COOKIE_SECRET=verysecretverysecretverysecretverysecretverysecretoh \
-e PARSER_SECRET=ohverysecretverysecretverysecretverysecretverysecret \
-e API_SECRET=veryveryverysecretapikey \
-e MAIL_PORT=25 \
-e MAIL_HOST=localhost \
-e MAIL_FROM="Small Business Fridge <[email protected]>" \
-e [email protected] \
-e MAIL_PASSWORD=password \
-e [email protected] \
-e CREDS_IDENTITY_METADATA=https://login.microsoftonline.com/tenant-id/v2.0/.well-known/openid-configuration \
-e CREDS_CLIENT_ID=some-client-id \
-e CREDS_REDIRECT_URL=https://localhost/auth/openid/return \
-e CREDS_CLIENT_SECRET=rtdo:@-some-secret \
-e CREDS_COOKIE_ENCRYPTION_KEY=thiskeyhastobethirtytwobyteslong \
-e CREDS_COOKIE_ENCRYPTION_VALUE=disbeshorter \
-e CREDS_DESTROY_SESSION_URL=https://localhost/ \
-v images:/usr/src/app/public/images \
-v backup:/usr/src/app/public/database-backup \
your-name/small-business-fridge

Docker compose file

version: "3.8"
services:
  fridge:
    container_name: fridge
    environment:
      - DB_CONNECTION_STRING=mongodb+srv://usr:[email protected]/lednice?retryWrites=true&w=majority
      - COOKIE_SECRET=verysecretverysecretverysecretverysecretverysecretoh
      - PARSER_SECRET=ohverysecretverysecretverysecretverysecretverysecret
      - API_SECRET=veryveryverysecretapikey
      - MAIL_PORT=25
      - MAIL_HOST=localhost
      - MAIL_FROM="Small Business Fridge <[email protected]>"
      - [email protected]
      - MAIL_PASSWORD=password
      - [email protected]
      - CREDS_IDENTITY_METADATA=https://login.microsoftonline.com/tenant-id/v2.0/.well-known/openid-configuration
      - CREDS_CLIENT_ID=some-client-id
      - CREDS_REDIRECT_URL=https://localhost/auth/openid/return
      - CREDS_CLIENT_SECRET=rtdo:@-some-secret
      - CREDS_COOKIE_ENCRYPTION_KEY=thiskeyhastobethirtytwobyteslong
      - CREDS_COOKIE_ENCRYPTION_VALUE=disbeshorter
      - CREDS_DESTROY_SESSION_URL=https://localhost/
    ports:
      - 3000:3000
    volumes:
      - images:/usr/src/app/public/images
      - backup:/usr/src/app/public/database-backup
    restart: unless-stopped
    image: your-name/small-business-fridge
volumes:
  images:
  backup:
Clone this wiki locally