cloudinit

package
v1.10.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package cloudinit provides cloud-init script generation for worker provisioning.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(cfg Config) string

Generate creates a cloud-config YAML for cloud-init based worker setup. Both DigitalOcean and Hetzner support this format natively. SSH key is injected by the cloud provider at creation time; we harden SSH (port 2222, pubkey-only) so the app can reach workers from App Platform where port 22 is blocked.

func GenerateEnvFileContent

func GenerateEnvFileContent(cfg Config) string

GenerateEnvFileContent generates the .env file content for a worker.

func GenerateSetupScript

func GenerateSetupScript(cfg Config) string

GenerateSetupScript generates a setup script for manual provisioning via SSH.

func GenerateUpdateCommand

func GenerateUpdateCommand(cfg Config) string

GenerateUpdateCommand generates the SSH command to update worker configuration.

Types

type Config

type Config struct {
	// DatabaseURL is the PostgreSQL connection string.
	DatabaseURL string

	// HashIDSalt is the salt for encoding job IDs.
	HashIDSalt string

	// Concurrency is the number of worker containers to run on this host.
	Concurrency int

	// MaxJobsPerCycle is the number of jobs to process before restarting.
	MaxJobsPerCycle int

	// FastMode enables the stealth HTTP scraping mode.
	FastMode bool

	// Proxies is a comma-separated list of proxy URLs.
	Proxies string

	// RegistryURL is the container registry URL (e.g., "ghcr.io", "registry.digitalocean.com/myregistry").
	RegistryURL string

	// RegistryUsername is the username for registry authentication.
	RegistryUsername string

	// RegistryToken is the token/password for registry authentication.
	RegistryToken string

	// Image is the full image reference (e.g., "ghcr.io/gosom/google-maps-scraper-pro:latest").
	Image string
}

Config contains the configuration for generating a cloud-init script.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL