Man you're so close to Helm at this point, for me if I'm getting into templating I'd rather go on full Kubernetes and Helm
Selfhosted
A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.
Rules:
-
Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.
-
No spam posting.
-
Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.
-
Don't duplicate the full text of your blog or github here. Just post the link for folks to click.
-
Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).
-
No trolling.
Resources:
- selfh.st Newsletter and index of selfhosted software and apps
- awesome-selfhosted software
- awesome-sysadmin resources
- Self-Hosted Podcast from Jupiter Broadcasting
Any issues on the community? Report it using the report flag.
Questions? DM the mods!
I know about Helm but I don't need k8s
features and my VPS is just too weak for k8s
I think :/
Honestly look into k3s or other "distros" of k8s. There are some versions of the orchestrator made for edge computing that are quite slim in their size and gives you all the perks of the k8s api layer.
I was recently helping someone working on a mini-project to do a bit of parsing of docker compose files, when I discovered that the docker compose spec is published as JSON Schema here.
I converted that into TypeScript types using JSON Schema to TypeScript. So I can create docker compose config in code and then just export it as yaml - I have a build/deploy script that does this at the end.
But now the great thing is that I can export/import that config, share it between projects, extend configs, mix-in, and so on. I've just started doing it and it's been really nice so far, when I get a chance and it's stabilised a bit I'm going to tidy it up and share it. But there's not much I've added beyond the above at the moment (just some bits to mix-in arrays, which was what set me off on this whole thing!)
so you are also generating the docker-compose from code. I think I am looking for something that aware of both templating and docker-compose deployment because right now, at the end of the day, I am still have to run docker-compose up -f ...
while helm
can do both templating and deployment.
Here is an ansible role that will create a compose file using variables passed in. ironicbadger/ansible-role-docker-compose-generator
I tried this but ended up using ansible directly to manage my containers.
So far I just hand roll my docker-compose (at home, anyway). However, docker-compose does also support overrides via yaml merging, maybe that’s worth looking into?
My idea with that is to have a base compose that configures also my services and then to have a few override yamls with environment specific stuff (like prod, local, …)
This is similar to Kustomize from kubernetes land which I’ve worked with in the past
I actually need more than merging. For example, right now my traefik.template
will look like this:
[http.routers.{{ router_name }}]
rule = "{{ router_rule }}"
service = "{{ service_name }}"
middlewares = [{{ middlewares | map("tojson") | join(", ") }}]
{% block router %}{% endblock %}
[http.routers.{{ router_name }}.tls]
certResolver = "leresolver_http"
{% if service_host is defined %}
[[http.services.{{ service_name }}.loadBalancer.servers]]
url = "{{ 'https' if service_use_https is defined else 'http' }}://{{ service_host }}{{ ':' ~ service_port if service_port is defined else '' }}"
{% endif %}
and then one of my traefik.toml
could look like this
{% extends "template/traefik.jinja" %}
{% set router_name = "dozzle" %}
{% set router_rule = "Host(`dozzle.example.com`)" %}
{% set service_name = "dozzle" %}
{% set service_host = "dozzle" %}
{% set service_port = 8080 %}
This is definitely a job for templating, seems you’ve got the right tool to me!
I was using file merging, but one issue I found was that arrays don't get merged - and since switching to use Traefik (which is great) there are a lot of arrays in the config! And I've since started using labels for my own tooling too.
nix is pretty nice
you mean nix the package manager ?
Yeah, maybe it can be used for that somehow.