Run the job tracker as its own container at /jobs/
The tracker (applications, leads, email pipeline, capture userscript) now lives in the adamf/job-tracker repo and runs here from its published image. - docker-compose.yml: a `jobs` service with an explicit environment list (its own database role; none of the site's other secrets), ./jobs-data mounted at /data, and nginx waiting for it. The dev override seeds it. - nginx: /jobs/ proxied to it with the prefix kept, and 301s from /cv/jobs, /cv/leads and the old userscript URL. - env_registry.json and .env.example: the email and job-lead variables now belong to the jobs service; CLAUDE_* to python and jobs; new POSTGRES_JOBS_* and JOBS_IMAGE_TAG. The compose environment test now checks the jobs service's list as well as python's. - backend: no longer starts the email and job-lead schedulers or serves the capture and email routes, since the tracker reads the same settings and would otherwise process everything twice. The old job code stays until the tracker has run for a while. - vue: the CV page's Jobs button goes to /jobs/; the old routes are gone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
+9
-18
@@ -1,7 +1,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
@@ -203,12 +202,11 @@ func main() {
|
||||
protected := r.Group("/", store.AuthMiddlewear)
|
||||
admin := r.Group("/", store.AuthMiddlewear, store.AdminMiddleware)
|
||||
|
||||
// JOB CAPTURE: called by the browser userscript from other origins, so
|
||||
// these authenticate with a bearer token instead of the session cookies.
|
||||
capture := r.Group("/jobs/capture", store.CaptureTokenMiddleware)
|
||||
capture.GET("/status", store.JobCaptureStatus)
|
||||
capture.POST("/extract", store.JobCaptureExtract)
|
||||
capture.POST("", store.JobCapture)
|
||||
// JOB CAPTURE and EMAIL SYNC routes moved to the job tracker app
|
||||
// (adamf/job-tracker, served at /jobs/). They are no longer registered
|
||||
// here, so an old userscript gets a 404 instead of writing into tables
|
||||
// the tracker no longer reads. The handlers are deleted in a later
|
||||
// commit, once the tracker has run for a while.
|
||||
|
||||
// ROWING
|
||||
r.GET("/rowing", store.GetRowing)
|
||||
@@ -221,10 +219,6 @@ func main() {
|
||||
r.POST("/auth/logout", store.Logout)
|
||||
r.GET("/auth/validate-admin", store.ValidateAdmin)
|
||||
|
||||
// EMAIL SYNC
|
||||
r.GET("/email/callback", store.CompleteEmailAuth)
|
||||
admin.POST("/email/sync", store.TriggerEmailSync)
|
||||
|
||||
// SPOTIFY
|
||||
// The callback must be open — Spotify redirects a logged-out browser to
|
||||
// it — and is protected by the state nonce instead. Starting the flow is
|
||||
@@ -314,13 +308,10 @@ func main() {
|
||||
c.JSON(200, gin.H{"message": "Hello World"})
|
||||
})
|
||||
|
||||
// The scheduler runs until ctx is cancelled, which in practice only
|
||||
// happens if r.Run returns — there is no signal handling or graceful
|
||||
// shutdown, so the container is simply killed.
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
go store.EmailSync.StartScheduler(ctx)
|
||||
go store.JobLeads.StartScheduler(ctx)
|
||||
// The email sync and job-lead schedulers are NOT started: the job tracker
|
||||
// runs them now, and it reads the same EMAIL_SYNC_ENABLED and
|
||||
// JOB_LEADS_ENABLED from .env, so starting them here as well would
|
||||
// process every email and board twice.
|
||||
|
||||
port := os.Getenv("BACKEND_PORT")
|
||||
// Blocks until the server stops. Any return is a failure — a port clash,
|
||||
|
||||
Reference in New Issue
Block a user