Kubernetes

This is a recommended way of deploying crowd.dev application.

Dependencies:

Steps to deploy:

  1. Download all files from here to get all that you need to start with deployment.

  2. Configuration

  • Configure .backend.env and .frontend.env by following our configuration guide
    • Keep in mind that this guide allows you to deploy some dependency services inside Kubernetes as well so you can for example use a dedicated database or use the one that we provide by using db.yaml kubernetes configuration file. This goes for cubejs.yaml (CubeJS instance), elasticmq.yaml (ElasticMQ instead of AWS SQS) and for search-engine.yaml (MeiliSearch instance) as well.
  • Fix ingress.yaml file and replace selfhosted.domain.name with your own custom domain where the application will be hosted.
  • Fix letsencrypt.yaml and change the email [email protected] with your email.
  1. Apply all database schema migration files to your own database or the one provided by us that is running inside Kubernetes - migration files can be found here and should be applied in alphabetical order.

  2. To isolate crowd.dev application from the rest of the Kubernetes cluster we are going to create a Kubernetes namespace like this:

CROWD_NS=custom-self-hosted-ns
kubectl create namespace $CROWD_NS
  1. Create backend and frontend config maps inside Kubernetes cluster
# create backend and frontend kubernetes config maps
kubectl create configmap backend-config --from-env-file=.backend.env -o yaml --dry-run=client | kubectl apply --namespace $CROWD_NS -f -
kubectl create configmap frontend-config --from-env-file=.frontend.env -o yaml --dry-run=client | kubectl apply -- namespace $CROWD_NS -f -
  1. Optional: deploy dependency services within kubernetes
# deploy PostgreSQL v13 database instance
kubectl apply --namespace $CROWD_NS -f ./db.yaml

# deploy ElasticMQ message queue instance
kubectl apply --namespace $CROWD_NS -f ./elasticmq.yaml

# deploy CubeJS instance
kubectl apply --namespace $CROWD_NS -f ./cubejs.yaml

#deploy MeiliSearch instance
kubectl apply --namespace $CROWD_NS -f ./search-engine.yaml
  1. Deploy crowd.dev application services
#deploy api service
kubectl apply --namespace $CROWD_NS -f ./api.yaml

#deploy frontend web app
kubectl apply --namespace $CROWD_NS -f ./frontend.yaml

#deploy job-generator service
kubectl apply --namespace $CROWD_NS -f ./job-generator.yaml

#deploy nodejs-worker service
kubectl apply --namespace $CROWD_NS -f ./nodejs-worker.yaml

#deploy python-worker service
kubectl apply --namespace $CROWD_NS -f ./python-worker.yaml
  1. Check if everything is up and running:
kubectl get pods --namespace $CROWD_NS

You should see something like this:

NAME                                 READY   STATUS    RESTARTS   AGE
api-dpl-6b7bf4b9f5-jf2xl             1/1     Running   0          72m
cubejs-dpl-6858446d4f-f2pkk          1/1     Running   0          58m
db-dpl-59676955df-vv4qm              1/1     Running   0          91m
elasticmq-dpl-6f8f48fd45-ldp4g       1/1     Running   0          58m
frontend-dpl-f99f9d66f-r2ktn         1/1     Running   0          58m
job-generator-dpl-5dd76d5c6-5qqc6    1/1     Running   0          57m
nodejs-worker-dpl-7fdbbc6776-kfd2l   1/1     Running   0          54m
python-worker-dpl-bc464957c-49d6n    1/1     Running   0          61s
search-engine-dpl-7fd5fc8b8c-m57sj   1/1     Running   0          76m
  1. Check your ingress location and set a relevant DNS entry in your DNS provider dashboard to point a domain name to the newly deployed application
kubectl get ingress --namespace $CROWD_NS

You should see something like this:

NAME      CLASS    HOSTS                     ADDRESS                                                                     PORTS     AGE
ingress   <none>   app.test.com              a1421cc09fd2asdccb70f123d6fd1-31236243.use-ease-2.elb.amazonaws.com         80, 443   57m

If in the ADDRESS column you see a domain name then you should set a CNAME DNS record if you see an IP
you should set an A DNS record.

  1. Open up your new application in browser using the domain name you just set.