Skip to content

Commit

Permalink
Merge branch 'main' into fb_workflow_795
Browse files Browse the repository at this point in the history
  • Loading branch information
drfho authored Dec 11, 2024
2 parents a27ef62 + da9c5ac commit cc337c1
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 6 deletions.
7 changes: 5 additions & 2 deletions Products/zms/_importable.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,11 @@ def recurse_importContent(self, folder):
self.setObjProperty(key, blob, lang)

# Commit object.
self.onChangeObj( self.REQUEST, forced=1)

try:
self.onChangeObj( self.REQUEST, forced=1)
except:
standard.writeBlock( self, '[recurse_importContent]: %s commitObject failed'%(self.getId()))

# Process children.
for ob in self.getChildNodes():
recurse_importContent(ob, folder)
Expand Down
12 changes: 12 additions & 0 deletions bin/build_docker_to_file
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env sh
set -xe

cd "$(dirname "$0")"

export ZOPE_TAG=latest

cd ..
docker buildx bake --set '*.platform=linux/amd64' zope

cd dist
docker image save localhost/zope:$ZOPE_TAG > zope.latest.tar
11 changes: 11 additions & 0 deletions bin/upload_docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

set -exo pipefail

TARGET_HOST=${1:-new.dosis-jena.de}
DIST_FILE=${2:-zope.latest.tar}

cd "$(dirname "$0")/../dist"

rsync --checksum --partial --archive --itemize-changes --compress --progress $DIST_FILE $TARGET_HOST:
ssh $TARGET_HOST "cat $DIST_FILE | sudo -iu zope podman load"
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ services:
build:
context: .
dockerfile: ./docker/base/Dockerfile
image: localhost/zms:latest
image: localhost/zope:${ZOPE_TAG:-latest}
depends_on:
- zeo
stop_grace_period: 1s # SIGKILL after 1s, as zope is always taking the full 10 seconds
Expand Down Expand Up @@ -49,7 +49,7 @@ services:
build:
context: .
dockerfile: ./docker/base/Dockerfile
image: localhost/zms:latest
image: localhost/zope:latest
command: runzeo --configure etc/zeo.conf
volumes:
- ./docker/zeo/etc/:/home/zope/etc/
Expand Down
3 changes: 2 additions & 1 deletion docker/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ RUN mkwsgiinstance --dir . --user admin:admin
ARG BUILD_DIR=docker/base
COPY --chown=zope:zope $BUILD_DIR/zope.ini etc/zope.ini
COPY --chown=zope:zope $BUILD_DIR/zope.conf etc/zope.conf
COPY --chown=zope:zope $BUILD_DIR/zeo.conf etc/zeo.conf
RUN mkdir cache Extensions

COPY --chown=zope:zope Products Products
Expand All @@ -82,4 +83,4 @@ COPY --chown=zope:zope Products Products
# locally it is mapped into the container via bindmounts
# COPY --chown=zope:zope selenium_tests test_output tests ./

CMD runwsgi --verbose etc/zope.ini http_port=80
CMD ["runwsgi", "--verbose", "etc/zope.ini", "http_port=80"]
20 changes: 20 additions & 0 deletions docker/base/zeo.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
%define INSTANCE /home/zope/

<zeo>
address 0.0.0.0:8090
</zeo>

<eventlog>
<logfile>
path /dev/stdout
format %(asctime)s %(message)s
</logfile>
</eventlog>

<filestorage main>
path $INSTANCE/var/Data.fs
</filestorage>

<filestorage temporary>
path $INSTANCE/var/temporary.fs
</filestorage>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ User=zope
Group=zope
Restart=always

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

Expand All @@ -18,7 +19,7 @@ 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
ExecStart=/usr/bin/podman run --rm --publish 127.0.0.1:$ZEO_PUBLIC_PORT:80 --name $DOCKER_IMAGE $DOCKER_IMAGE:$DOCKER_TAG

[Install]
WantedBy=multi-user.target
Expand Down
1 change: 1 addition & 0 deletions docker/systemd/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Group=zope
Restart=always

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

TimeoutStartSec=0
Expand Down
5 changes: 5 additions & 0 deletions docker/zope/etc/zope.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ zope_conf = %(here)s/zope.conf

[server:main]
use = egg:waitress#main
# If deployed on bare metal
# host 127.0.0.1
# If deployed in a container
host = 0.0.0.0
# If deployed on bare metal, need to configure the port
# port = %(http_port)s
# If deployed in a container
port = 80

[filter:translogger]
Expand Down

0 comments on commit cc337c1

Please sign in to comment.