gotosocial: Move to Quadlet

This commit is contained in:
Alex Palaistras 2023-08-13 14:13:07 +01:00
parent 43136d090b
commit 2679166819
5 changed files with 26 additions and 35 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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/

View File

@ -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