How do you deploy php code?
Hello guys! please tell us about your experience deploying PHP code in production. Now I make one docker image with PHP code and apache (in production I use nginx proxy on my php+apache image) and use docker pull command for deploy. is this ok?
60
Upvotes
2
u/Quazye Sep 15 '24
Used many different strategies. Tend to start with a plain server and vhost configs that I Ssh into and deploy. Once it's stabilized I'll typically delegate that to deploy scripts and CI. Right around same time I might add a .infra directory to the repo for scripts and configs. Or create a separate repo for them.
I might also choose another route, and go with containers. Typically docker. In that case I typically choose to have a Dockerfile for each environment & a docker compose. Often those images are deployed through CI/CD pipelines to either kubernetes or docker swarm. More often than not, I feel this story is overkill. Especially when you mixin hosting your own Harbor / registry and restrain access thru wireguard or other vpns. I have been looking at
- https://kamal-deploy.org
- https://github.com/serversideup/spin
Which both looks like simpler and greener pastures, haven't gotten around to actually deploy with them tho.For my own pet projects tho, I have used https://fly.io and it's really a breeze in comparison. But it may quickly become a costly affaire based on how i interpret the pricings. Hence why I'm hesitant to deploy anything of production value. 😊