Question: Multiple apps on one host sharing the same traefik instance #257
Replies: 14 comments 12 replies
-
This does seem like probably stretching things too far. I'm still not convinced that we actually should have supported multiple apps on the same hosts. I think things become a lot simpler when you can ensure it's one app per host (even if that host is allowed accessories). Are you deploying on your own hardware, is that why you don't want to separate apps by host? |
Beta Was this translation helpful? Give feedback.
-
After experimenting with MRSK some more - and loving it! - I do agree that an improvement in this regard would be to make the |
Beta Was this translation helpful? Give feedback.
-
@jpdombrowski I'm also experimenting hosting several apps on a single server. How did you configure your traefik to handle the traffic for both your apps? |
Beta Was this translation helpful? Give feedback.
-
Crucial to host multiple apps on a single server - for me too. |
Beta Was this translation helpful? Give feedback.
-
A good feature to have, if you run Kamal on a home lab mini server, exploring a few startup MVPs, and do not want to pay the price for (full) Proxmox/VMware virtualization, where Docker/Podman container isolation is just enough. |
Beta Was this translation helpful? Give feedback.
-
Host severals staging apps on single server is what I need |
Beta Was this translation helpful? Give feedback.
-
I think it would be beneficial to support either:
It would also help if they would share the network. Example:
Support for such a setup would enable unique ways to grow the project. You could start by running all on one node, then as the traffic grows you can easily move the roles and accessories around and scale on to multiple nodes. |
Beta Was this translation helpful? Give feedback.
-
All of the problems I described in my initial post have been solved in principle with the introduction of #580, which makes the traefik enabled web role optional. We can now say: primary_role: workers
servers:
workers:
traefik: false
hosts:
- my-host.example.com This solves a lot. We can now run standalone cmd role / job workloads and even put them on the same host with another kamal web deployment (and its traefik instance). We could also deploy multiple web apps on the same host by managing traefik in only one of them or by pulling traefik out of kamal entirely and manage it on the host directly or even replace it with another reverse proxy of our own choosing. EDIT: The last use cases are not ideal, b/c of healthchecks / zero-downtime issues but they should be considered "hacky" anyway. |
Beta Was this translation helpful? Give feedback.
-
Definitely a fan of this being now possible. I feel Kamal is perfectly able to deploy some or all services to the same host without it turning into a jack of all trades master of non. Personally I love to be able to use a tool that scales with my needs. From small side projects running on a home server or cheap VPS to something that spans multiple containers and or cloud providers.
That being said I feel like it would be great if we could use every docker and docker-compose configuration option with a few sprinkles of Kamal ontop. Passing in Dockerfiles to hosts/accessories or possibly handling the majority of configuration through docker compose. |
Beta Was this translation helpful? Give feedback.
-
While possible but hacky currently, it looks like this is coming with full support in Kamal 2: https://twitter.com/dhh/status/1766151697817313628 |
Beta Was this translation helpful? Give feedback.
-
@miharekar thank you for linking to that tweet - fantastic news! |
Beta Was this translation helpful? Give feedback.
-
2.0.0 beta is released. Does anyone know if the feature has been implemented? |
Beta Was this translation helpful? Give feedback.
-
Kamal 2 will be out very soon and this is one of the two headline features (the other is auto SSL)! |
Beta Was this translation helpful? Give feedback.
-
Confirming this is working for me now. Default configs from Very very happy with Kamal! |
Beta Was this translation helpful? Give feedback.
-
I have been experimenting w/ MRSK over the last week to see how many different deployment scenarios I could cover w/ it and so far it performed terrific.
One particulary scenario feels a bit ikky at this point though.
I deployed a Rails API and a Vue.js app (static files w/ Nginx in front) on a single host w/ lots of customization in the treafik config (endpoints for port 80 and 443, TLS termination w/ letsencrypt certificate generation, redirect from http to https, gzip compression) with no other proxy (load balancers or cdn) in front. Traefik was put into host networking mode to get real ips b/c we do not get proxy headers in this scenario, which sucks but a proxy / load balancer in front would solve this. All traefik config ended up in ONE of the two repos.
So far this actually works well w/ some gotchas.
mrsk deploy
/mrsk traefik reboot
.mrsk build create
,mrsk registry login
,mrsk redeploy
to not touch the Traefik instance on the first deploy andmrsk redeploy
on subsequent deploys.Two solutions that came to mind are hard to maintain.
Granted, this is problaby not your main concern w/ the work MRSK is doing for you at 37signals. In production scenarions multiple apps would probaby end up on different hosts and Traefik customization would be minimal b/c we would have load balancers or a CDN in front doing most of the work for us. BUT the Readme describes "to run multiple applications on the same server sharing the same Traefik instance and port" as a feature, Traefik is great at that and still every setup doing this should run into the issues described.
So question is, am I doing it wrong or stretching MRSK too far?
One possible solution I see is allowing a
web: false
ortraefik: false
on the web role which I understand is impossible right now.The additional benefit of enabling this would be that cmd role / job workloads could be deployed w/ a different Dockerfile as well w/o ending up as an accessory.
Another way could be to configure different Dockerfiles per role and doing monorepos.
Thanks for your thoughts and the terrific work so far!
Beta Was this translation helpful? Give feedback.
All reactions