Skip to content
Snippets Groups Projects
Commit ea3456a7 authored by jurgenhaas's avatar jurgenhaas
Browse files

Update documentation on how to use SSL with L3D projects

parent 1db48199
No related branches found
No related tags found
No related merge requests found
Pipeline #1133457 failed
......@@ -155,11 +155,48 @@ achieved over a VPN.
### Working with SSL
#### Specify and configure your dev-domain
For this documentation we work with the domain `username.company.dev` and this will be used as a wildcard domain, so that for each project you're working on, a sub-domain suffix will be added, e.g. `shop.username.company.dev` or `customer14.username.company.dev`.
For this documentation we work with the domain `username.company.dev` and this will be used as wildcard, so that for each project you're working on a sub-domain suffix will be added, e.g. `shop.username.company.dev` or `customer14.username.company.dev`.
To tell Docker, Traefik and L3D, that this domain should be used with SSL, add these environment variables to your `~/.env` file:
#### Issue a wildcard SSL certificate
```bash
DOCKER4DRUPAL_TRAEFIK_DOMAIN=username.company.dev
DOCKER4DRUPAL_TRAEFIK_USESSL=1
DOCKER4DRUPAL_TRAEFIK_PORT=80
DOCKER4DRUPAL_TRAEFIK_PORTS=443
```
Last but not least, your local DNS needs to be configured, so your browser knows, that `*.username.company.dev` can be found at `127.0.0.1`. If you have a DNS resolver, that can handle wildcards, then that's what you should go for. If you don't have one, or if you don't know, then you need to edit `/etc/hosts` and add a line like this:
```
127.0.0.1 shop.username.company.dev customer14.username.company.dev
```
Unfortunately, for each new project you have to add the new domain to that list before the browser can find it.
#### Getting SSL certificates
This is the final component and there are 2 supported options: automatic or manual.
After one of the 2 methods got setup,go to one of your projects in L3D and call `ahoy traefik rewrite` to get everything setup once and forever.
##### Automatic
This is possible, if your domain registrar or DNS provider offers an API that LetsEncrypt can use. If not, then you have to gop for the manual approach below.
Define an A-record for `*.username.company.dev` with an IP address that probably points to the company website. Then, create an API token with the DNS provider and configure additional variables in `~/.env`, here with an example for CloudFlare as the DNS provider:
```
DOCKER4DRUPAL_TRAEFIK_DNS_CHALLENGE=1
DOCKER4DRUPAL_TRAEFIK_DNS_CHALLENGE_PROVIDER=cloudflare
DOCKER4DRUPAL_TRAEFIK_DNS_CHALLENGE_RESOLVER=andy.ns.cloudflare.com:53,zoe.ns.cloudflare.com:53
DOCKER4DRUPAL_TRAEFIK_ENV_1=CF_DNS_API_TOKEN:...your token...
DOCKER4DRUPAL_TRAEFIK_ENV_2=0
```
With this configuration, Traefik will generate SSL certificates for all your projects automatically in the background.
##### Manual
For this you have to install a LetsEncrypt client. We recommend [Certbot](https://certbot.eff.org). Then you can issue a wildcard certificate with the following command:
......@@ -171,22 +208,14 @@ sudo chmod +r ~/.traefik/certs/*.pem
You will be presented with a request to configure a TXT record on your DNS provider. Once you're done that, certbot will issue the SSL certificate for you and you're good to go. Note: you have to renew the certificate every 3 months by using the same commands again.
#### Configure Traefik to use your SSL certificate
Add the following line to your `.env` file in your user's home directory:
```bash
DOCKER4DRUPAL_TRAEFIK_DOMAIN=username.company.dev
DOCKER4DRUPAL_TRAEFIK_USESSL=1
DOCKER4DRUPAL_TRAEFIK_PORT=80
DOCKER4DRUPAL_TRAEFIK_PORTS=443
DOCKER4DRUPAL_TRAEFIK_CERT=fullchain.pem
DOCKER4DRUPAL_TRAEFIK_KEY=privkey.pem
```
To update your Traefik configuration and restart the service, go to one of your
projects in L3D and call `ahoy traefik rewrite` to get everything setup once and
forever.
Note: every 2 months you will have to renew the SSL cert with LetsEncrypt by calling `certbot renew` and then copying the new cert files into the same directory ad described above and then restart Traefik.
## Using XDebug
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment