Skip to content

Commit 9a7582b

Browse files
authored
Improve Docker Compose docs (#1790)
1 parent 97991a8 commit 9a7582b

File tree

2 files changed

+30
-11
lines changed

2 files changed

+30
-11
lines changed

deployment/docker-compose.md

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ This will provision an Ubuntu server with the latest versions of Docker and Dock
2121

2222
For test purposes, cheapest plans will be enough, even though you might want at least 2GB of RAM to execute Docker Compose for the first time. For real production usage, you'll probably want to pick a plan in the "general purpose" section that will fit your needs.
2323

24-
![Deploying a Symfony app on DigitalOcean with Docker Compose](images/digitalocean-droplet.png)
24+
![Deploying an API Platform project on DigitalOcean with Docker Compose](images/digitalocean-droplet.png)
2525

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.
2828

2929
Then, wait a few seconds while your Droplet is provisioning.
3030
When your Droplet is ready, use SSH to connect:
@@ -35,9 +35,8 @@ ssh root@<droplet-ip>
3535

3636
## Configuring a Domain Name
3737

38-
In most cases, you'll want to associate a domain name with your website.
38+
In most cases, you'll want to associate a domain name to your website.
3939
If you don't own a domain name yet, you'll have to buy one through a registrar.
40-
Use [this affiliate link](https://gandi.link/f/93650337) to redeem a 20% discount at Gandi.net.
4140

4241
Then create a DNS record of type `A` for your domain name pointing to the IP address of your server.
4342

@@ -47,10 +46,6 @@ Example:
4746
your-domain-name.example.com. IN A 207.154.233.113
4847
````
4948
50-
Example in Gandi's UI:
51-
52-
![Creating a DNS record at Gandi.net](images/gandi-dns.png)
53-
5449
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.
5550
Using a domain name is mandatory to use Let's Encrypt.
5651
@@ -72,17 +67,41 @@ Go into the directory containing your project (`<project-name>`), and start the
7267
SERVER_NAME=your-domain-name.example.com \
7368
APP_SECRET=ChangeMe \
7469
POSTGRES_PASSWORD=ChangeMe \
75-
CADDY_MERCURE_JWT_SECRET=ChangeMe \
70+
CADDY_MERCURE_JWT_SECRET=ChangeThisMercureHubJWTSecretKey \
7671
docker compose -f docker-compose.yml -f docker-compose.prod.yml up --wait
7772
```
7873

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.
74+
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.
8075

8176
Your server is up and running, and a Let's Encrypt HTTPS certificate has been automatically generated for you.
8277
Go to `https://your-domain-name.example.com` and enjoy!
8378

79+
## Disabling HTTPS
80+
81+
Alternatively, if you don't want to expose an HTTPS server but only an HTTP one, run the following command:
82+
83+
```console
84+
SERVER_NAME=:80 \
85+
APP_SECRET=ChangeMe \
86+
CADDY_MERCURE_JWT_SECRET=ChangeThisMercureHubJWTSecretKey \
87+
docker compose -f docker-compose.yml -f docker-compose.prod.yml up --wait
88+
```
89+
8490
## Deploying on Multiple Nodes
8591

8692
If you want to deploy your app on a cluster of machines, we recommend using [Kubernetes](kubernetes.md).
8793
You can use [Docker Swarm](https://docs.docker.com/engine/swarm/stack-deploy/),
8894
which is compatible with the provided Compose files.
95+
96+
## Configuring a Load Balancer or a Reverse Proxy
97+
98+
Since Caddy 2.5, XFF values of incoming requests will be ignored to prevent spoofing.
99+
So if Caddy is not the first server being connected to by your clients (for example when a CDN is in front of Caddy), you may configure `trusted_proxies` with a list of IP ranges (CIDRs) from which incoming requests are trusted to have sent good values for these headers.
100+
As a shortcut, `private_ranges` may be configured to trust all private IP ranges.
101+
102+
```diff
103+
-php_fastcgi unix//var/run/php/php-fpm.sock
104+
+php_fastcgi unix//var/run/php/php-fpm.sock {
105+
+ trusted_proxies private_ranges
106+
+}
107+
```

deployment/images/gandi-dns.png

-139 KB
Binary file not shown.

0 commit comments

Comments
 (0)