The tracker now runs on stppriv behind Cloudflare Access. The userscript points at priv.adam-french.co.uk and migrates a saved www base, since www only 301s now (which drops a POST). CI publishes the image but no longer rolls stpvm's stack; stppriv is deployed by hand. Merge only at cutover, once priv.adam-french.co.uk/jobs/ is live. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Job tracker
A private tracker for job applications, served at /jobs/ on adam-french.co.uk. It has four main areas:
- Applications (
/jobs/): the list, the pipeline view and the Quick Reference snippets. - Dashboard (
/jobs/dashboard): funnel counts, conversion rates and time-to-milestone metrics. - Leads inbox (
/jobs/leads): postings the server finds on Greenhouse, Lever and Ashby boards and in Adzuna and Reed searches, scored by Claude against a search profile. - Capture userscript (
web/public/job-capture.user.js): adds the posting open in the browser.
Applications include explicit follow-up dates, contacts, activity history and structured posting metadata. The leads inbox supports filtering and bulk dismiss, restore and tracking actions.
It was split out of the web_server repo, where it lived inside the site's Go backend, Python service and Vue app. It is now one Go binary that serves its own Vue SPA. It runs as one container behind the site's nginx and borrows the site's login.
Layout
cmd/jobtracker/ main: reads the environment, wires everything, registers routes
internal/auth/ is this request the admin? (asks the site backend)
internal/claude/ the two Claude calls: read a posting, score a lead
internal/graph/ gqlgen GraphQL: schema/*.graphql is the source of truth
internal/handlers/ REST: capture routes, capture token, SPA file server
internal/models/ GORM models (six tables)
internal/services/ lead pipeline, job sources, upsert, status vocabulary
web/ Vue 3 + Vite SPA, built for base /jobs/
Routes
Everything is served under BASE_PATH (/jobs). nginx proxies the prefix through unchanged.
| Path | Auth | What |
|---|---|---|
/jobs/, /jobs/dashboard, /jobs/leads, /jobs/settings |
none (the data behind them is admin-only) | SPA |
POST /jobs/api/graphql |
@admin on every field |
everything the pages show and edit |
/jobs/api/capture, /capture/status, /capture/extract |
bearer capture token | the userscript |
/jobs/api/admin/capture-token (GET/POST/DELETE) |
admin | the token, from the Settings page |
GET /jobs/api/health |
open | healthcheck: process up and database reachable |
Auth
There are no accounts here. internal/auth forwards the browser's Cookie header to the site backend's GET /auth/validate-admin, which is the same check nginx uses for /radio/admin and /sb, and treats a 2xx as "admin".
- Expired access token:
validate-adminfalls back to the refresh token and answers with new cookies. ThoseSet-Cookieheaders are relayed to the browser. - Caching: a "yes" is cached for 30 seconds per cookie, so logging out takes up to 30 seconds to reach the tracker.
- Lapsed session: the SPA sends the browser to the site's
/admin/login?redirect=/jobs/...(web/src/session.js).
AUTH_MODE=access is for running behind Cloudflare Access (stppriv, priv.<site>/jobs/), where the site's cookie is not sent. It verifies the Cf-Access-Jwt-Assertion header (or the CF_Authorization cookie) as an RS256 JWT against https://$ACCESS_TEAM_DOMAIN/cdn-cgi/access/certs, with issuer https://$ACCESS_TEAM_DOMAIN and audience $ACCESS_AUD. Keys are cached for an hour. A lapsed session still sends the SPA to /admin/login, which stppriv serves as a "log in again" page.
AUTH_MODE=dev admits everyone, for the standalone compose. It is refused unless DEV_MODE=true.
Development
make check # go vet + go test, and a vite build
make generate # after editing internal/graph/schema/*.graphql
make dev # docker compose up --build: tracker + Postgres, seeded, no login
Then open http://localhost:8080/jobs/. Set CLAUDE_API_KEY in your shell or a .env to try the Claude features.
For SPA hot reload, run make dev (or the Go binary) and then cd web && npm run dev. Vite proxies /jobs/api to localhost:8080; see web/vite.config.js.
Every variable is listed and explained in .env.example.
Running inside web_server
The site's docker-compose.yml runs the published image as service jobs, with an explicit environment: list rather than env_file, so the site's other secrets stay out of the container. The site's nginx routes /jobs/ to it. The site's Postgres container holds the data, in its own jobs database and role. ./jobs-data is mounted at /data; the container runs as uid 1000, so chown 1000 jobs-data on the host.
Deploying
A push to main here runs .gitea/workflows/ci.yaml. It tests, builds and pushes adam-french.co.uk/adamf/job-tracker:<sha> and :latest. It does not deploy: the tracker runs on stppriv (priv.<site>/jobs/), which is deployed by hand:
cd ~/deploy/stppriv && docker compose pull jobs && docker compose up -d jobs
To pin a version, set JOBS_IMAGE_TAG=<sha> in stppriv's .env. To roll back, pin the last good sha.
One-off: registry setup
The image lives in this Gitea's container registry. Two things make that less simple than it sounds:
- Docker always talks to
/v2/at the root of the host, whatever Gitea'sROOT_URLsays (/gitea/). - Gitea advertises its token endpoint at
https://adam-french.co.uk/v2/token, on the apex domain. The site redirects the apex towww.
So the apex server block in web_server's nginx/nginx.conf.template proxies /v2/ to Gitea and redirects everything else. That was added in web_server commit da2ab9f.
-
Check Gitea's registry is on. On stpvm, straight to the Gitea LXC (the name is pinned to its LAN IP in /etc/hosts):
curl -si http://git.adam-french.co.uk:3000/v2/ | head -5You want a
401withWww-Authenticate: Bearer realm="https://adam-french.co.uk/v2/token". A404means packages are off: add[packages]withENABLED = trueto Gitea'sapp.ini.templateand recreate Gitea. -
Check nginx routes it.
curl -si https://adam-french.co.uk/v2/should give the same401, not a301towww. If you are setting up a fresh site, the route to copy islocation /v2/in the apexserverblock ofnginx/nginx.conf.template. -
Make a token. In Gitea, go to Settings → Applications and create a token with package: read and write.
-
Round trip a throwaway image on the host:
docker login adam-french.co.uk -u adamf # the token is the password docker pull alpine:3.22 docker tag alpine:3.22 adam-french.co.uk/adamf/registry-test:1 docker push adam-french.co.uk/adamf/registry-test:1 docker rmi adam-french.co.uk/adamf/registry-test:1 docker pull adam-french.co.uk/adamf/registry-test:1Delete the test package afterwards, from your profile → Packages → registry-test → Settings. If the push fails, the error says where:
unauthorized: the token's scope is wrong, orhttps://adam-french.co.uk/v2/tokenisn't reaching Gitea (it should answer401or JSON, not a301).413: theclient_max_body_size 0line isn't in effect.- HTML, a redirect, or "invalid character '<'":
/v2/is not reaching Gitea.
-
Give CI the credentials. In this repo's Settings → Actions → Secrets, add
REGISTRY_USER(adamf) andREGISTRY_TOKEN(the token). The next push tomainpublishes the image.
The host also has to be logged in to pull the image. The docker login in step 4 covers that; it is stored in that user's ~/.docker/config.json.
One-off cutover from the old in-backend tracker
This was written while the tracker still had its email pipeline. Steps 4 and 5's Microsoft Graph parts (msgraph_token.json, the Entra redirect URI) no longer apply.
Do the registry setup above first: step 6 needs the image.
Run these on the host, in this order:
- Stop the old schedulers. On the old backend, set
EMAIL_SYNC_ENABLED=falseandJOB_LEADS_ENABLED=false, so mail and boards are never processed twice. - Create the database and role. Use the values you put in the site's
.envasPOSTGRES_JOBS_USER,POSTGRES_JOBS_PASSWORDandPOSTGRES_JOBS_DB:docker exec db psql -U "$POSTGRES_USER" -d "$POSTGRES_DB" \ -c "CREATE ROLE jobs LOGIN PASSWORD '…'" -c "CREATE DATABASE jobs OWNER jobs" - Copy the six tables, with their schema and sequences. AutoMigrate then finds nothing to do:
Then compare
docker exec db pg_dump -U "$POSTGRES_USER" -d "$POSTGRES_DB" --no-owner --no-privileges \ -t job_applications -t job_app_references -t processed_emails \ -t job_sources -t job_leads -t job_search_profiles \ | docker exec -i db psql -U jobs -d jobs -v ON_ERROR_STOP=1SELECT count(*)on each table in the two databases. - Move the token files:
mkdir -p jobs-data cp backend/token/msgraph_token.json backend/token/job_capture_token.json jobs-data/ sudo chown -R 1000:1000 jobs-data - Point Microsoft at the new callback. In the Entra app registration, add the redirect URI
https://adam-french.co.uk/jobs/api/email/callback, and setMSGRAPH_REDIRECT_URIto the same value. - Deploy and check. Deploy
web_serverwith thejobsservice and routes, then re-enable the two schedulers, now read byjobs. Check:- the tracker loads
- "Check now" on Leads works
- "Sync now" on Settings works
- a capture from a real posting appears in the tracker
The old tables stay in the site database until they are dropped by hand. GORM never drops anything, so this is safe until you are sure.
The email pipeline (removed)
The tracker used to read the mailbox (Microsoft Graph or IMAP), have Claude classify recruitment mail, and create or advance applications. It was taken out while it is not in use. The last commit that has it is tagged email-pipeline-last; reverting the commit that removed it brings it back.
Its processed_emails table is still migrated and still holds its history, so a restored pipeline does not process old mail again. Once the removal is deployed, the EMAIL_*, MSGRAPH_* and IMAP_* variables can come out of the site's jobs service, and msgraph_token.json out of jobs-data.
Things that are easy to get wrong
- The status vocabulary has copies.
enum JobStatus(GraphQL) andservices.statusOrderare tied by a test. Two copies are not checked and must be edited by hand:web/src/views/jobStatus.jsandSTATUS_LABELSin the userscript. - Bump the userscript's
@versionon every edit, or installed copies never update. BASE_PATHand Vite'sbasemust agree. The SPA's asset URLs and router base are fixed at build time.