-
Notifications
You must be signed in to change notification settings - Fork 3
Add scheduled job support and OCI image pull job #147
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
base: main
Are you sure you want to change the base?
Conversation
Introduces ScheduledJob model, migrations, and seeder for cron-based job scheduling. Updates job-runner to process scheduled jobs and create pending jobs when schedule conditions are met. Adds support for defaultStorage on nodes, including migration, model, and form update. Implements oci-build-job utility to pull OCI container images to Proxmox nodes using API credentials and storage configuration.
Scheduled Jobs / OCI Image Pull IntegrationSummary
Why
Files Changed (High-Level)Migrations
Models
Seeders
Job Runner
Utils
UI
package.json
Architecture Diagram (Mermaid)graph LR
A[ScheduledJobs] -->|"evaluated by"| B[Job Runner]
B -->|"on match"| C[Jobs (pending)]
C -->|"claimed by"| D[Runner Execution]
D -->|"executes"| E[OCI Build Job Script]
E -->|"uses"| F[Node Model (apiUrl, token, defaultStorage)]
Implementation Notes (Concise)ScheduledJobs Table Columns
Job Runner:
|
create-a-container/seeders/20251203000000-seed-oci-build-job.js
Outdated
Show resolved
Hide resolved
|
|
||
| <div class="mb-3"> | ||
| <label for="defaultStorage" class="form-label">Default Storage</label> | ||
| <input |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has the router been updated to handle this input?
Introduces a script to build and push site-specific OCI images using Docker, a seeder to schedule this job, and a Debian Dockerfile template. Updates oci-build-job.js to prefer LOCAL_REGISTRY for image registry. The README is updated to reference the local registry in example commands.
Replaces separate oci-build-job and build-push-oci scripts with a single oci-build-push-pull job that builds, pushes, and pulls OCI images for all sites and nodes. Updates scheduled job seeders to use the new script and introduces shared Proxmox utilities for task polling and image pulling. Old scripts and their references are removed or deprecated for migration rollback support.
create-a-container/seeders/20251204000000-seed-build-push-oci.js
Outdated
Show resolved
Hide resolved
Moved and consolidated the OCI build/push/pull logic into the bin/oci-build-push-pull.js file, removing the old utils/oci-build-push-pull.js and proxmox-utils.js modules. Updated the Dockerfile template to use Proxmox's minimal LXC rootfs for more accurate OCI images. Improved CLI argument parsing and Proxmox API utilities for image pulling and storage selection. Updated README to use ghcr.io for container pulls. Removed obsolete seeder for build-push-oci job.
| * Reads environment variables to determine registry and image tags. | ||
| * @returns {Array<{name: string, registry: string, image: string, tag: string}>} List of pre-built image specifications | ||
| */ | ||
| // No pre-built images are used; we only operate on site-built images. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment + the JSDoc comment above refer to a now non-existent function. Please remove them
| * @throws {Error} If docker build or push fails | ||
| */ | ||
| async function buildAndPushImageForSite(site, registry, repoBase, buildContext, dockerfilePath, tagSuffix = 'latest') { | ||
| const domain = site.internalDomain || site.domain || site.name || `site-${site.id}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why my previous comment on this line was marked outdated, but it stands. site.internalDomain is guaranteed defined and not null due to the database schema so these fallbacks are unnessecary.
| && /usr/local/bin/pown.sh "$DOMAIN" | ||
| # Optional: allow customizations at build-time (example: run site installer) | ||
| ARG DOMAIN | ||
| RUN true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need this part (the ARG and the RUN) since pown.sh is running above. We can stop this Dockerfile after the COPY
Introduces ScheduledJob model, migrations, and seeder for cron-based job scheduling. Updates job-runner to process scheduled jobs and create pending jobs when schedule conditions are met. Adds support for defaultStorage on nodes, including migration, model, and form update. Implements oci-build-job utility to pull OCI container images to Proxmox nodes using API credentials and storage configuration.