stevius10/Proxmox-GitOps
Tentang
Framework otomasi IaC untuk container Linux (LXC) di Proxmox VE.
Sistem dan infrastrukturPertumbuhan bintang terukur
- dalam 24 jam
- +1
- dalam 7 hari
- +50
- dalam 15 hari
- +51
- dalam 1 bulan
- +53
Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.
README.md
AsliTable of Contents
Overview
Proxmox-GitOps implements a self-contained GitOps environment for provisioning and orchestrating Linux Containers (LXC) on Proxmox VE.
Encapsulating infrastructure within an extensible monorepository - recursively resolved from Git submodules at runtime - it provides a comprehensive Infrastructure-as-Code (IaC) abstraction for an entire, automated container-based infrastructure.
Architecture
The architecture is based on a multi-stage pipeline capable of recursively deploying and configuring itself as a self-managed control plane.
Initial bootstrapping is performed via a local Docker environment, with subsequent deployments targeting Proxmox VE.
Core Concepts
Proxmox-GitOps standardizes stateless infrastructure and automates container-based deployment on Proxmox VE.
| Concept | Approach | Reasoning |
|---|---|---|
| Desired State | Monorepository as Single Source of Truth represents the entire infrastructure state. | Deterministic bootstrap from code over version history. |
| Self-Containment | The composite monorepository is pushed to a local container, triggering a pipeline that provisions onto Proxmox. | Fully automated infrastructure deployment mirroring local development. |
| Dynamic Configuration | Imperative logic (e.g. config/recipes/repo.rb) used for dynamic, cross-layer state management. |
Declarative approach intractable for dynamic cross-layer changes (e.g. submodule remote rewriting). |
| Monorepository | Centralizes infrastructure as a single code artifact, utilizing submodules for modular composition. | Provides modular container base; dynamically resolved for container-specific workflow control. |
Design
Decoupled Architecture: Containers operate independently, allowing for runtime replacement and detached operation.
Headless Container Configuration: By convention, Ansible is used for provisioning (
community.proxmoxupstream); Cinc (Chef) handles modular, recursive desired-state complexity.Integrated Baseline: The
baserole standardizes container configuration defaults. Proxmox-GitOps leverages this baseline and built-in infrastructure libraries to deploy itself, establishing a reproducible operational pattern to reuse for containerlibs.
Trade-offs
Complexity vs. Autonomy: Self-containment increases complexity to achieve automated bootstrap and reproducible behavior.
Git as State Engine: Uses Git as a state engine rather than for versioning in volatile, stateless contexts. Monorepository representation, however, encapsulates the entire infrastructure as a self-contained asset suited for version control.
Automation vs. API Token Restriction: Since Proxmox VE 9, stricter privilege separation prevents API tokens from creating privileged containers with mounts. Automation capabilities, however, are mainly within the root user context. As a consequence, root user-based API access is used for Proxmox VE authentication.
Usage
Requirements
- Docker
- Proxmox VE 8.4-9.3
- See Getting Started and Wiki for recommendations
Deployment
Set Proxmox VE host, configuration, credentials and default user in
./local/config.json.Ensure centralized environment configuration in
globals.json.Adjust container resource allocation in
container.env.Run
./local/run.shto spin up the local Docker environment.Accept the Pull Request at
http://localhost:8080/main/configto deployProxmox-GitOpson Proxmox VE, from which the deployment of the respective container library can then be triggered in the same way.If
auto.deploy(./local/config.jsonor./local/config.local.json) is set totrue, it will automatically deployProxmox-GitOpsand container libraries (/libs) to Proxmox VE.Set
auto.stageto override the default stage (main) for automatic deployment.
Files and Configuration
Configuration uses cascading overrides to separate infrastructure defaults:
Global environment variables are set in
globals.json(stage-specific inglobals.stage.json).container.stage.envis sourced for deployments of forked (stage) repositories..localfiles are excluded from versioning (e.g.,globals.local.json,container.local.env, or10-assistant.local.caddy).
See the Configuration Reference for details.
Lifecycle
Default Pipeline
- run
release: creates and configures a container. - run
main: configures an existing container. - run
snapshot: creates a snapshot leveragingUtils.snapshot. - run
rollback: rolls back configuration changes.
Self-Containment
git clone --recurse-submodules, e.g., for Version-Controlled Mirroring.
./local/share/can be used for persistence.Backup, Update and Rollback: See Self-Containment, which mirrors the system's architecture, implying lifecycle operations emerge from the principle itself.
Development and Extension
Reusable container definitions are stored in the libs folder.
Getting Started
Copy an example container (e.g., libs/broker or libs/proxy) as a template, or create a new container lib from scratch:
- Add
container.envto the container's root directory (e.g.,./libs/apache):
IP="192.168.178.42"
ID="142"
CORES="2"
MEMORY="4096"
SWAP="512"
DISK="local-lvm:8"
MOUNT=""
BOOT="yes"
- Add your cookbook to the container definition root:
# libs/apache/recipes/default.rb
package 'apache2'
file '/var/www/html/index.html' do
content "<h1>Hello from #{Env.get(node, 'USER_LOGIN')}</h1>"
mode '0644'
owner Default.user # see base/roles/base/tasks/main.yml
group Default.group # each container is configured identically
end
Common.application(self, 'apache2') # provided by convention
Add to Monorepository and redeploy.
Container
libscan be tested locally with./local/run.sh [container]:
Environment
- Optionally, use
Env.get()andEnv.set()to access environment variables, initially set by globals.
Jelajahi proyek terkait
Memuat…