Docker (recommended)

Instructions for deploying Garnet using Docker

Garnet's recommended method of deployment is using Docker containers. We currently support three types of images:

Latest
Specific Release
Preview
Latest

These images contain the latest version of Garnet.

  • garnet.docker.scarf.sh/garnetlabs/garnet-oss-backend:latest

  • garnet.docker.scarf.sh/garnetlabs/garnet-oss-frontend:latest

Specific Release

Recommended for production usage. Current release number is 0.1.2

  • garnet.docker.scarf.sh/garnetlabs/garnet-oss-backend:<release-version-number>

  • garnet.docker.scarf.sh/garnetlabs/garnet-oss-frontend:<release-version-number>

Preview

This is the quickest method of setup, and is meant for evaluation purposes only

  • garnet.docker.scarf.sh/garnetlabs/garnet-oss-preview:latest

We recommend using the latest tag, so you have the latest features and security updates.

Step By Step Installation

Docker Installation Guide

  1. Install Docker Engine

  2. Install Docker Compose

  3. Setup Docker to run without root privileges (optional but strongly recommended)

  4. Install git

    sudo apt-get update && sudo apt-get install git
  5. To clone the Garnet repository and enter the new directory, run:

    git clone https://github.com/garnet-labs/garnet-oss.git && cd garnet-oss
  6. Generate a ENCRYPTION_KEY that is unique to your instance. Please follow the instructions on creating a custom encryption key.

    ⚠️ Note: Do not use our placeholder key

  7. Configure docker-compose.yml

    You can customize the docker-compose.yml file provided in the garnet-oss/ directory to configure Garnet based on your custom setup. Provided below is an example of a template that you can customize:

    version: '3'
    services:
    db:
    container_name: postgres
    environment:
    POSTGRES_DB: garnet
    POSTGRES_PASSWORD: garnet
    POSTGRES_USER: garnet
    image: postgres:13
    ports:
    - 5432:5432
    volumes:
    - postgres-data:/var/lib/postgresql/data
    backend:
    container_name: garnet_backend
    environment:
    DB_USERNAME: garnet
    DB_PASSWORD: garnet
    DB_NAME: garnet
    DB_HOST: db
    DB_TYPE: postgres
    DB_LOGGING: "true"
    API_DOCUMENTATION_ENABLED: "true"
    FRONTEND_URL: http://localhost:3000
    BACKEND_URL: http://localhost:8080/api
    AUTH_JWT_EXPIRES_IN: 365 days
    ENCRYPTION_KEY: <randomly-generated-256-bit-key>
    AUTH_JWT_SECRET: <randomly-generated-UUID-string>
    AUTH_SOCIAL_GITHUB_CLIENT_ID: <GitHub-OAuth-client-ID>
    AUTH_SOCIAL_GITHUB_CLIENT_SECRET: <GitHub-OAuth-client-secret>
    AUTH_SOCIAL_GITHUB_CALLBACK_URL: http://localhost:8080/api/auth/social/github/callback
    TENANT_MODE: multi
    SENDGRID_EMAIL_FROM: <your-sender-email>
    SENDGRID_KEY: <your-sendgrid-key>
    SENDGRID_TEMPLATE_EMAIL_ADDRESS_VERIFICATION: <verification-template-id>
    SENDGRID_TEMPLATE_INVITATION: <invitation-template-id>
    SENDGRID_TEMPLATE_PASSWORD_RESET: <password-reset-template-id>
    image: garnet.docker.scarf.sh/garnetlabs/garnet-oss-backend:latest
    links:
    - db:db
    ports:
    - 8080:8080
    working_dir: /app
    command: npm run start:db
    frontend:
    container_name: garnet_frontend
    image: garnet.docker.scarf.sh/garnetlabs/garnet-oss-frontend:latest
    ports:
    - 3000:3000
    working_dir: /app
    command: npm start
    volumes:
    postgres-data:
  8. Run Garnet

    docker-compose up -d

  9. You are good to go! Once the server is up, you can navigate to the Dashboard at http://localhost:3000 (if running locally) or http://<your-instance-ip-OR-domain-name>:3000

    otherwise.

Based on the above docker-compose.ymlfile, a local Postgres instance will be set up. For testing purposes, it can be accessed at http://<your-instance-ip-OR-domain-name>:5432

Using an external Postgres Database

If you're running your Postgres database elsewhere (i.e. Amazon RDS, or a different server) you can edit the provideddocker-compose.ymlfile inside the garnet-oss/ directory and do the following:

  • Set the DB_HOST property to point to the hostname of your database service (e.g. my-db.cyhecuzhr7cs.us-east-1.rds.amazonaws.com)

  • Set DB_USERNAME , DB_PASSWORD , DB_NAME and DB_TYPE accordingly

  • Make the following edits in the provided docker-compose.yml file:

    • In services:, remove the entire db: section

    • In the backend: section, remove the links: – db:db line.

Upgrading Garnet using Docker

Upgrading Garnet with Docker depends on how you've deployed with Docker.

Note: You may need to store your encryption key and update the docker-compose.yml file after upgrading. Here's how to setup your secret encryption key with Docker Compose

  • For docker-compose, run docker-compose pull garnet_frontend , and docker-compose pull garnet_backend

If you have pinned a version, check CHANGELOG for the latest version.

Local Development

If you're running locally, use the docker-compose.dev.yml file provided in our GitHub repository. This assumes that you have set Garnet's configuration environment variables described here.

docker-compose -f docker-compose.dev.yml up