r/devops • u/aress1605 • Aug 12 '26
Architecture Deploying docker-compose.yml
Hello all. The circumstance I have working with is the following:
* I have an Apache2 PHP server that gets bundled as a Docker image in a CI process to ECR
* I have an infra repository with a docker-compose.yml that bundles the PHP Docker image to an Nginx image, alongside Nginx config like attaching TLS certs
When the CICD process deploys a release, it deploys a new EC2 with a given user data script to prop up the server. If I only had a Docker image, the user data would generally look like "Pull down ECR image and start image", however in this case I am spinning up a docker-compose.yml file.
How is this typically done? I suppose I *can* add a CI process to zip up the docker-compose.yml and related nginx config, however feels backwards? Is there a consensus with this?
If I am fundamentally misunderstanding something let me know, I'd say my only constraint is I'd like to solve this problem in a relatively cloud agnostic environment (so keeping EC2 as a VM, ECR as a registry, but excluding abstractions like Fargate or ECS)
Thanks!
View all comments
Show parent comment
1
u/aress1605 Aug 12 '26
```it won't work if you need to add more compute power than just a single EC2 VM to your application.```
If there is load balancer that sits as a proxy, there can be N EC2 instances with N docker compose files launched via user data, so the way I am interpreting it, adding more is possible with a classic LB.
I think you are mentioning that traditionally you have one load balancer (ie. Nginx / AWS native solution) that proxies to N EC2 instances. Therefore each EC2 instances only needs the PHP server, and does not need it's own Nginx image, since TLS often ends at the load balancer anyway, so you can port forward it directly to the Apache2 endpoint? Is that what you were talking about when you mentioned you cannot scale EC2s beyond one?