Bifrost

A self hosted tool which helps in creating one time or scheduled campaigns from your database/data warehouse

Much like in Marvel Universe, Bifrost enables your data to travel from your database or data warehouse to SuprSend in a fast and safe manner. It helps in running manual or scheduled tasks which can pull data from your data store and send it to SuprSend enabling you to reach out to your customers with ease.

Use Cases that Bifrost solves right now

  • Running and monitoring scheduled tasks like Daily/Weekly/Periodic reminders
  • Running manual tasks like release notes, updates which needs to be sent to all or subset of your users.

Dependencies

  • Bifrost is a tool written in Go, can be deployed using our docker image. It has a single dependency, Redis.
  • Depending on your use case, you can use separate redis instance or spin it up using provided docker compose configuration.
  • To simplify deployment, docker compose configuration is also provided which supports automatic SSL certificate management via Caddy
  • For Authentication, if your organisation uses Google Workspace you can create a Internal OAuth application using which your employees can login to Bifrost.
  • As of now Bifrost can connect to following databases, with support for other databases/warehouses coming soon:
    • MySQL (supported)
    • PostgreSQL (supported)
    • BigQuery (supported, check How to integrate BigQuery with Bifrost)
    • MongoDB (in development)
    • Elasticsearch / Opensearch (in development)
    • Redshift (in development)

Getting started with deployment

Decide the hostname on which you would host Bifrost

For the purpose of this documentation we will assume you will be hosting Bifrost on <https://bifrost.yourdomain.com> as a placeholder. Go to your DNS provider and add an A record pointing bifrost.yourdomain.com to the IP of the instance where you will be deploying Bifrost.

Decide where will you host Redis

If you have a existing redis instance or redis cluster, you can use that by providing proper redis url in Bifrost config file (explained later)

Other option can be to use docker compose to boot up a redis instance specifically used by Bifrost. (check docker compose option below)

Generate OAuth Client token and Secret

Go to documentation page for generating Google OAuth client token and secret and follow the steps if you are generating new token. If there are already existing application you can use that as well if you want.

Generate Config yaml file

Use following reference config file to create your config file (name it bifrost-config.yaml and store it in a directory where you want to deploy Bifrost. You would need to copy workspace key and secret for SuprSend workspaces that you need to connect with Bifrost.

bifrost:
  host: "https://bifrost.yourdomain.com"
  timezone: "Asia/Kolkata"
  google_clientKey: "__OAUTH_CLIENT_KEY__"
  google_clientSecret: "__OAUTH_CLIENT_SECRET__"
  suprsend:
    - name: staging
      key: "__staging_workspace_key__"
      secret: "__staging_workspace_secret__"
    - name: production
      key: "__production_workspace_key__"
      secret: "__production_workspace_secret__"

Configure docker compose file

Use following reference docker compose file to create compose file which suits your requirement and store it in the same directory where you want to deploy Bifrost

services:
  redis:
    container_name: redis
    image: "bitnami/redis:latest"
    volumes:
      - ./redis-data:/bitnami/redis/data
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
  bifrost-server:
    container_name: bifrost-server
    restart: on-failure
    image: "ghcr.io/suprsend/bifrost:main"
    entrypoint: /bifrost-server
    depends_on:
      - redis
    volumes:
      - "./:/bifrost/"
  bifrost-worker:
    container_name: bifrost-worker
    restart: on-failure
    image: "ghcr.io/suprsend/bifrost:main"
    entrypoint: /bifrost-worker
    depends_on:
      - redis
    volumes:
      - "./:/bifrost/"
  caddy:
    container_name: caddy
    image: caddy:latest
    depends_on:
      - redis
      - bifrost-server
    ports:
      - "443:443"
      - "80:80"
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile
      - ./caddy:/data/caddy/pki

Ensure redis container has permissions to write in redis-data directroy. If not, run chown -R 1001:1001 redis-data

If you are using Caddy for automatic HTTPS certificate creation and renewal, also add Caddyfile with following content in the same directory

{
    email __your_email_id__
}

bifrost.yourdomain.com

reverse_proxy bifrost-server:3000

Start Bifrost service

Start docker services by executing docker-compose up -d. Wait for Caddy to generate SSL certificates. Now if you visit <https://bifrost.yourdomain.com> you should see a login page like this

You can shutdown Bifrost by executing docker-compose down