Documentation
¶
Overview ¶
Package database is CSF's own database: the PostgreSQL container a host provisions and owns when it is given no other, so CSF's state lives with CSF and never in another project's database.
It is an docker.OwnedService: a pinned image, a named volume for the data, a port probed once and published on 127.0.0.1 only, and a password generated once, all recorded in <state>/database.json, mode 0600. What is PostgreSQL's alone lives here: the image, the credentials, the health check, the backup directory pg_dump writes into, and the csfpg settings a host opens its pool with.
Index ¶
Constants ¶
const ( // RecordFile is the record under the state directory, mode 0600. RecordFile = "database.json" // BackupDirectory is where backups are written, under the state directory. BackupDirectory = "backups" // ContainerBackupDirectory is where the backup directory is mounted inside // the container, so pg_dump writes its file there. ContainerBackupDirectory = "/backups" // Image is the pinned PostgreSQL image, by digest. Image = "postgres:18.4-alpine3.24@sha256:9a8afca54e7861fd90fab5fdf4c42477a6b1cb7d293595148e674e0a3181de15" // User and Name are the role and database CSF's schema lives in. User = "csf" Name = "csf" )
Variables ¶
This section is empty.
Functions ¶
func NewOwnedDatabase ¶
func NewOwnedDatabase(state string, backupUser string, options ...docker.OwnedServiceOption) (*docker.OwnedService[Access], error)
NewOwnedDatabase is the database the state directory owns, its backups written as backupUser (user:group).
Types ¶
type Access ¶
type Access struct {
User string `json:"user"`
Database string `json:"database"`
Password string `json:"password"`
// BackupDirectory is the host path mounted at [ContainerBackupDirectory].
BackupDirectory string `json:"backup_directory"`
// BackupUser is the user:group pg_dump runs as, so backups belong to the
// host's user.
BackupUser string `json:"backup_user"`
}
Access is the database's own part of its record: how to log in, and where and as whom backups are written.