☁️ Cloud Deployment

Faros CE is container-based, so deploying it to a cloud production environment can be achieved with a reasonable amount of effort.

In this guide, we'll explain the steps we followed to deploy Faros Community Edition, specifically on Kubernetes in AWS.

Deployment with kustomize

kubectl apply -k https://github.com/faros-ai/faros-community-edition/kube/base

More detailed instructions here.

Managed Deployment with Plural

Deploying Airbyte, Hasura and Metabase on Plural

As a first step, we deployed Airbyte, Hasura and Metabase using Plural. Plural makes it easy to deploy open-source applications on Kubernetes.

Create an account on https://app.plural.sh and follow steps 1 through 4 of their getting started guide. Then, simply install the applications:

plural bundle install airbyte airbyte-aws
plural bundle install hasura hasura-aws
plural bundle install metabase metabase-aws

Then build and deploy them to the cloud:

plural build
plural deploy --commit "Faros Community Edition deployment"

This should get you set up with the open-source applications used by Faros Community Edition (except for n8n, which is not supported by Plural at the time of writing).

Forward ports to your local machine

📘

Plural creates one postgres service per application. In our case, it created plural-metabase, plural-hasura and plural-airbyte. For convenience, we used the plural-metabase service to host the Faros database.

Forward the (metabase) postgres port

kubectl port-forward plural-metabase-0 -n metabase 5432:5432

Forward the Metabase API port

kubectl port-forward metabase-xyz-123 -n metabase 3000:3000

Forward the Hasura API port

kubectl port-forward hasura-xyz-123 -n hasura 8080:8080

Forward the Airbyte API port

kubectl port-forward airbyte-webapp-123-xyz -n airbyte 8000:80

Export ClusterIPs and credentials needed for the initialization scripts

export PLURAL_METABASE_CLUSTERIP=$(kubectl get svc plural-metabase -n metabase -o jsonpath='{.spec.clusterIP}')

export PLURAL_METABASE_USERNAME=$(kubectl get secret metabase.plural-metabase.credentials.postgresql.acid.zalan.do \
-o jsonpath='{.data.username}' -n metabase | base64 --decode)

export PLURAL_METABASE_PASSWORD=$(kubectl get secret metabase.plural-metabase.credentials.postgresql.acid.zalan.do \
-o jsonpath='{.data.password}' -n metabase | base64 --decode)

export HASURA_CLUSTERIP=$(kubectl get svc hasura -n hasura -o jsonpath='{.spec.clusterIP}')

export HASURA_GRAPHQL_ADMIN_SECRET=$(kubectl get secret hasura -o jsonpath='{.data.adminSecret}' -n hasura | base64 --decode)

On Mac OS

Clone the Faros Community Edition repo to be able to run the initialization scripts.

Initialize services using Docker

📘

We use a known workaround so that the initialization service can connect to services on your local machine (port forwarded from Kubernetes). This only works for Mac, as per the official Docker documentation. Feel free to try workarounds for non-Mac environments. However, we recommend skipping this section and completing the remaining steps.

export HOST=host.docker.internal
COMPOSE_PROFILES=faros-init \
FAROS_CONFIG_DB_HOST=$HOST \
FAROS_CONFIG_DB_USER=$PLURAL_METABASE_USERNAME \
FAROS_CONFIG_DB_PASSWORD=$PLURAL_METABASE_PASSWORD \
FAROS_DB_HOST=$HOST \
FAROS_DB_USER=$PLURAL_METABASE_USERNAME \
FAROS_DB_PASSWORD=$PLURAL_METABASE_PASSWORD \
AIRBYTE_URL=http://$HOST:8000 \
AIRBYTE_API_CALLS_CONCURRENCY=1 \
AIRBYTE_DESTINATION_HASURA_URL=http://$HASURA_CLUSTERIP:80 \
HASURA_GRAPHQL_ADMIN_SECRET=$HASURA_GRAPHQL_ADMIN_SECRET \
HASURA_GRAPHQL_DATABASE_URL=postgresql://$PLURAL_METABASE_USERNAME:$PLURAL_METABASE_PASSWORD@$PLURAL_METABASE_CLUSTERIP/faros \
HASURA_URL=http://$HOST:8080 \
METABASE_USER=<your desired username> \
METABASE_PASSWORD=<your desired password> \
METABASE_URL=http://$HOST:3000 \
METABASE_FAROS_DB_HOST=$PLURAL_METABASE_CLUSTERIP \
METABASE_USE_SSL=true \
./start.sh

On Linux & Windows

Clone the Faros Community Edition repo to be able to run the initialization scripts.

Creating the Faros database

In your local machine, psql "postgres://$PLURAL_METABASE_USERNAME:[email protected]:5432" should now work.

Create the Faros database using the credentials:
PGPASSWORD=$PLURAL_METABASE_PASSWORD createdb -h 127.0.0.1 -U $PLURAL_METABASE_USERNAME -p 5432 faros

From within the Faros Community Edition repo, run:

flyway \
  -locations="filesystem:./canonical-schema" \
  -url=jdbc:postgresql://127.0.0.1:5432/faros \         
  -user=$PLURAL_METABASE_USERNAME \      
  -password=$PLURAL_METABASE_PASSWORD \
  migrate

Configure Metabase

In your Faros Community Edition repo, run:

cd init && npm run build && cd scripts
METABASE_URL=http://localhost:3000 \
METABASE_USER=<your desired username> \
METABASE_PASSWORD=<your desired password> \
METABASE_FAROS_DB_HOST=$PLURAL_METABASE_CLUSTERIP \
METABASE_USE_SSL=true \
FAROS_DB_PORT=5432 \
FAROS_DB_NAME=faros \
FAROS_DB_USER=$PLURAL_METABASE_USERNAME \
FAROS_DB_PASSWORD=$PLURAL_METABASE_PASSWORD \
./metabase-init.sh

This will configure the Faros database in Metabase and upload the pre-created dashboards.

Configure Hasura

In your Faros Community Edition repo, run:

cd init &&
node lib/hasura/init --hasura-url http://127.0.0.1:8080 \
  --admin-secret $HASURA_GRAPHQL_ADMIN_SECRET \
  --database-url postgresql://$PLURAL_METABASE_USERNAME:$PLURAL_METABASE_PASSWORD@$PLURAL_METABASE_CLUSTERIP/faros

Configure Airbyte

In your Faros Community Edition repo, run:

cd init &&
node lib/airbyte/init --airbyte-url http://127.0.0.1:8000 \
  --airbyte-api-calls-concurrency 1 \
  --airbyte-destination-hasura-url http://$HASURA_CLUSTERIP:80 \
  --hasura-admin-secret $HASURA_GRAPHQL_ADMIN_SECRET