Skip to content

demetris-manikas/dbos-docker-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is it about

This a template to get you started on developing a DBOS backed application on your local machine with docker-compose or microk8s

A Helm configuration (tested with microk8s) is also provided.

Getting Started

with docker compose

run the following commands to get up and running

cd backend
npm run install
npm run build
cd ..
cp .env.tpl .env
docker compose up

To see that it's working, visit: http://localhost:3000/db/version.

and you should get this message: Connection succesfull! version: {POSTGRES_VERSION}.

To check the Kafka integration visit http://localhost:3000/kafka/producer and you should see a message in the console.

with microk8s

with your microk8s running run

    microk8s status

and the output should look like

high-availability: no
  datastore master nodes: 127.0.0.1:19001
  datastore standby nodes: none
addons:
  enabled:
    dashboard            # (core) The Kubernetes dashboard
    dns                  # (core) CoreDNS
    ha-cluster           # (core) Configure high availability on the current node
    helm                 # (core) Helm - the package manager for Kubernetes
    helm3                # (core) Helm 3 - the package manager for Kubernetes
    hostpath-storage     # (core) Storage class; allocates storage from host directory
    ingress              # (core) Ingress controller for external access
    metrics-server       # (core) K8s Metrics Server for API access to service metrics
    registry             # (core) Private image registry exposed on localhost:32

Edit your .env file and set REGISTRY to localhost:32000/ (sorry the trailing slash is not optional)

Install kafka following the directions from here and then run the following commands

    docker compose build
    docker push localhost:32000/app-backend-db
    docker push localhost:32000/app-backend
    docker push localhost:32000/app-keycloak-db
    docker push localhost:32000/app-keycloak
    cd helm
    cp values.yaml.tpl values.yaml

Edit helm/values.yaml.

Set the app hostPath to point to the app dir (e.g. /home/user/projects/dbos-app/backend) Set the db hostPath to point to the where you want postgres to keep its data (e.g. /tmp/backend-db)

To install run from within the helm directory helm install -f values.yaml dbos dbos-app/ -n dbos-app --create-namespace To uninstall run helm uninstall dbos --namespace dbos-app

Add 127.0.0.1 app.dbosapp.test to your /etc/hosts

Visit https://app.dbosapp.test/db/version

and you should get this message: Connection succesfull! version: ${POSTGRES_VERSION}.

Next Steps

Most of the boilerplate is here so modify to your needs and write your DBOS backed application.

TODO

Create oauth2-proxy helm files