Home

Awesome

Markdown-to-PDF Service

Note: This is currently in development and not feature complete.

pipeline status

<!--toc:start--> <!--toc:end-->

This is a demo project to showcase a small microservice architecture by exposing

Project Structure

Architecture

The architecture is described in more details here.

Requirements

On NixOS use the flake.nix by doing nix develop --command zsh inside the root of the repo. This will setup an isolated development shell with all tools installed.

On other systems you need the following essentials:

and either

Quick Instructions

The following walks you through starting up a local Kubernetes cluster with kind, inspecting the cluster and also shutting it down again.

Note: All commands given in the following are safe to use (virtualized or locally scoped to the repository) to use and will only minimally fiddle with your system.

Deploy

The easiest way to run the api and corresponding other deployments (database etc.) is using tilt on a local Kubernetes cluster, such as kind. The tool kind is only doing the following two simple isolated parts on source file changes:

Start the kind-kikist cluster (context: kind-kikist, with a local image registry :partying_face:) with

just create-cluster

Note: kind will write to your kubectl config file located in ~/.kube/config or otherwise set by KUBECONFIG env. variable.

You can now start k9s to inspect the state of the cluster. No api pods should be running yet.

With tilt installed and the kind Kubernetes cluster running, deploy all the api etc. with:

just deploy-up

Open the tilt web browser http://localhost:10350 to see the log & status of all running components, notably api and postgres.

Shutdown

Killing the cluster is as simple as:

just delete-cluster

which will kill all resources and pods.

Locally Building Components

All components can be build with e.g.

just [--set parallel true] build

which will run the build task over all components.

to build a single component <component> either run just build inside the components/<components> directory or use

just component <component> build`

inside the repository root. All binaries are in the target directory inside the repository root.

Deploying Components to the Cluster (Kubernetes)

The tool tilt will run all services and build all docker containers to the ttl.sh registry (ephemeral images).

It will watch for changes to any files (including the service manifests and redeploy the services, configuration maps as far as possible.

To start the loop run (after just create-cluster) do:

just deploy-up

which loads an optional user-defined settings file manifests/.env.yaml. You can use the local registry for uploading the container images or ttl.sh and also configure if you want to build a debug release for more log output on trace and debug levels.

To remove all resources from the development cluster use:

just deploy-down

You can inspect continuously the state of the cluster with k9s and also watch tilt what its doing by inspecting http://localhost:10350.

Development

Debugging in Rust

Database Inspection

Run just start-db-tool and make a connection with the DATABASE_URL in your configured components/api/.env.

Githooks

You can install Githooks by running the manual install here and then running:

cd repository
git hooks install
git hooks config enable-containerized-hooks --global --set

in this repository. To show all running hooks run git hooks list. To disable running hooks use either

CI/CD

Gitlab

Either use the free Gitlab credits or start your own runner with docker by running:

just start-gitlab-runner <token>

where the <token> is the Gitlab runner token obtained from setting up a project specific runner in Gitlab. After starting the runner, the config mount will be inside .gitlab/local.

Testing API Calls

There is a simple just test manual command which tests some simple API calls for manual debugging and investigations.