A non-modern, maybe-scalable microservices backend built with Go. Should support IaC, CI/CD and technically cloud-native.
- Remove the
replacedirective from go.mod files and switch to go workspaces for local dev. - Add extra ingress ports with azapi provider.
Currently support per-service deployment in GitHub Actions.
Each service will have a folder inside service folder:
- authentication-service
- location-service
- logger-service
- trip-service
- api-gateway: what it sounds like
And also:
- common: common shared files between services
- proto
Apart from services, the repo also hosts infrastructure code at infrastructure folder. This should be separated into its own repo, but for easier access it's also here.
The utils folder hosts misc files for development or deployment, like init scripts for databases.
To start developing (or running locally):
- Podman (recommended) or Docker installed with Compose.
- That's it. Plug and play!
Use either docker or podman command here based on which you have installed and/or want to use.s
-
Copy
.env.examplefile and name it.envin the same root folder. Tweak it if needed. -
Run the Compose app with
docker compose build
docker compose up-
If you make any changes and want to see the result,
docker compose downthen run the app again. -
To "clean" the environment, run
docker compose down -v- To clean everything, including built images, run:
docker compose down -v --rmi allOr, use Golang toolchain in the individual service folders if you want to run bare-metal for faster development.
All volumes used are named volumes, not mounted volumes. This is to avoid permission errors when running on rootless or SELinux environment, etc. and for easier clean-up.
Development environment are managed through a docker-compose.yml file, and may drift from the production/staging environment deployed with opentofu and CD scripts. This is a trade-off for lightweight local environment with pure containers and Compose, and to utilize managed services (Postgres, Redis,...) provided by the cloud provider (in this case Azure).
Read more:
- https://www.redhat.com/en/blog/debug-rootless-podman-mounted-volumes
- https://stackoverflow.com/questions/79173758/podman-volume-mount-permissions-issues
There will be a infrastructure folder containing deployment files.
First, to deploy the infrastructure, install azure-cli on your machine. Then, login with az login.
After that, install either terraform or opentofu.
From the opentofu folder, first create a .tfvars file containing all the needed variables. There will be an example file showing needed vars.
Also, to store tfstate remotely, make a storage account then put the details inside tfvars too.
Then, just run:
tofu init
tofu plan
tofu applyThis will create an ACR, build the apps with it, then use it to create the ACA. Chicken-and-egg problem.
There should be a GitHub Actions pipeline in this repo to handle the rest (CI/CD)
Entire deploy flow is made without or with minimal LLM footprint. All mistakes are my own.