Need help with deployment automation setup
I’m working on my first full-stack project and trying to figure out the right way to automate deployments. Currently using AWS EC2 free tier for everything.
My current setup looks like this:
- GitHub Actions compiles everything and pushes artifacts to S3 bucket
- CodeDeploy pulls the compiled files from S3 and handles the deployment to EC2
- Running React frontend and Node.js backend in separate Docker containers
- Apache serves as reverse proxy to handle incoming requests
Questions I have:
- Does this approach make sense for a small project running on free tier EC2?
- My instance keeps running low on storage space. Could this be related to my deployment workflow creating too many files?
- What would be better alternatives for continuous deployment that work well with EC2 free tier limitations?
This is just a learning project but I want to keep it stable long term without spending money on paid AWS services.
Looking for suggestions on how to optimize this or important concepts I should learn about CI/CD on EC2.
Interesting setup! You could try docker-compose to manage both containers - makes things way easier. What’s eatin up all that storage though? Got any monitorin running? I’d bet it’s logs piling up, temp files, or npm cache goin crazy over time.
Your setup works fine for learning, but those storage problems on free tier EC2 are from Docker layers piling up. I hit the same issue when I started doing automated deployments on t2.micro instances. Add cleanup commands to your deployment script - docker system prune will automatically clear out old images and containers after each deployment. Multi-stage builds also help cut down image sizes big time. For free tier, I’ve found GitHub Actions with direct Docker deployment beats the S3/CodeDeploy approach. Just have GitHub Actions build your images, push to Docker Hub or ECR public, then SSH into your EC2 to pull and restart containers. Skips the S3 step entirely and keeps things simpler. That 8GB limit means you’ve got to stay on top of disk usage and automate cleanup, or you’ll run into problems down the road.
yo, docker is def eating up your space on that t2.micro. go with alpine images, they take way less space than ubuntu. also, don’t forget to set up log rotation - those logs can get massive real quick. and maybe try Watchtower to keep your containers updated automatically!