Skip to content

control pgboss jobs via sndev cli #2172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Soxasora
Copy link
Member

Description

Introduces a way to manually interact with pgboss jobs without using SQL or external db management apps.
The need for a script like this has been assessed after trying to test custom domains (#2145) worker, which is largely based on its handling of subsequent verifications via pgboss.

cli

sndev pgboss

Control pgboss jobs.

USAGE
  $ sndev pgboss [COMMAND]

COMMANDS
  add        <name>  [flags] [data]  Add a job
  edit       <jobId> [flags] [data]  Edit a job
  remove     <jobId>                 Remove a job
  remove-all <name>                  Remove all jobs of a given name
  details    <jobId>                 Show details of a job
  list       <name>                  List jobs

FLAGS
  -h|--help             Show this help message

FLAGS: add/edit
  -s|--startafter       Start the job after given SECONDS
  -r|--retrylimit       Set the number of retries on thrown errors
  -d|--retrydelay       Set the delay between retries in SECONDS
  -b|--retrybackoff     Enable pgboss exponential backoff between retries
  -k|--keepuntil        Keep the job until a given date in SECONDS

EXAMPLES
  $ sndev pgboss add jobname "{\"id\": \"test\"}"
  $ sndev pgboss edit jobId "{\"id\": \"test\"}"
  $ sndev pgboss remove jobId
  $ sndev pgboss remove-all jobname
  $ sndev pgboss list jobname

sndev pgboss add domainVerification -s 60

Created job with ID:  359f7a3f-3b02-4856-8866-8e9ab3270c8a
Job name: domainVerification
Start after: 2025-05-19 13:56:33.581531403

sndev pgboss list domainVerification

Latest 10 jobs with name: domainVerification
                  job_list                  
--------------------------------------------
 ID: 359f7a3f-3b02-4856-8866-8e9ab3270c8a  +
 Name: domainVerification                  +
 Created: 2025-05-19 18:55:33.69006+00     +
 Start After: 2025-05-19 13:56:33.581531+00+
 Retry Limit: 0                            +
 Retry Delay: 0                            +
 Retry Backoff: No                         +
 Keep Until: 2025-06-02 18:55:33.69006+00  +
 
(1 row)

sndev pgboss remove-all domainVerification
Deleted all jobs with name: domainVerification

Additional Context

For custom domains, there will be a wrapper for this command that would automatically apply jobs such as domainVerification, 'clearLongHeldDomains and deleteCertificate

Checklist

Are your changes backwards compatible? Please answer below:
tbd

On a scale of 1-10 how well and how have you QA'd this change and any features it might affect? Please answer below:
tbd

For frontend changes: Tested on mobile, light and dark mode? Please answer below:
n/a

Did you introduce any new environment variables? If so, call them out explicitly here:
n/a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant