Skip to content

fansilet-roles/gogs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gogs-quadlet

Deploy Gogs as a Podman Quadlet Container

Requirements

  • podman - version 4.7.2+

Role Variables

  • gogs_quadlet: (dict) - Define the Container image and tag
  • gogs_quadlet_volumes: (list) A list of volumes and paths to be monted on the container.
  • gogs_quadlet_ports: (list) A list of ports to be published by the gogs container
  • gogs_quadlet_psql_volumes: (list) A list of volumes to be mounted on the PostgreSQL container.
  • gogs_quadlet_psql: (dict) Define the PostgreSQL container image and ta to used.
  • gogs_quadlet_psql_ports: (list) List of ports to be published by PostgreSQL container
  • gogs_quadlet_psql_env: (dict) Environment variables binded to the PostgreSQL container.
  • gogs_pod: (dict) Defines the kube pod metadata

Dependencies

  • container.podman - version 1.11.0+

Example Playbook

  • Basic Gogs Deployment:

deploy gogs and postgresql, postgresql user is the same of GOGS_USER by default gogs will be deployed and bind volumes from /srv/gogs created on the host

---
- name: Deploying Gogs
  hosts: server
  gather_facts: false
  vars:
    gogs_quadlet_psql_env:
      TZ: "ETC/UTC'
      POSTGRESQL_PASSWORD: "admin"
      GOGS_PASSWORD: "gogs-admin"
      GOGS_USER: "gogs"
      POSTGRES_DB: "gogs"

  roles:
   - gogs-quadlet

check-out the default variables from main to see the full list of supported values

Backup and Restore

This role installs by default a SystemD timer to backup the Gogs. The backup runs by default every wed at 3:00 AM. Backups of the gogs-bkp volume are saved in the /srv/gogs/volbkp/ directory.

The backup is generated using the script gogs-bkp.sh, which is installed in the directory: /usr/local/bin/gogs-bkp.sh.

  • Manually Creating a Backup with SystemD:
systemctl start gogs-bkp

Volume backup will be saved in /srv/gogs/volbkp/ use systemctl status gogs-bkp to check the status of the backup job.

  • Creating a backup by hand: this command will create a zipped backup of all settings and data
gogs-bkp.sh backup gogs-gogs # gogs-gogs is the container name where gogs is running
  • Listing the Backups this command will list all backups available in the backup volume
gogs-bkp.sh list gogs-bkp # gogs-bkp is the container backup volume
  • Restoring a Backup _to restore a backup generated with the command gogs-bkp.sh backup, use:
gogs-bkp.sh restore gogs-gogs /backup/my-gogs-backup.zip
  • Creating a Volume Backup The backups created with the gogs-bkp.sh backup command are stored in the gogs-bkp volume, this volume is also recommended to be backed up using the gogs-bkp.sh volbkp command:
gogs-bkp.sh volbkp gogs-bkp /tmp # gogs-bkp is the container backup volume

_the above command will create a backup of the gogs-bkp volume in the /tmp directory.

  • Restoring a Backup _To restore a volume backup generated with the command gogs-bkp.sh volbkp, use:
gogs-bkp.sh volrestore gogs-bkp gogs-bkp-2025-10-01_03-00-00.tar.bz2

Developing and Testing

This role was developed using ansible molecule. The use of molecule is optional but recommended.

Note Testing this role with Molecule requires creating local secrets for privilege escalation during the prepare phase. Please read the secret management instructions before running molecule commands.

  • Testing:
    Unit tests for checking code regression are available in the tests directory. use the verify or test commands, e.g:
molecule test

while developing use verify instead:

molecule create
molecule verify

License

GPL-2.0-or-later

Author Information

@mrbrandao - Igor Brandão

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors