Should I Use One Large Docker Compose File or Separate Ones for Each App and NGINX?

0
13
Asked By CleverPanda83 On

I manage a Docker server that currently runs a single web application along with a reverse proxy. I'm planning to expand this server to host multiple independent apps in the future. My question is, should I consolidate everything into one large Docker Compose file, or would it be better to have individual compose files for each app? Also, I'm unsure if there's any widely accepted best practice regarding this. Thanks for your insights!

5 Answers

Answered By ContainerKing99 On

I prefer separate compose files for each project, which I then integrate into my NGINX configuration manually. Having everything in one file can cause issues if one project fails to start; it could prevent NGINX from starting up correctly. I also use an NGINX agent to manage configuration changes, but you could do it manually if that's your style.

Answered By TechGuru_FirstName On

I think separating the files is definitely the way to go. I create multiple Docker Compose projects while sharing a single network for reverse-proxying. This allows the reverse proxy to direct traffic based on domain names or paths. Just ensure that the shared network isn't tied to any specific compose project to avoid issues when you bring down a project.

Answered By PixelShadow42 On

I generally prefer keeping them separate. For example, I use Traefik instead of NGINX, but the principle is similar. When you make changes to a specific app's .yml file, you don't want to risk affecting your reverse proxy setup. I like to group my compose files by type of service - I have one for core services like Traefik, another for media stacks, and so on. Also, if you're working with any databases, it's a good idea to keep those in their own compose file along with their respective app.

Answered By CodeWhisperer99 On

I do recommend keeping everything separate, but you can still keep them in one repository if you’re using Git. This way, any changes you make to your app and the corresponding NGINX configurations can be bundled into one commit, which is super convenient.

Answered By Devsupply101 On

For me, it's all about having distinct files for each app. YML files can get pretty unwieldy, and trying to scroll through hundreds of lines for each app makes it a nightmare. Keeping them separate makes it much easier to manage.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.