From 26791668192526ff8bc9639a6871196a36d60ec3 Mon Sep 17 00:00:00 2001 From: Alex Palaistras Date: Sun, 13 Aug 2023 14:13:07 +0100 Subject: [PATCH] gotosocial: Move to Quadlet --- service/gotosocial/Containerfile | 14 ++++++------- service/gotosocial/container/run-gotosocial | 2 +- .../gotosocial/quadlet/gotosocial.container | 17 ++++++++++++++++ service/gotosocial/spec.bu | 8 ++------ service/gotosocial/systemd/gotosocial.service | 20 ------------------- 5 files changed, 26 insertions(+), 35 deletions(-) create mode 100644 service/gotosocial/quadlet/gotosocial.container delete mode 100644 service/gotosocial/systemd/gotosocial.service diff --git a/service/gotosocial/Containerfile b/service/gotosocial/Containerfile index a5b2aba..775eb08 100644 --- a/service/gotosocial/Containerfile +++ b/service/gotosocial/Containerfile @@ -1,14 +1,12 @@ -FROM docker.io/debian:bullseye-slim +FROM docker.io/debian:bookworm-slim ARG VERSION=0.10.0 -RUN apt-get update -y && apt-get upgrade -y && \ - apt-get install -y --no-install-recommends curl ca-certificates gettext gosu - ENV PACKAGE_URL https://github.com/superseriousbusiness/gotosocial/releases/download/v${VERSION}/gotosocial_${VERSION}_linux_amd64.tar.gz -RUN mkdir -p /opt/gotosocial && curl -L ${PACKAGE_URL} | tar -C /opt/gotosocial --no-same-owner -xvzf - && \ - mv /opt/gotosocial/gotosocial /bin/gotosocial && chmod +x /bin/gotosocial - -RUN apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false curl +RUN apt-get update -y && apt-get upgrade -y && \ + apt-get install -y --no-install-recommends curl ca-certificates gettext gosu && \ + mkdir -p /opt/gotosocial && curl -L ${PACKAGE_URL} | tar -C /opt/gotosocial --no-same-owner -xvzf - && \ + mv /opt/gotosocial/gotosocial /bin/gotosocial && chmod +x /bin/gotosocial && \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false curl RUN addgroup --system --gid 10000 gotosocial RUN adduser --system --uid 10000 --ingroup gotosocial --home /var/lib/gotosocial gotosocial diff --git a/service/gotosocial/container/run-gotosocial b/service/gotosocial/container/run-gotosocial index d39a315..a82f263 100755 --- a/service/gotosocial/container/run-gotosocial +++ b/service/gotosocial/container/run-gotosocial @@ -7,7 +7,7 @@ envsubst < /etc/gotosocial/config.yaml.template > /etc/gotosocial/config.yaml # Create data directories and correct permissions for data files. install --owner gotosocial --group gotosocial --mode 700 --directory /var/lib/gotosocial -chown -R gotosocial:gotosocial /etc/gotosocial /var/lib/gotosocial +chown -R gotosocial:gotosocial /var/lib/gotosocial # Initialize default condiguration if needed. if ! test -f /var/lib/gotosocial/gotosocial.db; then diff --git a/service/gotosocial/quadlet/gotosocial.container b/service/gotosocial/quadlet/gotosocial.container new file mode 100644 index 0000000..483caa1 --- /dev/null +++ b/service/gotosocial/quadlet/gotosocial.container @@ -0,0 +1,17 @@ +[Unit] +Description=GoToSocial ActivityPub Server +Wants=container-build@%N.service container-volume@%N.service +After=container-build@%N.service container-volume@%N.service + +[Container] +ContainerName=%N +EnvironmentFile=%E/coreos-home-server/%N/%N.env +Image=localhost/%N:latest +Network=internal +Volume=%N:/var/lib/%N:z + +[Service] +Restart=on-failure + +[Install] +WantedBy=multi-user.target diff --git a/service/gotosocial/spec.bu b/service/gotosocial/spec.bu index ac55fed..4cc6c65 100644 --- a/service/gotosocial/spec.bu +++ b/service/gotosocial/spec.bu @@ -4,9 +4,5 @@ storage: trees: - path: /etc/coreos-home-server/gotosocial local: service/gotosocial/ - - path: /etc/systemd/system - local: service/gotosocial/systemd/ -systemd: - units: - - name: gotosocial.service - enabled: true + - path: /etc/containers/systemd + local: service/gotosocial/quadlet/ diff --git a/service/gotosocial/systemd/gotosocial.service b/service/gotosocial/systemd/gotosocial.service deleted file mode 100644 index 8497ca1..0000000 --- a/service/gotosocial/systemd/gotosocial.service +++ /dev/null @@ -1,20 +0,0 @@ -[Unit] -Description=GoToSocial ActivityPub Server -Wants=container-build@%N.service container-volume@%N.service -After=container-build@%N.service container-volume@%N.service - -[Service] -Type=notify -NotifyAccess=all -SyslogIdentifier=%N -Restart=on-failure -Environment=PODMAN_SYSTEMD_UNIT=%n -ExecStart=/bin/podman run --replace --name %N --net internal --sdnotify=conmon \ - --env-file %E/coreos-home-server/%N/%N.env \ - --volume %N:/var/lib/%N:z \ - localhost/%N:latest -ExecStop=/bin/podman stop --ignore --time 10 %N -ExecStopPost=/bin/podman rm --ignore --force %N - -[Install] -WantedBy=multi-user.target