feat(forgejo): add quadlet deployment

Related to #51

Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
Matej Focko 2024-11-14 15:40:40 +01:00
parent 51a44bca3d
commit 5057b9fed1
Signed by: mfocko
SSH key fingerprint: SHA256:icm0fIOSJUpy5+1x23sfr+hLtF9UhY8VpMC7H4WFJP8
4 changed files with 48 additions and 0 deletions

View file

@ -0,0 +1,19 @@
---
- name: Install the Forgejo quadlets
ansible.builtin.template:
src: "templates/{{ item }}"
dest: "/etc/containers/systemd/{{ item }}"
mode: 0644
owner: root
group: root
loop:
- forgejo.container
- forgejo.network
- forgejo.volume
- name: Enable the Forgejo quadlet
ansible.builtin.systemd_service:
daemon_reload: true
enabled: true
name: forgejo.service
state: "started"

View file

@ -0,0 +1,25 @@
[Unit]
Description=Forgejo
[Container]
ContainerName=forgejo
Image=codeberg.org/forgejo/forgejo:9
Environment=USER_UID=1000
Environment=USER_GID=1000
Environment=TZ=Europe/Prague
Environment=START_SSH_SERVER=true
Environment=SSH_CREATE_AUTHORIZED_PRINCIPALS_FILES=true
Environment=SSH_AUTHORIZED_PRINCIPALS_ALLOW="username,email"
Network=forgejo.network
PublishPort=2222:22
PublishPort=3000:3000
Volume=forgejo-data:/data
[Service]
Restart=always
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,2 @@
[Network]
NetworkName=forgejo

View file

@ -0,0 +1,2 @@
[Volume]
VolumeName=forgejo-data