You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: deployment/docker-compose.md
+14-23Lines changed: 14 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -4,27 +4,27 @@ While [Docker Compose](https://docs.docker.com/compose/) is mainly known and use
4
4
or small-scale deployments, where the robustness (and the associated complexity) of [Kubernetes](kubernetes.md) is not
5
5
required.
6
6
7
-
API Platform provides Docker images, and a Docker Compose definition optimized for production usage.
7
+
API Platform provides Docker images and a Docker Compose definition optimized for production usage.
8
8
In this tutorial, we will learn how to deploy our Symfony application on a single server using Docker Compose.
9
9
10
-
Note: this tutorial has been adapted from [the Symfony Docker documentation](https://github.com/dunglas/symfony-docker/blob/main/docs/production.md).
10
+
Note: this tutorial has been adapted from [the Symfony Docker documentation](https://github.com/dunglas/symfony-docker/blob/main/docs/production.md).
11
11
12
12
## Preparing a Server
13
13
14
14
To deploy your application in production, you need a server.
15
-
In this tutorial we will use a virtual machine provided by DigitalOcean, but any Linux server can work.
15
+
In this tutorial, we will use a virtual machine provided by DigitalOcean, but any Linux server can work.
16
16
If you already have a Linux server with Docker Compose installed, you can skip straight to [the next section](#configuring-a-domain-name).
17
17
18
18
Otherwise, use [this affiliate link](https://m.do.co/c/5d8aabe3ab80) to get $100 of free credit, create an account, then click on "Create a Droplet".
19
19
Then, click on the "Marketplace" tab under the "Choose an image" section and search for the app named "Docker".
20
20
This will provision an Ubuntu server with the latest versions of Docker and Docker Compose already installed!
21
21
22
-
To test, the cheapest plan will be enough, but for real production usage you'll probably want to pick a plan in the "general purpose" section that will fit your needs.
22
+
For test purposes, the cheapest plan will be enough. For real production usage, you'll probably want to pick a plan in the "general purpose" section that will fit your needs.
23
23
24
24

25
25
26
-
You can keep the defaults for other settings, or tweak them according to your needs.
27
-
Don't forget to add your SSH key or to create a password then press the "Finalize and create" button.
26
+
You can keep the defaults for other settings or tweak them according to your needs.
27
+
Don't forget to add your SSH key or to create a password, then press the "Finalize and create" button.
28
28
29
29
Then, wait a few seconds while your Droplet is provisioning.
30
30
When your Droplet is ready, use SSH to connect:
@@ -35,7 +35,7 @@ ssh root@<droplet-ip>
35
35
36
36
## Configuring a Domain Name
37
37
38
-
In most cases, you'll want to associate a domain name to your website.
38
+
In most cases, you'll want to associate a domain name with your website.
39
39
If you don't own a domain name yet, you'll have to buy one through a registrar.
40
40
Use [this affiliate link](https://gandi.link/f/93650337) to redeem a 20% discount at Gandi.net.
41
41
@@ -51,14 +51,14 @@ Example in Gandi's UI:
51
51
52
52

53
53
54
-
Note: Let's Encrypt, the service used by default by API Platform to automatically generate a TLS certificate doesn't support using bare IP addresses.
54
+
Note: Let's Encrypt, the service used by default by API Platform to automatically generate a TLS certificate, doesn't support using bare IP addresses.
55
55
Using a domain name is mandatory to use Let's Encrypt.
56
56
57
57
## Deploying
58
58
59
-
Copy your project on the server using `git clone`, `scp` or any other tool that may fit your need.
59
+
Copy your project on the server using `git clone`, `scp` or any other tool that may fit your needs.
60
60
If you use GitHub, you may want to use [a deploy key](https://docs.github.com/en/developers/overview/managing-deploy-keys#deploy-keys).
61
-
Deploy keys are also [supported by GitLab](https://docs.gitlab.com/ee/user/project/deploy_keys/).
61
+
Deploy keys are also [supported by GitLab](https://docs.gitlab.com/ee/user/project/deploy_keys/).
62
62
63
63
Example with Git:
64
64
@@ -71,27 +71,18 @@ Go into the directory containing your project (`<project-name>`), and start the
71
71
```console
72
72
SERVER_NAME=your-domain-name.example.com \
73
73
APP_SECRET=ChangeMe \
74
+
POSTGRES_PASSWORD=ChangeMe \
74
75
CADDY_MERCURE_JWT_SECRET=ChangeMe \
75
76
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
76
77
```
77
78
78
-
Be sure to replace `your-domain-name.example.com`by your actual domain name and to set the values of `APP_SECRET`, `CADDY_MERCURE_JWT_SECRET` to cryptographically secure random values.
79
+
Be sure to replace `your-domain-name.example.com`with your actual domain name and to set the values of `APP_SECRET`, `CADDY_MERCURE_JWT_SECRET` to cryptographically secure random values.
79
80
80
81
Your server is up and running, and a Let's Encrypt HTTPS certificate has been automatically generated for you.
81
82
Go to `https://your-domain-name.example.com` and enjoy!
82
83
83
-
## Disabling HTTPS
84
-
85
-
Alternatively, if you don't want to expose an HTTPS server but only an HTTP one, run the following command:
86
-
87
-
```console
88
-
SERVER_NAME=:80 \
89
-
APP_SECRET=ChangeMe \
90
-
CADDY_MERCURE_JWT_SECRET=ChangeMe \
91
-
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
92
-
```
93
-
94
84
## Deploying on Multiple Nodes
95
85
96
-
If you want to deploy your app on a cluster of machines, you can use [Docker Swarm](https://docs.docker.com/engine/swarm/stack-deploy/),
86
+
If you want to deploy your app on a cluster of machines, we recommend using [Kubernetes](kubernetes.md).
87
+
You can use [Docker Swarm](https://docs.docker.com/engine/swarm/stack-deploy/),
97
88
which is compatible with the provided Compose files.
0 commit comments