You can deploy this application in very few steps with Docker Swarm mode and traefik.


The following tools are required for a proper deployment:

Allow SMTP ports for outgoing requests

It's very important to allow outgoing requests on common SMTP port like 25, 2525, 465, 587. But you also have to make sure, that a malicious user can't connect to any other server in your current infrastructure.


First of all, create the following file: docker-compose.yml and paste the

Run the following lines to create a new docker-compose.yml file:

curl > docker-compose.yml

Change the default values:
Replace with your domain everywhere in the docker-compose.yml file.

Set the environment variables:
Inspect all environment variables in the docker-compose.yml file and change them according to your needs.

App Key


You have to generate a new APP_KEY for security reasons. Run php artisan key:generate --show to generate a new one and copy the output. If you don't have laravel running locally or in a docker container, you can get a key with the following command instead: docker run --entrypoint php artisan key:generate --show.

.env files

Put the environment variables into a separated .env file

If you do not want to put your environment variables directly into the docker-compose.yml file, you can also put them into a separate .env file as key-value pairs.

First create a copy of the .env.example file:

curl > .env

Then you have to link the file to the service like this:

  - .env
You can do the same with the database environment variables. But you should use a separate file like .db.env.

Now you can deploy the stack:

docker stack deploy -c docker-compose.yml formail