Starting a SaaS from Laravel application with Docker

Dear everyone,

I’m completely new to Docker. I discovered Docker when I was looking for a solution for SaaS. Me and a colleague have made a webstore platform in Laravel 5.8.

Now, we would like to introduce this as a SaaS, where users can register a new webstore so that they get a subdomain and can access this webstore and webstore-dashboard from their subdomain.

We already have the webstore and dashboard working: it works with a MySQL database and some payment API’s from PayPal.

All the database data and maybe some configuration files (such as PayPal API credentials) should be in a container (if I understood correctly).

When I was looking where to start, I came across alot of terminology such as CaaS, PaaS, and more. I felt quite overwhelmed.

When jumping in a project like this: where to start? How / where can I learn how to get this Laravel project of us running as a SaaS as explained above? Is there anything that can put us in the right direction?

Thank you for reading and kind regards,

Lars

Yes, Docker is used by us in both production and local development environments (with AWS ECS).

It functions flawlessly in production, but the local development environments are giving us some trouble. This, in my opinion, is primarily due to the way Docker for Mac functions and synchronises files between the host computer and the containers. This is particularly problematic for our node container, which runs a Next.js application. Changes to node modules are problematic, live reload is slow, and Next.js has trouble handling the enormous number of files the framework regenerates when making changes to files. It causes the node container to occasionally crash or require rebuilding because something went wrong…

It sounds like you are interested in using Docker to containerize your Laravel application and make it available as a software as a service (SaaS). Here are some steps you can take to get started:

  1. First take some time to familiarize yourself with Docker and how it works. You can start by reading the Docker documentation and working through some of the tutorials to get a sense of how Docker works and how you can use it to containerize your application.
  2. Containerize your Laravel application. Once you understand the basics of Docker, you can start by creating a Dockerfile for your Laravel application. This will allow you to build a Docker image for your application that can be used to create containers. You can refer to this blog post that you can follow to achieve it.
  3. Deploy your containers. Once you have your Docker containers set up, you will need to find a way to deploy them so that they are available to your users. There are several options for doing this, including using a container orchestration platform like Kubernetes or deploying your containers to a cloud provider like Amazon Web Services or Google Cloud Platform.
  4. Set up your subdomains. In order to provide each user with their own subdomain, you will need to set up a way to route traffic to the appropriate container based on the subdomain. You can do this using a reverse proxy like NGINX or by setting up a load balancer.

Hope it helps. Let me know if you face any issue.

1 Like

@davidsk01 I guess @ajeetraina Answered the first post. I know this topic is not about Docker Desktop, but since you mentioned it, I wanted to note that if you still want to develop on macOS, recent Docker Desktop for Macs support VirtioFS which is usually faster then the old solution. I am not sure if it solves your problem, but If you want to know more about that you can search for VirtioFS on the forum or open a new topic if you think it is necessary so we can discuss it there.

I also think Ajeet wanted to share this link as “Docker Documentation”: https://docs.docker.com/ instead of the forum topic.

2 Likes