Skip to content

Commit

Permalink
Modify built in systemd file templates
Browse files Browse the repository at this point in the history
  • Loading branch information
dwt committed Dec 10, 2024
1 parent b4393bc commit 67185c8
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 20 deletions.
25 changes: 25 additions & 0 deletions docker/systemd/zeo.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[Unit]
Description=Zope ZEO Server

# After=docker.service
# Requires=docker.service

[Service]
User=zope
Group=zope
Restart=always

Environment="INSTANCE_HOME=/path/to/instance_home"
Environment="DOCKER_IMAGE=localhost/zms DOCKER_TAG=latest"

TimeoutStartSec=0
PrivateTmp=true

ExecStartPre=-/usr/bin/podman stop $DOCKER_IMAGE
# TODO add zeo run command
# TODO find a way to parametrize the zeo port or use a file based socket
ExecStart=/usr/bin/podman run --rm --name $DOCKER_IMAGE $DOCKER_IMAGE:$DOCKER_TAG

[Install]
WantedBy=multi-user.target
WantedBy=zms.target
15 changes: 6 additions & 9 deletions docker/systemd/zms-restart.service
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
[Unit]
Description=ZMS/Zope rebuilder and restarter

After=docker.service
Requires=docker.service

# After=docker.service
# Requires=docker.service

[Service]
#User=zope
#Group=zope
User=zope
Group=zope
Restart=always

## FIXME /path/to/oidc_client/ needs to point to the root folder of the source code of the oidc_client
## so docker can actually build the image
## TODO probably best to point to a rebuild script?
Environment="INSTANCE_HOME=/path/to/instance_home"
Environment="DOCKER_IMAGE=localhost/zms DOCKER_TAG=latest"

TimeoutStartSec=0
PrivateTmp=true

ExecStartPre=/usr/bin/docker build --no-cache --pull --tag $DOCKER_IMAGE:$DOCKER_TAG $INSTANCE_HOME
# If the image is locally built and prepared for it, then this can rebuild the image and thus apply operating system updates
#ExecStartPre=/usr/bin/podman build --no-cache --pull --tag $DOCKER_IMAGE:$DOCKER_TAG $INSTANCE_HOME
ExecStart=/usr/bin/systemd restart zms@*.service

[Install]
Expand Down
19 changes: 8 additions & 11 deletions docker/systemd/[email protected]
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
[Unit]
Description=ZMS/Zope

After=docker.service
Requires=docker.service

Requires=memcached.service
After=memcached.service

Requires=mariadb.service
After=mariadb.service

# After=docker.service
# Requires=docker.service
# Requires=mariadb.service
# After=mariadb.service

[Service]
#User=zope
#Group=zope
User=zope
Group=zope
Restart=always

Environment="ZOPE_PUBLIC_PORT=%i"
Expand All @@ -22,8 +19,8 @@ Environment="DOCKER_IMAGE=localhost/zms DOCKER_TAG=latest"
TimeoutStartSec=0
PrivateTmp=true

ExecStartPre=-/usr/bin/docker stop $DOCKER_IMAGE
ExecStart=/usr/bin/docker run --rm --publish 127.0.0.1:$ZOPE_PUBLIC_PORT:80 --name $DOCKER_IMAGE $DOCKER_IMAGE:$DOCKER_TAG
ExecStartPre=-/usr/bin/podman stop $DOCKER_IMAGE
ExecStart=/usr/bin/podman run --rm --publish 127.0.0.1:$ZOPE_PUBLIC_PORT:80 --name $DOCKER_IMAGE $DOCKER_IMAGE:$DOCKER_TAG

[Install]
WantedBy=multi-user.target
Expand Down

0 comments on commit 67185c8

Please sign in to comment.