Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ To test top-ups on staging, add a sandbox `MERCURY_WRITE_TOKEN` with batting's p

| Item | Value |
|---|---|
| URL | `https://selvage.patchworklabs.org` (router `selvage-twill` in `edge-alastor`). nginx on twill passes only `POST /slack/*` and `GET /up`. Every other path is 404. |
| URL | `https://selvage.patchworklabs.org` (router `selvage-twill` in `edge-alastor`). nginx on twill passes `POST /slack/*`, `GET /up`, and the moderator web UI under `/admin`, `/auth/`, `/assets/` and `/cable`. The app checks the weave role on every `/admin` request. Every other path is 404. |
| Units | `selvage-web` (`./bin/rails db:migrate` in a one-off container, then `./bin/rails server` on `127.0.0.1:3009`) and `selvage-worker` (`bundle exec good_job start`, on the web container's image) |
| Image | `ghcr.io/patchworklabsorg/selvage:main` (option `image`). Pin it to `:<sha>` for a known build. |
| Databases | `patchwork_central` on skein and `patchwork_central_restricted` on seam. Role and schema `selvage` in each. |
Expand Down
3 changes: 2 additions & 1 deletion hosts/alastor/edge.nix
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ let
hosts = [ "stash-staging.patchworklabs.org" ];
};
# Selvage on twill (../twill/selvage.nix): production only. nginx on
# twill passes only /slack/ and /up.
# twill passes /slack/, /up, and the admin web UI (/admin, /auth/,
# /assets/, /cable).
selvage-twill = {
backend = "twill";
hosts = [ "selvage.patchworklabs.org" ];
Expand Down
25 changes: 24 additions & 1 deletion hosts/twill/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,37 @@
}
];
# Slack calls the three request URLs under /slack/ (POST only), and
# the health check is GET /up. Nothing else of the app is public.
# the health check is GET /up. The moderator web UI lives under
# /admin, its weave login under /auth, its assets under /assets, and its
# live updates on /cable.
# The app checks the weave role on every /admin request. Nothing else
# of the app is public.
locations."/slack/" = {
proxyPass = upstream;
extraConfig = ''
limit_except POST { deny all; }
'';
};
locations."= /up".proxyPass = upstream;
locations."= /admin".proxyPass = upstream;
locations."/admin/".proxyPass = upstream;
locations."/auth/".proxyPass = upstream;
locations."/assets/".proxyPass = upstream;
# Turbo Streams for live updates in the admin UI (Action Cable).
# proxyWebsockets sets proxy_set_header in this location, and nginx then
# drops the http-level ones here, so set them again. Action Cable checks
# the Origin against the Host.
locations."= /cable" = {
proxyPass = upstream;
proxyWebsockets = true;
extraConfig = ''
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
proxy_set_header X-Forwarded-Host $host;
'';
};
locations."/".return = "404";
};
};
Expand Down
Loading