-
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
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.
Extended the node creation and update routes to support a defaultStorage field. Also simplified domain selection in image build logic and removed unused Dockerfile build arguments.
runleveldev
left a comment
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.
LGTM
Changed the command path in the ScheduledJobs seeder to use 'node bin/oci-build-push-pull.js' instead of 'node create-a-container/bin/oci-build-push-pull.js' for correct execution context.
| const registry = opts.registry || process.env.LOCAL_REGISTRY || 'localhost:5000'; | ||
| const repoBase = opts.repoBase || process.env.OCI_REPO || 'opensource-server'; | ||
| const buildContext = opts.buildContext || process.env.BUILD_CONTEXT || '/opt/opensource-server'; | ||
| const dockerfilePath = opts.dockerfilePath || process.env.DOCKERFILE_PATH || '/opt/opensource-server/templates/debian.Dockerfile'; |
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 should default to /opt/opensource-server/create-a-container/templates/debian.Dockerfile
Changed the default dockerfilePath to point to the correct location under create-a-container/templates/debian.Dockerfile. This ensures the build script uses the intended Dockerfile by default.
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.