Builds on #30782, which is merged; the branch now merges `main`. Adds `Coder.LatinAbbreviations`, a Vale rule that enforces [Latin abbreviations](https://github.com/coder/coder/blob/main/docs/.style/style-guide/accessibility-and-inclusion.md#latin-abbreviations). - Suggests "for example", "that is", and "and so on" for `e.g.`, `i.e.`, and `etc.`, including `eg.`, `ie.`, and a missing final period (`e.g`). - Severity: `suggestion`. Scope: `docs/**` except `docs/.style/style-guide/**`, limited to paragraphs, lists, headings, and blockquotes. Table cells and code are skipped. - Baseline: 170 findings in 91 files. The brief estimated 148. - Cleanup: 153 findings fixed across 81 hand-written pages, 0 left in linted pages. The count is lower than the original 158 because other PRs on `main` already rewrote or removed some of the lines, and `parameters.md` was deleted on `main`. - `vs.` and `et al.` aren't flagged. Commits: 1. `docs(docs): use English forms of Latin abbreviations` 2. `feat(docs/.style): enable Coder.LatinAbbreviations Vale rule` Generated pages: `.vale.ini` skips `docs/reference/{api,cli}/*.md` and `docs/admin/setup/configuration-reference.md` for this rule, as it does for `Coder.UnitSpacing`. Their prose comes from CLI flag help text and Swagger comments in Go source, and `make gen` rewrites them, so a hand edit fails the `gen` check (an earlier revision of this PR edited `configuration-reference.md` and failed `gen` for that reason). Cleaning them means editing Go and regenerating the help golden files and API docs, which is left for a follow-up. Linear: DOCS-450 <details> <summary>Decision log</summary> - `extends: substitution`, so the message names the replacement: "Consider 'for example' instead of 'e.g.'". - `scope: [paragraph, list, heading, blockquote]`. The single scope `paragraph` skips list items, blockquotes, and headings, so all four are listed. Table cells have their own scope and stay excluded. - Explicit `[Ee]` and `[Ii]` classes with `ignorecase: false`, so sentence-initial `E.g.,` still matches but the browser name `IE.` doesn't. - `eg.` and `ie.` require the trailing period so ordinary words and file extensions stay quiet. - Cleanup rules, applied by script and then reviewed line by line: - `e.g.` and `i.e.` become "for example," and "that is," (capitalized at the start of a sentence), with a comma added when the original had none. - `etc.` becomes "and so on", with the sentence-ending period kept when `etc.` closed the sentence. - Lines inside table rows, fenced blocks, and code spans are untouched, so are the style guide and the generated pages. - Hard-wrapped lines keep their wrapping, and CRLF files keep CRLF. - The rest of the Vale output is unchanged: the per-rule counts for every other rule match the pre-cleanup run. Test cases (fixtures under `/tmp/latin-test/`, not committed), run with LF and CRLF line endings: - Flagged (15 each): `e.g.,` in a paragraph, `i.e.,`, `etc.` at the end of a sentence and before a comma, `eg.`, `ie.`, `e.g` and `i.e` without the final period, `E.g.,`, `I.e.,`, `Etc.`, a blockquote, a list item, a numbered item, and a heading. - Not flagged: a table row with `e.g.,`, `i.e.,`, and `etc.`, code spans, a fenced block, "for example", "that is", "and so on", `IE.`, `genre`, `series`, `egg`, `tie`, `etcetera`, `vs.`, `et al.`. - Known edge case: a path-like token such as `path/i.e/x` outside code matches. It doesn't occur in the corpus. Checks: - `vale --output=line docs/`: 0 `Coder.LatinAbbreviations` findings. - `go run ./scripts/styleclaims` passes. - The pre-commit-light hook passes on both commits. </details> *Generated by [Coder Agents](https://coder.com/docs/ai-coder/agents) on behalf of @nickvigilante.*
162 lines
4.4 KiB
Markdown
162 lines
4.4 KiB
Markdown
---
|
|
title: How to use Apache as a reverse proxy with Let's Encrypt
|
|
---
|
|
|
|
## Requirements
|
|
|
|
1. Start a Coder deployment and be sure to set the following [configuration values](../admin/setup/index.md):
|
|
|
|
```dotenv
|
|
CODER_HTTP_ADDRESS=127.0.0.1:3000
|
|
CODER_ACCESS_URL=https://coder.example.com
|
|
CODER_WILDCARD_ACCESS_URL=*coder.example.com
|
|
```
|
|
|
|
Throughout the guide, be sure to replace `coder.example.com` with the domain you intend to use with Coder.
|
|
|
|
2. Configure your DNS provider to point your coder.example.com and `*.coder.example.com` to your server's public IP address.
|
|
|
|
> For example, to use `coder.example.com` as your subdomain, configure `coder.example.com` and `*.coder.example.com` to point to your server's public ip.
|
|
> This can be done by adding A records in your DNS provider's dashboard.
|
|
|
|
3. Install Apache (assuming you're on Debian/Ubuntu):
|
|
|
|
```sh
|
|
sudo apt install apache2
|
|
```
|
|
|
|
4. Enable the following Apache modules:
|
|
|
|
```sh
|
|
sudo a2enmod proxy
|
|
sudo a2enmod proxy_http
|
|
sudo a2enmod ssl
|
|
sudo a2enmod rewrite
|
|
```
|
|
|
|
5. Stop Apache service and disable default site:
|
|
|
|
```sh
|
|
sudo a2dissite 000-default.conf
|
|
sudo systemctl stop apache2
|
|
```
|
|
|
|
## Install and configure LetsEncrypt Certbot
|
|
|
|
1. Install LetsEncrypt Certbot: Refer to the [CertBot documentation](https://certbot.eff.org/instructions?ws=apache&os=ubuntufocal&tab=wildcard).
|
|
Be sure to pick the wildcard tab and select your DNS provider for instructions to install the necessary DNS plugin.
|
|
|
|
## Create DNS provider credentials
|
|
|
|
This example assumes you're using CloudFlare as your DNS provider.
|
|
For other providers, refer to the [CertBot documentation](https://eff-certbot.readthedocs.io/en/stable/using.html#dns-plugins).
|
|
|
|
1. Create an API token for the DNS provider you're using, for example, [CloudFlare](https://developers.cloudflare.com/fundamentals/api/get-started/create-token) with the following permissions:
|
|
|
|
- Zone - DNS - Edit
|
|
|
|
2. Create a file in `.secrets/certbot/cloudflare.ini` with the following content:
|
|
|
|
```ini
|
|
dns_cloudflare_api_token = YOUR_API_TOKEN
|
|
```
|
|
|
|
```sh
|
|
mkdir -p ~/.secrets/certbot
|
|
touch ~/.secrets/certbot/cloudflare.ini
|
|
nano ~/.secrets/certbot/cloudflare.ini
|
|
```
|
|
|
|
3. Set the correct permissions:
|
|
|
|
```sh
|
|
sudo chmod 600 ~/.secrets/certbot/cloudflare.ini
|
|
```
|
|
|
|
## Create the certificate
|
|
|
|
1. Create the wildcard certificate:
|
|
|
|
```sh
|
|
sudo certbot certonly --dns-cloudflare --dns-cloudflare-credentials ~/.secrets/certbot/cloudflare.ini -d coder.example.com -d *.coder.example.com
|
|
```
|
|
|
|
## Configure Apache
|
|
|
|
This example assumes Coder is running locally on `127.0.0.1:3000` and that you're using `coder.example.com` as your subdomain.
|
|
|
|
1. Create Apache configuration for Coder:
|
|
|
|
```sh
|
|
sudo nano /etc/apache2/sites-available/coder.conf
|
|
```
|
|
|
|
2. Add the following content:
|
|
|
|
```apache
|
|
# Redirect HTTP to HTTPS
|
|
<VirtualHost *:80>
|
|
ServerName coder.example.com
|
|
ServerAlias *.coder.example.com
|
|
Redirect permanent / https://coder.example.com/
|
|
</VirtualHost>
|
|
|
|
<VirtualHost *:443>
|
|
ServerName coder.example.com
|
|
ServerAlias *.coder.example.com
|
|
ErrorLog ${APACHE_LOG_DIR}/error.log
|
|
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
|
|
|
ProxyPass / http://127.0.0.1:3000/ upgrade=any # required for websockets
|
|
ProxyPassReverse / http://127.0.0.1:3000/
|
|
ProxyRequests Off
|
|
ProxyPreserveHost On
|
|
|
|
RewriteEngine On
|
|
# Websockets are required for workspace connectivity
|
|
RewriteCond %{HTTP:Connection} Upgrade [NC]
|
|
RewriteCond %{HTTP:Upgrade} websocket [NC]
|
|
RewriteRule /(.*) ws://127.0.0.1:3000/$1 [P,L]
|
|
|
|
SSLCertificateFile /etc/letsencrypt/live/coder.example.com/fullchain.pem
|
|
SSLCertificateKeyFile /etc/letsencrypt/live/coder.example.com/privkey.pem
|
|
</VirtualHost>
|
|
```
|
|
|
|
> Do not forget to change: `coder.example.com` by your (sub)domain
|
|
|
|
3. Enable the site:
|
|
|
|
```sh
|
|
sudo a2ensite coder.conf
|
|
```
|
|
|
|
4. Restart Apache:
|
|
|
|
```sh
|
|
sudo systemctl restart apache2
|
|
```
|
|
|
|
## Refresh certificates automatically
|
|
|
|
1. Create a new file in `/etc/cron.weekly`:
|
|
|
|
```sh
|
|
sudo touch /etc/cron.weekly/certbot
|
|
```
|
|
|
|
2. Make it executable:
|
|
|
|
```sh
|
|
sudo chmod +x /etc/cron.weekly/certbot
|
|
```
|
|
|
|
3. And add this code:
|
|
|
|
```sh
|
|
#!/bin/sh
|
|
sudo certbot renew -q
|
|
```
|
|
|
|
And that's it, you should now be able to access Coder at your sub(domain), for example, `https://coder.example.com`.
|