installers.k8s.gitea #
Gitea Kubernetes Installer
A Kubernetes installer for Gitea with TFGrid Gateway integration.
Overview
This installer deploys a complete Git hosting solution:
- Gitea: A lightweight self-hosted Git service
- TFGW (ThreeFold Gateway): Provides public FQDNs with TLS termination
Quick Start
import incubaid.herolib.installers.k8s.gitea
// Create and install Gitea with defaults
mut installer := gitea.get(
name: 'mygitea'
create: true
)!
installer.install()!
Configuration Options
All configuration options are optional and have sensible defaults:
Hostname and Namespace
installer.hostname = 'giteaapp' // Default: 'giteaapp'
installer.namespace = 'forge' // Default: '${installer.name}-gitea-namespace'
Note: Use only alphanumeric characters in hostnames (no underscores or dashes).
Gitea Server Configuration
// Server port
installer.http_port = 3000 // Default: 3000
// Database configuration
installer.db_type = 'sqlite3' // Default: 'sqlite3' (options: 'sqlite3', 'postgres')
installer.db_path = '/data/gitea/gitea.db' // Default: '/data/gitea/gitea.db' (for sqlite3)
// PostgreSQL configuration (only used when db_type = 'postgres')
installer.db_host = 'postgres' // Default: 'postgres' (PostgreSQL service name)
installer.db_name = 'gitea' // Default: 'gitea' (PostgreSQL database name)
installer.db_user = 'gitea' // Default: 'gitea' (PostgreSQL user)
installer.db_password = 'gitea' // Default: 'gitea' (PostgreSQL password)
// Registration
installer.disable_registration = false // Default: false (allow new user registration)
// Storage
installer.storage_size = '5Gi' // Default: '5Gi' (PVC storage size)
Note: When using db_type = 'postgres', a PostgreSQL pod will be automatically deployed in the same namespace. The installer only supports sqlite3 and postgres database types.
Full Example
import incubaid.herolib.installers.k8s.gitea
mut installer := gitea.get(
name: 'mygitea'
create: true
)!
// Configure hostname and namespace
installer.hostname = 'mygit'
installer.namespace = 'forge'
// Configure Gitea
installer.http_port = 3000
installer.db_type = 'sqlite3'
installer.disable_registration = true // Disable public registration
installer.storage_size = '10Gi' // Increase storage
// Install
installer.install()!
println('Gitea: https://${installer.hostname}.gent01.grid.tf')
PostgreSQL Example
To use PostgreSQL instead of SQLite:
import incubaid.herolib.installers.k8s.gitea
mut installer := gitea.get(
name: 'mygitea'
create: true
)!
// Configure to use PostgreSQL
installer.db_type = 'postgres' // Use PostgreSQL
installer.storage_size = '10Gi' // Storage for both Gitea and PostgreSQL
// Optional: customize PostgreSQL settings
installer.db_host = 'postgres' // PostgreSQL service name
installer.db_name = 'gitea' // Database name
installer.db_user = 'gitea' // Database user
installer.db_password = 'securepassword' // Database password
// Install (PostgreSQL pod will be deployed automatically)
installer.install()!
println('Gitea with PostgreSQL: https://${installer.hostname}.gent01.grid.tf')
Management
Check Installation Status
if gitea.installed()! {
println('Gitea is installed')
} else {
println('Gitea is not installed')
}
Destroy Deployment
installer.destroy()!
This will delete the entire namespace and all resources within it.
See Also
Constants #
const version = '0.0.0'
fn delete #
fn delete(args ArgsGet) !
fn exists #
fn exists(args ArgsGet) !bool
does the config exists?
fn get #
fn get(args_ ArgsGet) !&GiteaK8SInstaller
fn heroscript_loads #
fn heroscript_loads(heroscript string) !GiteaK8SInstaller
///////////NORMALLY NO NEED TO TOUCH
fn installed #
fn installed() !bool
checks if a certain version or above is installed
fn list #
fn list(args ArgsList) ![]&GiteaK8SInstaller
if fromdb set: load from filesystem, and not from mem, will also reset what is in mem
fn new #
fn new(args ArgsGet) !&GiteaK8SInstaller
fn play #
fn play(mut plbook PlayBook) !
fn set #
fn set(o GiteaK8SInstaller) !
register the config for the future
fn switch #
fn switch(name string)
switch instance to be used for gitea
struct ArgsGet #
struct ArgsGet {
pub mut:
name string = 'gitea'
fromdb bool // will load from filesystem
create bool // default will not create if not exist
}
///////FACTORY
struct ArgsList #
struct ArgsList {
pub mut:
fromdb bool // will load from filesystem
}
struct GiteaK8SInstaller #
struct GiteaK8SInstaller {
pub mut:
name string = 'gitea'
hostname string // Gitea hostname for TFGW
namespace string // Kubernetes namespace
// Gitea configuration
root_url string
domain string
http_port int = 3000
disable_registration bool
db_type string = 'sqlite3'
db_path string = '/data/gitea/gitea.db'
storage_size string = '5Gi'
// PostgreSQL configuration (only used when db_type = 'postgres')
db_host string = 'postgres' // PostgreSQL host (service name)
db_name string = 'gitea' // PostgreSQL database name
db_user string = 'gitea' // PostgreSQL user
db_password string = 'gitea' // PostgreSQL password
// Internal paths
gitea_app_path string = '/tmp/gitea/gitea.yaml'
tfgw_path string = '/tmp/gitea/tfgw-gitea.yaml'
postgres_path string = '/tmp/gitea/postgres.yaml'
kube_client kubernetes.KubeClient @[skip]
}
fn (GiteaK8SInstaller) destroy #
fn (mut self GiteaK8SInstaller) destroy() !
fn (GiteaK8SInstaller) install #
fn (mut self GiteaK8SInstaller) install(args InstallArgs) !
fn (GiteaK8SInstaller) reload #
fn (mut self GiteaK8SInstaller) reload() !
load from disk and make sure is properly intialized
struct InstallArgs #
struct InstallArgs {
pub mut:
reset bool
}