0

I plan to deploy my Laravel application with docker containers. I need the following components for my application:

  • MySQl server
  • nginx server
  • cerbot for activation of ssl
  • Queue worker for Laravel

Since the application is still under development (and probably will always be), it should be very easy to update (I will automate this with GitLab CI/CD) and it should have as little downtime as possible during the update. Also, I want to be able to host multiple instances of the application, whereby only the .env file for Laravel is different. In addition to the live application, I want to host a staging application.

My current approach is to create a container for the MySQL server, one for the nginx server and one for the queue worker. The application code would be a layer in the nginx server container and in the queue worker container. When updating the application, I would rebuild the nginx conatiner and queue worker container.
Is this a good approach? Or are there better ways to achieve this? And what would be a good approach for my mysql server, nginx server, php version,... to stay up to date without downtime for the application?

4
  • What exactly have you tried so far? Zero downtime looks like stuff that is pretty much documented. Additionally, what defines a "good approach" from your POV? Is there anything not working with it? Commented Oct 28, 2019 at 10:40
  • Why you need to rebuild container when updating your app? I think restart is enough. Commented Oct 28, 2019 at 10:55
  • @NicoHaase I haven't really tried anything yet because I'm new to Docker and still working on the concept of how to deploy my application. The rebuilding of the Docker container with every update of my application seems a bit exaggerated. And I would have my application code in two containers, which would mean unnecessary redundancy. Commented Oct 28, 2019 at 11:34
  • @nmfzone wouldn't I have to rebuild the container if the application is an extra layer of the container? Commented Oct 28, 2019 at 11:35

1 Answer 1

1

The main idea of the docker is to divide your app by containers. So yep it is good to have one container for one service. In your example, I suggest keeping MySQL in one container the queue worker in another and so on. As a result, u will have containers for each service. Then suggest to create the internal docket network and connect containers to them. Also, I suggest using docker volumes to store all your application data. To make it much easyer I suggest for configuration to use docker compose.

Sign up to request clarification or add additional context in comments.

1 Comment

What about cerbot. They have their own suggestions about how to use them with docker.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.