From 2497a071dba28ec49b2d0fbdf12464e2097e4f55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Tue, 27 Aug 2024 10:25:57 +0200 Subject: [PATCH 01/39] Start dockerization for deployment in production. --- docker/TODO.md | 19 +++++++++++ docker/docker-compose.yml | 5 +++ docker/zms-base/Dockerfile | 69 ++++++++++++++++++++++++++++++++++++++ docker/zms-base/start.sh | 18 ++++++++++ 4 files changed, 111 insertions(+) create mode 100644 docker/TODO.md create mode 100644 docker/zms-base/Dockerfile create mode 100755 docker/zms-base/start.sh diff --git a/docker/TODO.md b/docker/TODO.md new file mode 100644 index 000000000..33f84dc88 --- /dev/null +++ b/docker/TODO.md @@ -0,0 +1,19 @@ +# Goals + +- [ ] one process per container +- [ ] Starting the bare docker file will give you a basic zope / zms +- [ ] everything as similar to our server deployment as possible to allow easy migration +- [ ] modern os and python +- [ ] simple to use and develop in vscode -> .devcontainer! +- [ ] all mutable data in mounted volumes +- [ ] example systemd files to run everything + - [ ] this should show how automated container updates are done! +- [ ] example nginx config so you get the same experience as on the server + +# TODOs + +- [ ] Create basic Dockerfile for the project +- [ ] specialize them for zeoserver and zope +- [ ] create docker-compose file that runs each server separately +- [ ] add devcontainer.json to develop and run everything from vscode +- [ ] … diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index d6b62e674..3e5ff78e7 100755 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,5 +1,10 @@ version: "3.7" services: + zms-base: + build: ./zms-base + entrypoint: "bash -c" + command: "exit 0" + zms5: build: . image: zms5:latest diff --git a/docker/zms-base/Dockerfile b/docker/zms-base/Dockerfile new file mode 100644 index 000000000..56f757b9a --- /dev/null +++ b/docker/zms-base/Dockerfile @@ -0,0 +1,69 @@ +FROM python:3.12 + +EXPOSE 80 + +ARG CI_COMMIT_SHA=development +ENV CI_COMMIT_SHA=$CI_COMMIT_SHA + + +# Ensure all system packages are up to date +ENV DEBIAN_FRONTEND=noninteractive +RUN \ + --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ +</dev/null 2>/dev/null & + +echo "Step-2: Starting ZOPE 80" +# FIXME does this need --debug, and what do I do to get rid of it in production? +$venv_bin_dir/runwsgi --debug --verbose $instance_dir/etc/zope.ini debug-mode=on http_port=80 + + From 8dcfa71f820a3d108b0dcee626a07276c8b8523d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Tue, 24 Sep 2024 15:32:12 +0200 Subject: [PATCH 02/39] Remove version number from docker file --- docker/docker-compose.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 3e5ff78e7..679c79ac2 100755 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,4 +1,3 @@ -version: "3.7" services: zms-base: build: ./zms-base From f99f206a61fe2e200ab5f5b02c7aac3e986820d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Tue, 24 Sep 2024 15:36:53 +0200 Subject: [PATCH 03/39] Switch to apt for installation in image --- docker/zms-base/Dockerfile | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/docker/zms-base/Dockerfile b/docker/zms-base/Dockerfile index 56f757b9a..853351713 100644 --- a/docker/zms-base/Dockerfile +++ b/docker/zms-base/Dockerfile @@ -5,24 +5,23 @@ EXPOSE 80 ARG CI_COMMIT_SHA=development ENV CI_COMMIT_SHA=$CI_COMMIT_SHA - # Ensure all system packages are up to date ENV DEBIAN_FRONTEND=noninteractive RUN \ --mount=type=cache,target=/var/cache/apt,sharing=locked \ --mount=type=cache,target=/var/lib/apt,sharing=locked \ -< Date: Tue, 24 Sep 2024 15:37:03 +0200 Subject: [PATCH 04/39] Comment --- docker/zms-base/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/zms-base/Dockerfile b/docker/zms-base/Dockerfile index 853351713..302b67351 100644 --- a/docker/zms-base/Dockerfile +++ b/docker/zms-base/Dockerfile @@ -24,7 +24,7 @@ RUN \ apt --yes install libldap2-dev libsasl2-dev EOR -# Set the user and virtualenv +# Drop root privileges ENV UID=1000 RUN useradd --system --create-home --uid $UID zope USER zope:zope From 43b2d9e24d80811b821714851f3337cc66415b5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Tue, 24 Sep 2024 15:37:25 +0200 Subject: [PATCH 05/39] Add experimental uv support to image --- docker/zms-base/Dockerfile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docker/zms-base/Dockerfile b/docker/zms-base/Dockerfile index 302b67351..1547db5ba 100644 --- a/docker/zms-base/Dockerfile +++ b/docker/zms-base/Dockerfile @@ -30,13 +30,21 @@ RUN useradd --system --create-home --uid $UID zope USER zope:zope WORKDIR /home/zope/ +# Install uv +COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv +ENV UV_LINK_MODE=copy + # Create venv and permanently enable it -ARG CREATE_VENV_COMMAND="python -m venv" +# ARG CREATE_VENV_COMMAND="uv venv" +ARG CREATE_VENV_COMMAND="python3 -m venv" ENV VIRTUAL_ENV=/home/zope/venv RUN $CREATE_VENV_COMMAND $VIRTUAL_ENV ENV PATH="$VIRTUAL_ENV/bin:$PATH" # Enable caching of pip packages to speed up rebuild times +# cannot use uv as long as so many editable packages need to be installed +# ARG PIP_INSTALL="uv pip install" +ARG PIP_INSTALL="pip install --config-settings editable_mode=compat" ENV PIP_CACHE_DIR=/home/zope/venv/cache RUN --mount=type=cache,uid=$UID,target=$PIP_CACHE_DIR,sharing=locked < Date: Tue, 24 Sep 2024 15:38:32 +0200 Subject: [PATCH 06/39] Allow configuring installation method to uv uv is so much faster, unbelievable --- docker/zms-base/Dockerfile | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/docker/zms-base/Dockerfile b/docker/zms-base/Dockerfile index 1547db5ba..efddd1740 100644 --- a/docker/zms-base/Dockerfile +++ b/docker/zms-base/Dockerfile @@ -47,13 +47,16 @@ ENV PATH="$VIRTUAL_ENV/bin:$PATH" ARG PIP_INSTALL="pip install --config-settings editable_mode=compat" ENV PIP_CACHE_DIR=/home/zope/venv/cache RUN --mount=type=cache,uid=$UID,target=$PIP_CACHE_DIR,sharing=locked < Date: Tue, 24 Sep 2024 15:39:03 +0200 Subject: [PATCH 07/39] Switch to long arguments for readability --- docker/zms-base/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/zms-base/Dockerfile b/docker/zms-base/Dockerfile index efddd1740..5ae715983 100644 --- a/docker/zms-base/Dockerfile +++ b/docker/zms-base/Dockerfile @@ -61,8 +61,8 @@ EOR # install debugging helpers like: pip install debugpy -# # Create Zope Instance -RUN mkwsgiinstance -d instance -u admin:admin +# Create Zope Instance +RUN mkwsgiinstance --dir instance --user admin:admin COPY --chown=zope:zope < Date: Tue, 24 Sep 2024 15:39:10 +0200 Subject: [PATCH 08/39] Comment --- docker/zms-base/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/zms-base/Dockerfile b/docker/zms-base/Dockerfile index 5ae715983..51c3d5b03 100644 --- a/docker/zms-base/Dockerfile +++ b/docker/zms-base/Dockerfile @@ -59,7 +59,7 @@ RUN --mount=type=cache,uid=$UID,target=$PIP_CACHE_DIR,sharing=locked < Date: Tue, 24 Sep 2024 15:39:29 +0200 Subject: [PATCH 09/39] Copy in some sensible default config files. --- docker/zms-base/Dockerfile | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/docker/zms-base/Dockerfile b/docker/zms-base/Dockerfile index 51c3d5b03..2834ec0ed 100644 --- a/docker/zms-base/Dockerfile +++ b/docker/zms-base/Dockerfile @@ -64,13 +64,10 @@ EOR # Create Zope Instance RUN mkwsgiinstance --dir instance --user admin:admin -COPY --chown=zope:zope < Date: Tue, 24 Sep 2024 15:39:37 +0200 Subject: [PATCH 10/39] Comment --- docker/zms-base/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/zms-base/Dockerfile b/docker/zms-base/Dockerfile index 2834ec0ed..85803c234 100644 --- a/docker/zms-base/Dockerfile +++ b/docker/zms-base/Dockerfile @@ -69,6 +69,7 @@ COPY --chown=zope:zope --chmod=500 start.sh instance/bin/start.sh COPY --chown=zope:zope zope.ini instance/etc/zope.ini COPY --chown=zope:zope zope.conf instance/etc/zope.conf +# All of these should probably be mounted? # COPY --chown=zope:zope ./etc instance/etc # COPY ./var venv/instance/zms5/var # COPY ./Extensions venv/instance/zms5/Extensions From acfad47e75081e9c452b130c774f618241e5c242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Tue, 24 Sep 2024 15:40:05 +0200 Subject: [PATCH 11/39] Add missing scripts / config files --- docker/zms-base/start.sh | 26 +++++----- docker/zms-base/zope.conf | 99 +++++++++++++++++++++++++++++++++++++++ docker/zms-base/zope.ini | 61 ++++++++++++++++++++++++ 3 files changed, 174 insertions(+), 12 deletions(-) create mode 100644 docker/zms-base/zope.conf create mode 100644 docker/zms-base/zope.ini diff --git a/docker/zms-base/start.sh b/docker/zms-base/start.sh index 12e24f12d..bfd711463 100755 --- a/docker/zms-base/start.sh +++ b/docker/zms-base/start.sh @@ -1,18 +1,20 @@ #!/bin/bash -# The ZEO/Zope start script works in two steps: -# 1. ZEO server is started silently (nohub) -# 2. Zope instance it started on parameter defined port:8085 -# Sending Zope's output not to dev/null but the console maintains -# docker running - instance_dir="/home/zope/instance/" venv_bin_dir="/home/zope/venv/bin" -# echo "Step-1: Starting ZEO" -# nohup $venv_bin_dir/runzeo --configure $instance_dir/etc/zeo.conf 1>/dev/null 2>/dev/null & - -echo "Step-2: Starting ZOPE 80" -# FIXME does this need --debug, and what do I do to get rid of it in production? -$venv_bin_dir/runwsgi --debug --verbose $instance_dir/etc/zope.ini debug-mode=on http_port=80 +# Regarding debug-mode=on +# @see https://zope.readthedocs.io/en/latest/zopebook/InstallingZope.html#the-debug-mode-directive +# recommend to disable debug-mode in production as it auto reloads templates on change +# @see https://zope.readthedocs.io/en/latest/zdgbook/TestingAndDebugging.html#debug-mode +# mentions that this also shows backtraces to users +# @see https://zope.readthedocs.io/en/latest/news.html#wsgi-as-the-new-default-server-type +# mentions that this disables a httpexceptions midleware and shows backtraces on the console> +# TODO talk to FH if this makes sense. Might require a slightly different workflow from them. +# Currently always enabled on our servers. +# Regarding --debug +# @see https://zope.readthedocs.io/en/latest/operation.html#running-zope-in-the-foreground +# seems to sugges that this also enables the debug-mode directive +# TODO talk to FH to allow me to check that +exec $venv_bin_dir/runwsgi --debug --verbose $instance_dir/etc/zope.ini debug-mode=on http_port=80 diff --git a/docker/zms-base/zope.conf b/docker/zms-base/zope.conf new file mode 100644 index 000000000..e49ca597f --- /dev/null +++ b/docker/zms-base/zope.conf @@ -0,0 +1,99 @@ +%define INSTANCE /home/zope/instance + +instancehome $INSTANCE +trusted-proxy 127.0.0.1 +#trusted-proxy host.docker.internal + + + + path $INSTANCE/var/Data.fs + + mount-point / + + + + name Temporary database (for sessions) + + mount-point /temp_folder + container-class Products.TemporaryFolder.TemporaryContainer + + + +# %import ZEO +# +# # Main FileStorage database +# +# server $INSTANCE/var/zeosocket +# # REFACT add client-name +# storage main +# name zeostorage Data.fs +# # We can enlarge the cache to reduce network roundtrips, not sure this is neccessary +# # cache-size 200MB +# client-label zms5 8880 +# +# mount-point / +# +# +# # Temporary storage database (for sessions) +# +# server $INSTANCE/var/zeosocket +# storage temporary +# name zeostorage temporary +# # We can enlarge the cache to reduce network roundtrips, not sure this is neccessary +# # cache-size 200MB +# client-label zms5 8880 +# +# mount-point /temp_folder +# container-class Products.TemporaryFolder.TemporaryContainer +# + + + + CHAMELEON_CACHE $INSTANCE/var/cache + + +# Directive: debug-mode +# +# Description: +# A switch which controls several aspects of Zope operation useful for +# developing under Zope. When debug mode is on: +# +# - The process will not detach from the controlling terminal +# +# - Errors in product initialization will cause startup to fail +# (instead of writing error messages to the event log file). +# +# - Filesystem-based scripts such as skins, PageTemplateFiles, and +# DTMLFiles can be edited while the server is running and the server +# will detect these changes in real time. When this switch is +# off, you must restart the server to see the changes. +# +# Setting this to 'off' when Zope is in a production environment is +# encouraged, as it speeds execution (sometimes dramatically). +# +# Default: off +# +# Example: +# +# debug-mode on + + +# Directive: debug-exceptions +# +# Description: +# This switch controls how exceptions are handled. If it is set to +# "off" (the default), Zope's own exception handling is active. +# Exception views or a standard_error_message are used to handle them. +# +# If set to "on", exceptions are not handled by Zope and can propagate +# into the WSGI pipeline, where they may be handled by debugging +# middleware. +# +# This setting should always be "off" in production. It is useful for +# developers and while debugging site issues. +# +# Default: off +# +# Example: +# +# debug-exceptions on diff --git a/docker/zms-base/zope.ini b/docker/zms-base/zope.ini new file mode 100644 index 000000000..e449a1156 --- /dev/null +++ b/docker/zms-base/zope.ini @@ -0,0 +1,61 @@ +[app:zope] +use = egg:Zope#main +zope_conf = %(here)s/zope.conf + +[server:main] +use = egg:waitress#main +host = 0.0.0.0 +port = 80 + +[filter:translogger] +use = egg:Paste#translogger +setup_console_handler = False + +[pipeline:main] +pipeline = + egg:Zope#httpexceptions + translogger + zope + +[loggers] +keys = root, waitress.queue, waitress, wsgi + +[handlers] +keys = console + +[formatters] +keys = generic, message + +[formatter_generic] +format = %(asctime)s %(levelname)s [%(name)s:%(lineno)s][%(threadName)s] %(message)s +datefmt = %Y-%m-%d %H:%M:%S + +[formatter_message] +format = %(message)s + +[logger_root] +level = INFO +handlers = console + +[logger_waitress.queue] +level = INFO +handlers = console +qualname = waitress.queue +propagate = 0 + +[logger_waitress] +level = INFO +handlers = console +qualname = waitress + +[logger_wsgi] +level = WARN +handlers = console +qualname = wsgi +propagate = 0 + +[handler_console] +class = StreamHandler +args = (sys.stderr,) +level = NOTSET +formatter = generic From e17ee852c1aeac7e09abda9041db82033d649e18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Tue, 24 Sep 2024 16:51:08 +0200 Subject: [PATCH 12/39] Start differentiating docker containers for zope and zeo --- docker/TODO.md | 4 +- docker/docker-compose.yml | 30 ++++++------- docker/zeo/etc/zeo.conf | 20 +++++++++ docker/zeo/var/Data.fs | Bin 0 -> 19395 bytes docker/zeo/var/Data.fs.index | Bin 0 -> 459 bytes docker/zeo/var/Data.fs.lock | 1 + docker/zeo/var/Data.fs.tmp | Bin 0 -> 1872 bytes docker/zeo/var/temporary.fs | Bin 0 -> 166 bytes docker/zeo/var/temporary.fs.index | Bin 0 -> 31 bytes docker/zeo/var/temporary.fs.lock | 1 + docker/zeo/var/temporary.fs.tmp | 0 docker/zms-base/Dockerfile | 1 + docker/zms-base/zope.conf | 68 ++++++++---------------------- docker/zope/etc/zope.conf | 44 +++++++++++++++++++ docker/zope/etc/zope.ini | 62 +++++++++++++++++++++++++++ 15 files changed, 160 insertions(+), 71 deletions(-) create mode 100755 docker/zeo/etc/zeo.conf create mode 100755 docker/zeo/var/Data.fs create mode 100644 docker/zeo/var/Data.fs.index create mode 100644 docker/zeo/var/Data.fs.lock create mode 100755 docker/zeo/var/Data.fs.tmp create mode 100755 docker/zeo/var/temporary.fs create mode 100644 docker/zeo/var/temporary.fs.index create mode 100644 docker/zeo/var/temporary.fs.lock create mode 100755 docker/zeo/var/temporary.fs.tmp create mode 100755 docker/zope/etc/zope.conf create mode 100755 docker/zope/etc/zope.ini diff --git a/docker/TODO.md b/docker/TODO.md index 33f84dc88..db8389f9e 100644 --- a/docker/TODO.md +++ b/docker/TODO.md @@ -1,7 +1,7 @@ # Goals -- [ ] one process per container -- [ ] Starting the bare docker file will give you a basic zope / zms +- [x] one process per container +- [X] Starting the bare docker file will give you a basic zope / zms - [ ] everything as similar to our server deployment as possible to allow easy migration - [ ] modern os and python - [ ] simple to use and develop in vscode -> .devcontainer! diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 679c79ac2..d905860f5 100755 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,27 +1,21 @@ services: zms-base: build: ./zms-base + image: zms-base:latest entrypoint: "bash -c" command: "exit 0" - zms5: - build: . - image: zms5:latest + zope: + image: zms-base:latest ports: - - 8085:8085 - - 8086:8086 - - 8080:8080 - - 5678:5678 - environment: - - PYTHONUNBUFFERED="1" - - CONFIG_FILE="/home/zope/venv/instance/zms5/etc/zope.ini" - - INSTANCE_HOME="/home/zope/venv/instance/zms5" - - CLIENT_HOME="/home/zope/venv/instance/zms5" - - PYTHON="/home/zope/venv/bin/python" - - SOFTWARE_HOME="/home/zope/venv/bin" + - 80:80 volumes: - - ./etc/:/home/zope/venv/instance/zms5/etc/ - - ./Extensions/:/home/zope/venv/instance/zms5/Extensions/:rw - - ./var/:/home/zope/venv/instance/zms5/var/ + - ./zope/etc/:/home/zope/instance/etc/ + - ./zope/var/:/home/zope/instance/var/ - # command: /home/zope/venv/instance/zms5/etc/start.sh + zeo: + image: zms-base:latest + command: runzeo --configure instance/etc/zeo.conf + volumes: + - ./zeo/etc/:/home/zope/instance/etc/ + - ./zeo/var/:/home/zope/instance/var/ diff --git a/docker/zeo/etc/zeo.conf b/docker/zeo/etc/zeo.conf new file mode 100755 index 000000000..849e4645b --- /dev/null +++ b/docker/zeo/etc/zeo.conf @@ -0,0 +1,20 @@ +%define INSTANCE /home/zope/instance + + + address 0.0.0.0:8090 + + + + + path /dev/stdout + format %(asctime)s %(message)s + + + + + path $INSTANCE/var/Data.fs + + + + path $INSTANCE/var/temporary.fs + diff --git a/docker/zeo/var/Data.fs b/docker/zeo/var/Data.fs new file mode 100755 index 0000000000000000000000000000000000000000..de4227d504a72505dbd300c16137ce25b7889e49 GIT binary patch literal 19395 zcmeHPeQX@Zbzk!Mc_bx%NfbqWEGbGnO5`2CMamQ7!P%{_-n(0J*FN6e zyWNxIxCb~zc(DpJDc}OOmBg_f$I%}SnvVhv(jsX8DT3Ak+MqyV1pNS#qD9jpfKVVs zQ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pa z=p^I=Qh0OJR{G4?&QSLsEExClA92A&*MoD?B*}V}v{|g@2tV zhhTz`C#7(jCy&4sA)l4PpXJG;FipraQuuYAJO<|o`3WgZLco!G9A*jmykx@M23**H ziyJV{0%Ux<01nXwx4j@77ltVXIUJ66ZMV|CO!R!6*J)#Dwj z!``v#_Kwvd?^tzt$LgSGth%1_{c7V!Ux@sa{lvDS^X7skC;tvNTKJj!TkDE{_vE~J zVkajh6NSTKl5sLVMkgh|+W2wo4+eHi3Q&v7IbA~l5sLVRu=s53qSk8 zE7ldQv(HHGsdf>NRq^REi z;31dbDeS=heVW@r)tm1Am1Q^CmF`~y;q+fVba%`5w@vVTmVf<=PJ-ukp8O>z!Sg;( z{<4$c`D32^rjy|LE1vunC&BYiJozmr!SkOy`E4h`)A}QBJnuLOo_?PERVTqS&6D4C z5)qCEt`kHsF-t~^vSG{BPj(4oy_KwwC-m&_McdXv@j@6gFWA!EPSbfnuR`yjyMy}I{u?8*VHi=wFoHNnVIzStBr%Q&Odx|j=N&{asWYdVBMvFA|OXGLc-lM5|>b%g*hdhu;ntqV# zEgdqK%Cz_`&*g>;(uGI4E37{cwaz|>MRz$l`jMY->!$U{)3 zpaId)Qy|f$g@UYOi%m+jE= zc6ENEBy>5VMdSLV8dp?iDTU&SrbcyDlTeV8BD9`6G1(Hh2O4}0HgM#-4Gtojs_Jqm zY%V0bn!0Vce(A&xot7|-4tsmp+HO}IxP6i~md`ddJyUkFUSMZktB~I-cZTVz#~} literal 0 HcmV?d00001 diff --git a/docker/zeo/var/temporary.fs b/docker/zeo/var/temporary.fs new file mode 100755 index 0000000000000000000000000000000000000000..bcde28a31597fbabe5fd353f39dd8983fc9ae6cc GIT binary patch literal 166 zcmZ<@Ha1}X-Fm5CqDPPc0%j=yX-Ni#%)HE!%)}gpl*E$6q{QM>h2)~t#FEVXJg7Pb zG<`5(78rxUp@BKMAhoDCv$!NRuS735v7jI`FP$p@F60XpDP+)VV6H7>i~#8c*;mL^ MTgY6j2Q_IH08o)B0ssI2 literal 0 HcmV?d00001 diff --git a/docker/zeo/var/temporary.fs.index b/docker/zeo/var/temporary.fs.index new file mode 100644 index 0000000000000000000000000000000000000000..cb464437599f88b1191c517f24653536af58c484 GIT binary patch literal 31 dcmZo*_Fksf!0gP%00zz+5SqcH4JhiT2LMor1fc)` literal 0 HcmV?d00001 diff --git a/docker/zeo/var/temporary.fs.lock b/docker/zeo/var/temporary.fs.lock new file mode 100644 index 000000000..c6cf38636 --- /dev/null +++ b/docker/zeo/var/temporary.fs.lock @@ -0,0 +1 @@ + 1 diff --git a/docker/zeo/var/temporary.fs.tmp b/docker/zeo/var/temporary.fs.tmp new file mode 100755 index 000000000..e69de29bb diff --git a/docker/zms-base/Dockerfile b/docker/zms-base/Dockerfile index 85803c234..503b2e261 100644 --- a/docker/zms-base/Dockerfile +++ b/docker/zms-base/Dockerfile @@ -61,6 +61,7 @@ EOR # TODO install debugging helpers like: pip install debugpy +# REFACT consider a flat layout where the user has venv etc bin directly in home folder # Create Zope Instance RUN mkwsgiinstance --dir instance --user admin:admin diff --git a/docker/zms-base/zope.conf b/docker/zms-base/zope.conf index e49ca597f..121298315 100644 --- a/docker/zms-base/zope.conf +++ b/docker/zms-base/zope.conf @@ -4,6 +4,23 @@ instancehome $INSTANCE trusted-proxy 127.0.0.1 #trusted-proxy host.docker.internal + + + + CHAMELEON_CACHE $INSTANCE/var/cache + + + + CHAMELEON_CACHE $INSTANCE/var/cache + + +# debugging helpers +security-policy-implementation python +verbose-security on +debug-mode on +debug-mode-services on + +# DB configuration path $INSTANCE/var/Data.fs @@ -46,54 +63,3 @@ trusted-proxy 127.0.0.1 # mount-point /temp_folder # container-class Products.TemporaryFolder.TemporaryContainer # - - - - CHAMELEON_CACHE $INSTANCE/var/cache - - -# Directive: debug-mode -# -# Description: -# A switch which controls several aspects of Zope operation useful for -# developing under Zope. When debug mode is on: -# -# - The process will not detach from the controlling terminal -# -# - Errors in product initialization will cause startup to fail -# (instead of writing error messages to the event log file). -# -# - Filesystem-based scripts such as skins, PageTemplateFiles, and -# DTMLFiles can be edited while the server is running and the server -# will detect these changes in real time. When this switch is -# off, you must restart the server to see the changes. -# -# Setting this to 'off' when Zope is in a production environment is -# encouraged, as it speeds execution (sometimes dramatically). -# -# Default: off -# -# Example: -# -# debug-mode on - - -# Directive: debug-exceptions -# -# Description: -# This switch controls how exceptions are handled. If it is set to -# "off" (the default), Zope's own exception handling is active. -# Exception views or a standard_error_message are used to handle them. -# -# If set to "on", exceptions are not handled by Zope and can propagate -# into the WSGI pipeline, where they may be handled by debugging -# middleware. -# -# This setting should always be "off" in production. It is useful for -# developers and while debugging site issues. -# -# Default: off -# -# Example: -# -# debug-exceptions on diff --git a/docker/zope/etc/zope.conf b/docker/zope/etc/zope.conf new file mode 100755 index 000000000..f2b1692f0 --- /dev/null +++ b/docker/zope/etc/zope.conf @@ -0,0 +1,44 @@ +%define INSTANCE /home/zope/instance + +instancehome $INSTANCE +# trusted-proxy www.example.com +# trusted-proxy 192.168.1.1 + + + CHAMELEON_CACHE $INSTANCE/var/cache + + +# debugging helpers +security-policy-implementation python +verbose-security on +debug-mode on +debug-exceptions on + +# DB configuration +%import ZEO + + # Main FileStorage database + + server zeo:8090 + # REFACT add client-name + storage main + name zeostorage Data.fs + # We can enlarge the cache to reduce network roundtrips, not sure this is neccessary + # cache-size 200MB + client-label zms 80 + + mount-point / + + + # Temporary storage database (for sessions) + + server zeo:8090 + storage temporary + name zeostorage temporary + # We can enlarge the cache to reduce network roundtrips, not sure this is neccessary + # cache-size 200MB + client-label zms 80 + + mount-point /temp_folder + container-class Products.TemporaryFolder.TemporaryContainer + diff --git a/docker/zope/etc/zope.ini b/docker/zope/etc/zope.ini new file mode 100755 index 000000000..1c4048e81 --- /dev/null +++ b/docker/zope/etc/zope.ini @@ -0,0 +1,62 @@ +[app:zope] +use = egg:Zope#main +zope_conf = %(here)s/zope.conf + +[server:main] +use = egg:waitress#main +# host 127.0.0.1 +host = 0.0.0.0 +port = 80 + +[filter:translogger] +use = egg:Paste#translogger +setup_console_handler = False + +[pipeline:main] +pipeline = + egg:Zope#httpexceptions + translogger + zope + +[loggers] +keys = root, waitress.queue, waitress, wsgi + +[handlers] +keys = console + +[formatters] +keys = generic, message + +[formatter_generic] +format = %(asctime)s %(levelname)s [%(name)s:%(lineno)s][%(threadName)s] %(message)s +datefmt = %Y-%m-%d %H:%M:%S + +[formatter_message] +format = %(message)s + +[logger_root] +level = INFO +handlers = console + +[logger_waitress.queue] +level = INFO +handlers = console +qualname = waitress.queue +propagate = 0 + +[logger_waitress] +level = INFO +handlers = console +qualname = waitress + +[logger_wsgi] +level = WARN +handlers = console +qualname = wsgi +propagate = 0 + +[handler_console] +class = StreamHandler +args = (sys.stderr,) +level = NOTSET +formatter = generic From e02db18b6415653bdb55b9187fb208c8e6fc9f40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Wed, 25 Sep 2024 07:27:26 +0200 Subject: [PATCH 13/39] Cure slow shutdown times --- docker/docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index d905860f5..b87f921ad 100755 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -7,6 +7,7 @@ services: zope: image: zms-base:latest + stop_grace_period: 1s # SIGKILL after 1s, as zope is always taking the full 10 seconds ports: - 80:80 volumes: From 18fb8e23e20e0ed63b2c040a41b62ba0c56d578a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Wed, 25 Sep 2024 07:27:47 +0200 Subject: [PATCH 14/39] Move up cache directory one level, to prevent it being shared to the host. --- docker/zms-base/Dockerfile | 1 + docker/zope/etc/zope.conf | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/zms-base/Dockerfile b/docker/zms-base/Dockerfile index 503b2e261..c79b68aa4 100644 --- a/docker/zms-base/Dockerfile +++ b/docker/zms-base/Dockerfile @@ -69,6 +69,7 @@ RUN mkwsgiinstance --dir instance --user admin:admin COPY --chown=zope:zope --chmod=500 start.sh instance/bin/start.sh COPY --chown=zope:zope zope.ini instance/etc/zope.ini COPY --chown=zope:zope zope.conf instance/etc/zope.conf +RUN mkdir instance/cache # All of these should probably be mounted? # COPY --chown=zope:zope ./etc instance/etc diff --git a/docker/zope/etc/zope.conf b/docker/zope/etc/zope.conf index f2b1692f0..06b837c61 100755 --- a/docker/zope/etc/zope.conf +++ b/docker/zope/etc/zope.conf @@ -5,7 +5,7 @@ instancehome $INSTANCE # trusted-proxy 192.168.1.1 - CHAMELEON_CACHE $INSTANCE/var/cache + CHAMELEON_CACHE $INSTANCE/cache # debugging helpers From 9303490ed5c2747b7117857452058b5903d3f098 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Tue, 1 Oct 2024 09:42:04 +0200 Subject: [PATCH 15/39] Move zope instance folder directly into the home folder to simplify directory layout. --- docker/docker-compose.yml | 10 +++++----- docker/zeo/etc/zeo.conf | 2 +- docker/zms-base/Dockerfile | 19 +++++++++---------- docker/zms-base/start.sh | 2 +- docker/zms-base/zope.conf | 2 +- docker/zope/etc/zope.conf | 2 +- 6 files changed, 18 insertions(+), 19 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index b87f921ad..b8468c45f 100755 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -11,12 +11,12 @@ services: ports: - 80:80 volumes: - - ./zope/etc/:/home/zope/instance/etc/ - - ./zope/var/:/home/zope/instance/var/ + - ./zope/etc/:/home/zope/etc/ + - ./zope/var/:/home/zope/var/ zeo: image: zms-base:latest - command: runzeo --configure instance/etc/zeo.conf + command: runzeo --configure etc/zeo.conf volumes: - - ./zeo/etc/:/home/zope/instance/etc/ - - ./zeo/var/:/home/zope/instance/var/ + - ./zeo/etc/:/home/zope/etc/ + - ./zeo/var/:/home/zope/var/ diff --git a/docker/zeo/etc/zeo.conf b/docker/zeo/etc/zeo.conf index 849e4645b..226e8ae58 100755 --- a/docker/zeo/etc/zeo.conf +++ b/docker/zeo/etc/zeo.conf @@ -1,4 +1,4 @@ -%define INSTANCE /home/zope/instance +%define INSTANCE /home/zope/ address 0.0.0.0:8090 diff --git a/docker/zms-base/Dockerfile b/docker/zms-base/Dockerfile index c79b68aa4..2ddb679d8 100644 --- a/docker/zms-base/Dockerfile +++ b/docker/zms-base/Dockerfile @@ -61,19 +61,18 @@ EOR # TODO install debugging helpers like: pip install debugpy -# REFACT consider a flat layout where the user has venv etc bin directly in home folder # Create Zope Instance -RUN mkwsgiinstance --dir instance --user admin:admin +RUN mkwsgiinstance --dir . --user admin:admin # Configure Zope Instance -COPY --chown=zope:zope --chmod=500 start.sh instance/bin/start.sh -COPY --chown=zope:zope zope.ini instance/etc/zope.ini -COPY --chown=zope:zope zope.conf instance/etc/zope.conf -RUN mkdir instance/cache +COPY --chown=zope:zope --chmod=500 start.sh bin/start.sh +COPY --chown=zope:zope zope.ini etc/zope.ini +COPY --chown=zope:zope zope.conf etc/zope.conf +RUN mkdir cache # All of these should probably be mounted? -# COPY --chown=zope:zope ./etc instance/etc -# COPY ./var venv/instance/zms5/var -# COPY ./Extensions venv/instance/zms5/Extensions +# COPY --chown=zope:zope ./etc etc +# COPY ./var var +# COPY ./Extensions Extensions -CMD ["/home/zope/instance/bin/start.sh"] +CMD ["/home/zope/bin/start.sh"] diff --git a/docker/zms-base/start.sh b/docker/zms-base/start.sh index bfd711463..b3d84396f 100755 --- a/docker/zms-base/start.sh +++ b/docker/zms-base/start.sh @@ -1,5 +1,5 @@ #!/bin/bash -instance_dir="/home/zope/instance/" +instance_dir="/home/zope/" venv_bin_dir="/home/zope/venv/bin" # Regarding debug-mode=on diff --git a/docker/zms-base/zope.conf b/docker/zms-base/zope.conf index 121298315..e63c72650 100644 --- a/docker/zms-base/zope.conf +++ b/docker/zms-base/zope.conf @@ -1,4 +1,4 @@ -%define INSTANCE /home/zope/instance +%define INSTANCE /home/zope/ instancehome $INSTANCE trusted-proxy 127.0.0.1 diff --git a/docker/zope/etc/zope.conf b/docker/zope/etc/zope.conf index 06b837c61..b86f2a16b 100755 --- a/docker/zope/etc/zope.conf +++ b/docker/zope/etc/zope.conf @@ -1,4 +1,4 @@ -%define INSTANCE /home/zope/instance +%define INSTANCE /home/zope/ instancehome $INSTANCE # trusted-proxy www.example.com From e33bb4fb8fc36ecf20695a8265f2cc0ba51c4da9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Tue, 1 Oct 2024 09:54:03 +0200 Subject: [PATCH 16/39] Add dependency declaration, to make it easier to script the container. Use `docker run --rm zope $somescript` and the zeo container will automatically boot as well. --- docker/docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index b8468c45f..de902e2f8 100755 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -7,6 +7,8 @@ services: zope: image: zms-base:latest + depends_on: + - zeo stop_grace_period: 1s # SIGKILL after 1s, as zope is always taking the full 10 seconds ports: - 80:80 From 039a2cea47616570992638b6c9548e5039e6e118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Tue, 1 Oct 2024 09:55:00 +0200 Subject: [PATCH 17/39] Add script to add an admin:admin user to the current zope database. This should ease debugging. This user should have been created during initialization, but somehow seems to get lost. --- docker/bin/add_insecure_admin_user | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 docker/bin/add_insecure_admin_user diff --git a/docker/bin/add_insecure_admin_user b/docker/bin/add_insecure_admin_user new file mode 100755 index 000000000..5f454612f --- /dev/null +++ b/docker/bin/add_insecure_admin_user @@ -0,0 +1,3 @@ +#!/bin/sh + +docker compose run --rm zope addzopeuser -c etc/zope.conf admin admin From 8ba7ac7d992a4849a0327cdb82980cd3cd242b93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Tue, 1 Oct 2024 09:55:13 +0200 Subject: [PATCH 18/39] Ignore the var folders, they should never be checked in. --- docker/zeo/.gitignore | 1 + docker/zope/.gitignore | 1 + 2 files changed, 2 insertions(+) create mode 100644 docker/zeo/.gitignore create mode 100644 docker/zope/.gitignore diff --git a/docker/zeo/.gitignore b/docker/zeo/.gitignore new file mode 100644 index 000000000..186857b9e --- /dev/null +++ b/docker/zeo/.gitignore @@ -0,0 +1 @@ +var diff --git a/docker/zope/.gitignore b/docker/zope/.gitignore new file mode 100644 index 000000000..186857b9e --- /dev/null +++ b/docker/zope/.gitignore @@ -0,0 +1 @@ +var From 389cd291dc17e38d58c7d3a32cf11539953591fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Tue, 1 Oct 2024 09:58:50 +0200 Subject: [PATCH 19/39] Record removal of var data from repo --- docker/zeo/var/Data.fs | Bin 19395 -> 0 bytes docker/zeo/var/Data.fs.index | Bin 459 -> 0 bytes docker/zeo/var/Data.fs.lock | 1 - docker/zeo/var/Data.fs.tmp | Bin 1872 -> 0 bytes docker/zeo/var/temporary.fs | Bin 166 -> 0 bytes docker/zeo/var/temporary.fs.index | Bin 31 -> 0 bytes docker/zeo/var/temporary.fs.lock | 1 - docker/zeo/var/temporary.fs.tmp | 0 8 files changed, 2 deletions(-) delete mode 100755 docker/zeo/var/Data.fs delete mode 100644 docker/zeo/var/Data.fs.index delete mode 100644 docker/zeo/var/Data.fs.lock delete mode 100755 docker/zeo/var/Data.fs.tmp delete mode 100755 docker/zeo/var/temporary.fs delete mode 100644 docker/zeo/var/temporary.fs.index delete mode 100644 docker/zeo/var/temporary.fs.lock delete mode 100755 docker/zeo/var/temporary.fs.tmp diff --git a/docker/zeo/var/Data.fs b/docker/zeo/var/Data.fs deleted file mode 100755 index de4227d504a72505dbd300c16137ce25b7889e49..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 19395 zcmeHPeQX@Zbzk!Mc_bx%Nfbq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MPTxmF7Q4o^M=b%b0mh2Q1L-OxbDjZ*l#JozyA z3AsrMf54M_@b?!;Zjr)&&y$b9K0@9vh5wBwAH|vhB)3W7hHrA?IflidNbZorM|kpa z=p^I=Qh0OJR{G4?&QSLsEExClA92A&*MoD?B*}V}v{|g@2tV zhhTz`C#7(jCy&4sA)l4PpXJG;FipraQuuYAJO<|o`3WgZLco!G9A*jmykx@M23**H ziyJV{0%Ux<01nXwx4j@77ltVXIUJ66ZMV|CO!R!6*J)#Dwj z!``v#_Kwvd?^tzt$LgSGth%1_{c7V!Ux@sa{lvDS^X7skC;tvNTKJj!TkDE{_vE~J zVkajh6NSTKl5sLVMkgh|+W2wo4+eHi3Q&v7IbA~l5sLVRu=s53qSk8 zE7ldQv(HHGsdf>NRq^REi z;31dbDeS=heVW@r)tm1Am1Q^CmF`~y;q+fVba%`5w@vVTmVf<=PJ-ukp8O>z!Sg;( z{<4$c`D32^rjy|LE1vunC&BYiJozmr!SkOy`E4h`)A}QBJnuLOo_?PERVTqS&6D4C z5)qCEt`kHsF-t~^vSG{BPj(4oy_KwwC-m&_McdXv@j@6gFWA!EPSbfnuR`yjyMy}I{u?8*VHi=wFoHNnVIzStBr%Q&Odx|j=N&{asWYdVBMvFA|OXGLc-lM5|>b%g*hdhu;ntqV# zEgdqK%Cz_`&*g>;(uGI4E37{cwaz|>MRz$l`jMY->!$U{)3 zpaId)Qy|f$g@UYOi%m+jE= zc6ENEBy>5VMdSLV8dp?iDTU&SrbcyDlTeV8BD9`6G1(Hh2O4}0HgM#-4Gtojs_Jqm zY%V0bn!0Vce(A&xot7|-4tsmp+HO}IxP6i~md`ddJyUkFUSMZktB~I-cZTVz#~} diff --git a/docker/zeo/var/temporary.fs b/docker/zeo/var/temporary.fs deleted file mode 100755 index bcde28a31597fbabe5fd353f39dd8983fc9ae6cc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 166 zcmZ<@Ha1}X-Fm5CqDPPc0%j=yX-Ni#%)HE!%)}gpl*E$6q{QM>h2)~t#FEVXJg7Pb zG<`5(78rxUp@BKMAhoDCv$!NRuS735v7jI`FP$p@F60XpDP+)VV6H7>i~#8c*;mL^ MTgY6j2Q_IH08o)B0ssI2 diff --git a/docker/zeo/var/temporary.fs.index b/docker/zeo/var/temporary.fs.index deleted file mode 100644 index cb464437599f88b1191c517f24653536af58c484..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 31 dcmZo*_Fksf!0gP%00zz+5SqcH4JhiT2LMor1fc)` diff --git a/docker/zeo/var/temporary.fs.lock b/docker/zeo/var/temporary.fs.lock deleted file mode 100644 index c6cf38636..000000000 --- a/docker/zeo/var/temporary.fs.lock +++ /dev/null @@ -1 +0,0 @@ - 1 diff --git a/docker/zeo/var/temporary.fs.tmp b/docker/zeo/var/temporary.fs.tmp deleted file mode 100755 index e69de29bb..000000000 From 1a41f96c9afe51738d86cc9c4270279d16d9407c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Tue, 1 Oct 2024 10:06:35 +0200 Subject: [PATCH 20/39] Remove leftovers from old way of running zope --- docker/Extensions/readme.md | 1 - docker/dockerfile | 37 ----- docker/etc/start.sh | 17 --- docker/etc/zeo.conf | 16 --- docker/etc/zope.conf | 266 ------------------------------------ docker/etc/zope.ini | 75 ---------- docker/var/Data.fs | Bin 14666 -> 0 bytes docker/var/Data.fs.index | 1 - docker/var/Data.fs.lock | 1 - docker/var/Data.fs.tmp | Bin 5422 -> 0 bytes docker/var/Z4.pid | 1 - docker/var/log/Z4.log | 0 docker/var/log/event.log | 0 docker/var/log/zeo.log | 0 14 files changed, 415 deletions(-) delete mode 100755 docker/Extensions/readme.md delete mode 100755 docker/dockerfile delete mode 100755 docker/etc/start.sh delete mode 100755 docker/etc/zeo.conf delete mode 100755 docker/etc/zope.conf delete mode 100755 docker/etc/zope.ini delete mode 100755 docker/var/Data.fs delete mode 100755 docker/var/Data.fs.index delete mode 100755 docker/var/Data.fs.lock delete mode 100755 docker/var/Data.fs.tmp delete mode 100755 docker/var/Z4.pid delete mode 100755 docker/var/log/Z4.log delete mode 100755 docker/var/log/event.log delete mode 100755 docker/var/log/zeo.log diff --git a/docker/Extensions/readme.md b/docker/Extensions/readme.md deleted file mode 100755 index 820867944..000000000 --- a/docker/Extensions/readme.md +++ /dev/null @@ -1 +0,0 @@ -# Externalizing Extensions for Docker \ No newline at end of file diff --git a/docker/dockerfile b/docker/dockerfile deleted file mode 100755 index afaa6eddb..000000000 --- a/docker/dockerfile +++ /dev/null @@ -1,37 +0,0 @@ -FROM alpine - -EXPOSE 8085 -EXPOSE 8086 -EXPOSE 8080 -EXPOSE 5678 - -# Install Zope/ZEO Dependencies -RUN apk add python3 make gcc g++ git -RUN apk update && apk add python3-dev git mariadb-dev openldap-dev curl bash - -# https://stackoverflow.com/questions/49955097/how-do-i-add-a-user-when-im-using-alpine-as-a-base-image -RUN addgroup -S zope && adduser --disabled-password -S zope -G zope -USER zope -WORKDIR /home/zope/ -ENV VIRTUAL_ENV=/home/zope/venv - -RUN python3 -m venv venv -ENV PATH="$VIRTUAL_ENV/bin:$PATH" -RUN pip install -U pip wheel setuptools -RUN pip install -U -e git+https://github.com/zms-publishing/ZMS.git#egg=ZMS -RUN pip install -r https://raw.githubusercontent.com/zms-publishing/ZMS5/master/requirements-full.txt -RUN pip install ZEO -RUN pip install itsdangerous -RUN pip install debugpy - -# Create Zope Instance -RUN mkwsgiinstance -d venv/instance/zms5 -u admin:admin - -COPY ./etc venv/instance/zms5/etc -COPY ./var venv/instance/zms5/var -COPY ./Extensions venv/instance/zms5/Extensions - - -# Finally Start ZEO/Zope by Script -# ENTRYPOINT ["/bin/sh -c"] -CMD ["/home/zope/venv/instance/zms5/etc/start.sh"] \ No newline at end of file diff --git a/docker/etc/start.sh b/docker/etc/start.sh deleted file mode 100755 index 96924caeb..000000000 --- a/docker/etc/start.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# The ZEO/Zope start script works in two steps: -# 1. ZEO server is started silently (nohub) -# 2. Zope instance it started on parameter defined port:8085 -# Sending Zope's output not to dev/null but the console maintains -# docker running - -instance_dir="/home/zope/venv/instance/zms5" -venv_bin_dir="/home/zope/venv/bin" - -echo "Step-1: Starting ZEO" -nohup $venv_bin_dir/runzeo --configure $instance_dir/etc/zeo.conf 1>/dev/null 2>/dev/null & - -echo "Step-2: Starting ZOPE 8085" -$venv_bin_dir/runwsgi --debug --verbose $instance_dir/etc/zope.ini debug-mode=on http_port=8085 - - diff --git a/docker/etc/zeo.conf b/docker/etc/zeo.conf deleted file mode 100755 index 92edb2d77..000000000 --- a/docker/etc/zeo.conf +++ /dev/null @@ -1,16 +0,0 @@ -%define INSTANCE /home/zope/venv/instance/zms5 - - - address $INSTANCE/var/zeosocket - - - - - path $INSTANCE/var/log/zeo.log - format %(asctime)s %(message)s - - - - - path $INSTANCE/var/Data.fs - \ No newline at end of file diff --git a/docker/etc/zope.conf b/docker/etc/zope.conf deleted file mode 100755 index 2dc653171..000000000 --- a/docker/etc/zope.conf +++ /dev/null @@ -1,266 +0,0 @@ -%define INSTANCE /home/zope/venv/instance/zms5 - -instancehome $INSTANCE - -%import ZEO - - - # Main FileStorage database - - server $INSTANCE/var/zeosocket - storage main - name zeostorage Data.fs - client-label zms5 8085 - - mount-point / - - - -# -# -# path $INSTANCE/var/Data.fs -# -# mount-point / -# - - -# Uncomment this if you use Products.Sessions and Products.TemporaryFolder -# -# -# name Temporary database (for sessions) -# -# mount-point /temp_folder -# container-class Products.TemporaryFolder.TemporaryContainer -# - - -# Directive: locale -# -# Description: -# Overwrite the locale settings found in the environment by supplying a -# locale name to be used. See your operating system documentation for -# locale information specific to your system. If the requested locale is -# not supported by your system, an error will be raised and Zope will not -# start. -# -# Default: unset -# -# Example: -# -# locale fr_FR - - -# Directive: environment -# -# Description: -# A section which can be used to define arbitrary key-value pairs -# for use as environment variables during Zope's run cycle. It -# is not recommended to set system-related environment variables such as -# PYTHONPATH within this section. -# -# Default: unset -# -# Example: -# -# -# MY_PRODUCT_ENVVAR foobar -# - - CHAMELEON_CACHE $INSTANCE/var/cache - - - -# Directive: debug-mode -# -# Description: -# A switch which controls several aspects of Zope operation useful for -# developing under Zope. When debug mode is on: -# -# - The process will not detach from the controlling terminal -# -# - Errors in product initialization will cause startup to fail -# (instead of writing error messages to the event log file). -# -# - Filesystem-based scripts such as skins, PageTemplateFiles, and -# DTMLFiles can be edited while the server is running and the server -# will detect these changes in real time. When this switch is -# off, you must restart the server to see the changes. -# -# Setting this to 'off' when Zope is in a production environment is -# encouraged, as it speeds execution (sometimes dramatically). -# -# Default: off -# -# Example: -# -debug-mode on - - -# Directive: debug-exceptions -# -# Description: -# This switch controls how exceptions are handled. If it is set to -# "off" (the default), Zope's own exception handling is active. -# Exception views or a standard_error_message are used to handle them. -# -# If set to "on", exceptions are not handled by Zope and can propagate -# into the WSGI pipeline, where they may be handled by debugging -# middleware. -# -# This setting should always be "off" in production. It is useful for -# developers and while debugging site issues. -# -# Default: off -# -# Example: -# -# debug-exceptions on - - -# Directive: http-realm -# -# Description: -# The HTTP "Realm" header value sent by this Zope instance. This value -# often shows up in basic authentication dialogs. -# -# Default: Zope -# -# Example: -# -# http-realm Slipknot - - -# Directive: webdav-source-port -# -# Description: -# This value designates a network port number as WebDAV source port. -# -# If this value is set to a positive integer, any GET request coming into -# Zope via the designated port will be marked up to signal that this is a -# WebDAV request. This request markup resembles what ZServer did for -# requests coming though its designated WebDAV source server port, so it is -# backwards-compatible for existing code that offers WebDAV handling under -# ZServer. -# -# Please note that Zope itself has no server capabilities and cannot open -# network ports. You need to configure your WSGI server to listen on the -# designated port. -# -# Default: Off -# -# Example: -# -# webdav-source-port 9800 - - -# Directive: zmi-bookmarkable-urls -# -# Description: -# Set this directive to 'on' to cause Zope to show the ZMI right hand -# frame's URL in the browser navigation bar as opposed to the static -# '/manage'. The default is 'on'. To restore the behavior of Zope 2 -# where the URL was always static unless you opened the right-hand frame in -# its own browser window, set this to off. -# -# Default: on -# -# Example: -# -# zmi-bookmarkable-urls off - - -# Directive: pid-filename -# -# Description: -# The path to the file in which the Zope process id(s) will be written. -# This defaults to client-home/Z4.pid. -# -# Default: CLIENT_HOME/Z4.pid -# -# Example: -# -# pid-filename /home/chrism/projects/sessions/var/Z4.pid - - -# Directive: trusted-proxy -# -# Description: -# Define one or more 'trusted-proxies' directives, each of which is a -# hostname or an IP address. The set of definitions comprises a list -# of front-end proxies that are trusted to supply an accurate -# X-Forwarded-For header to Zope. If a connection comes from -# a trusted proxy, Zope will trust any X-Forwarded header to contain -# the user's real IP address for the purposes of address-based -# authentication restriction. -# -# Default: unset -# -# Example: -# -# trusted-proxy www.example.com -# trusted-proxy 192.168.1.1 - - -# Directive: security-policy-implementation -# -# Description: -# The default Zope security machinery is implemented in C. Change -# this to "python" to use the Python version of the Zope security -# machinery. This setting may impact performance but is useful -# for debugging purposes. See also the "verbose-security" option -# below. -# -# Default: C -# -# Example: -# -# security-policy-implementation python - - -# Directive: skip-authentication-checking -# -# Description: -# Set this directive to 'on' to cause Zope to skip checks related -# to authentication, for servers which serve only anonymous content. -# Only works if security-policy-implementation is 'C'. -# -# Default: off -# -# Example: -# -# skip-authentication-checking on - - -# Directive: skip-ownership-checking -# -# Description: -# Set this directive to 'on' to cause Zope to ignore ownership checking -# when attempting to execute "through the web" code. By default, this -# directive is on in order to prevent 'trojan horse' security problems -# whereby a user with less privilege can cause a user with more -# privilege to execute dangerous code. -# -# Default: off -# -# Example: -# -# skip-ownership-checking on - - -# Directive: verbose-security -# -# Description: -# By default, Zope reports authorization failures in a terse manner in -# order to avoid revealing unnecessary information. This option -# modifies the Zope security policy to report more information about -# the reason for authorization failures. It's designed for debugging. -# If you enable this option, you must also set the -# 'security-policy-implementation' to 'python'. -# -# Default: off -# -# Example: -# -# security-policy-implementation python -# verbose-security on - diff --git a/docker/etc/zope.ini b/docker/etc/zope.ini deleted file mode 100755 index 7fdb1f707..000000000 --- a/docker/etc/zope.ini +++ /dev/null @@ -1,75 +0,0 @@ -[app:zope] -use = egg:Zope#main -zope_conf = %(here)s/zope.conf - -[server:main] -use = egg:waitress#main -# host 127.0.0.1 -host = 0.0.0.0 -# port = 8080 -port = %(http_port)s - -[filter:translogger] -use = egg:Paste#translogger -setup_console_handler = False - -[pipeline:main] -pipeline = - egg:Zope#httpexceptions - translogger - zope - -[loggers] -keys = root, waitress.queue, waitress, wsgi - -[handlers] -keys = console, accesslog, eventlog - -[formatters] -keys = generic, message - -[formatter_generic] -format = %(asctime)s %(levelname)s [%(name)s:%(lineno)s][%(threadName)s] %(message)s -datefmt = %Y-%m-%d %H:%M:%S - -[formatter_message] -format = %(message)s - -[logger_root] -level = INFO -handlers = console, eventlog - -[logger_waitress.queue] -level = INFO -handlers = eventlog -qualname = waitress.queue -propagate = 0 - -[logger_waitress] -level = INFO -handlers = eventlog -qualname = waitress - -[logger_wsgi] -level = WARN -handlers = accesslog -qualname = wsgi -propagate = 0 - -[handler_console] -class = StreamHandler -args = (sys.stderr,) -level = NOTSET -formatter = generic - -[handler_accesslog] -class = FileHandler -args = ('/home/zope/venv/instance/zms5/var/log/Z4.log','a') -level = INFO -formatter = message - -[handler_eventlog] -class = FileHandler -args = ('/home/zope/venv/instance/zms5/var/log/event.log', 'a') -level = INFO -formatter = generic diff --git a/docker/var/Data.fs b/docker/var/Data.fs deleted file mode 100755 index a108ea618636e8a2540b4314a97d8eccfcc0a4b6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 14666 zcmeHOU2Gf25vD}_Qa`r-Y)i7`6D?b`C6SUW$+AN!k?puP9sgY97Hk0baJ*aUEO<7Lgs@%zO8Rwms*Q+x#D)=Uxpf1!CE{?U1|^&&h>?p5Kbx3`o~J3WVaXhD*?r zrq9y;ptS^HJMM9MgZA{E^1*<6-TJQJHF#gu&7mca{G;HmuRon2=^o^?Q79O?!V~~) z7rH#&EzqvqxU?DPS|j{#=qN*{Xa_@S*(R$mVnx>9p{$SP=;B`!BL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U*Y*)=fha6+3R9u>~+mzz)1hwc0ng>G_3fMb((Mr6?f0; zaGO@eRq={2d%`9fG`qOmh5k80Cd9LA_43hF7P6xH%x1LZ8TKqe3jRR)YT*YA; zw$h!?lX4r{C{>0@Qi8VajOU&bF2nB59BALZ>gSSa92hQiY{xuLFqurA=|xq00Mf3{ z)KV#Aox6T+@g50X;RSX=O53<^Gv*Yw_PiIV@r3R=^iZ!KVpDzFbHw3JK(ncIL0|Ji zu z;#=%%!qTB|X*Ue>rCI79p~))yt_~yNd=HEs=jL6{W=(>zI*e2Ai1(R`6ejdh9pPj% zQG2{Z?Y6(dNQ7Vd({P}QiP}62@m#_U!_?xn|4=n+4B~jJd{j0q>=y|f@zl_mVe&6Y zayu5*O!u*_TsYnp;flC3`5&csU@B_({ zFS1X|VK()`iN^B1pk^9Rh}R)O$+zP2K1k|_TPXQa#A#^dxQ&wEMBESU9CuKX91-@+ zfW&bpCBq^ffG&$=67eMDIG&>9cM<1c zn&TNt+VQ%>>zRUCj^`*D6Y(_6bG$&wDG|>=p5sMIZi#pnmN;IfL>BQJtZ=+ai7DcF z{4as{BqfhUya1;-K26ETBF@7a$7d+{OvHBIGF;^N5+%Qg zcm*zVe1#HT0^ymg;zu6wHR{6kCvf8l+rp;dgJMR8Fw2}E73_U zM<=xuoz!AFA{TqLb>4K Date: Tue, 1 Oct 2024 10:06:44 +0200 Subject: [PATCH 21/39] Update todo --- docker/TODO.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docker/TODO.md b/docker/TODO.md index db8389f9e..b9d6434f9 100644 --- a/docker/TODO.md +++ b/docker/TODO.md @@ -2,18 +2,18 @@ - [x] one process per container - [X] Starting the bare docker file will give you a basic zope / zms -- [ ] everything as similar to our server deployment as possible to allow easy migration -- [ ] modern os and python +- [x] everything as similar to our server deployment as possible to allow easy migration +- [x] modern os and python - [ ] simple to use and develop in vscode -> .devcontainer! -- [ ] all mutable data in mounted volumes +- [x] all mutable data in mounted volumes - [ ] example systemd files to run everything - [ ] this should show how automated container updates are done! - [ ] example nginx config so you get the same experience as on the server # TODOs -- [ ] Create basic Dockerfile for the project -- [ ] specialize them for zeoserver and zope -- [ ] create docker-compose file that runs each server separately +- [x] Create basic Dockerfile for the project +- [x] specialize them for zeoserver and zope +- [x] create docker-compose file that runs each server separately - [ ] add devcontainer.json to develop and run everything from vscode - [ ] … From efe493ea99ca1803e2441ffe86bf16cddcaf7892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Tue, 1 Oct 2024 10:06:57 +0200 Subject: [PATCH 22/39] Rename --- docker/{readme.md => Readme.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docker/{readme.md => Readme.md} (100%) diff --git a/docker/readme.md b/docker/Readme.md similarity index 100% rename from docker/readme.md rename to docker/Readme.md From e539145461e7e2073892819260d38cac3e91cd70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Tue, 1 Oct 2024 10:22:33 +0200 Subject: [PATCH 23/39] Ensure that the current zms source is always used inside the container --- docker/docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index de902e2f8..ae5acccc6 100755 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -15,6 +15,7 @@ services: volumes: - ./zope/etc/:/home/zope/etc/ - ./zope/var/:/home/zope/var/ + - ..:/home/zope/venv/src/zms/ zeo: image: zms-base:latest From f82fda00bb55328f044314da9bd71cbf9b113544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Tue, 1 Oct 2024 11:35:09 +0200 Subject: [PATCH 24/39] Move docker compose file one level up to make it easier to access. --- docker-compose.yml | 29 +++++++++++++++++++++++++++++ docker/docker-compose.yml | 25 ------------------------- 2 files changed, 29 insertions(+), 25 deletions(-) create mode 100755 docker-compose.yml delete mode 100755 docker/docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100755 index 000000000..d504ff206 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,29 @@ +services: + zms-base: + build: ./docker/zms-base + image: zms-base:latest + entrypoint: "bash -c" + command: "exit 0" + + zope: + image: zms-base:latest + depends_on: + - zeo + stop_grace_period: 1s # SIGKILL after 1s, as zope is always taking the full 10 seconds + ports: + - 80:80 + volumes: + - ./docker/zope/etc/:/home/zope/etc/ + - ./docker/zope/var/:/home/zope/var/ + - ./docker/zope/Extensions/:/home/zope/Extensions/ + - .:/home/zope/venv/src/zms/ + # allow attaching to the container to debug with `breakpoint()` + stdin_open: true + tty: true + + zeo: + image: zms-base:latest + command: runzeo --configure etc/zeo.conf + volumes: + - ./docker/zeo/etc/:/home/zope/etc/ + - ./docker/zeo/var/:/home/zope/var/ diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml deleted file mode 100755 index ae5acccc6..000000000 --- a/docker/docker-compose.yml +++ /dev/null @@ -1,25 +0,0 @@ -services: - zms-base: - build: ./zms-base - image: zms-base:latest - entrypoint: "bash -c" - command: "exit 0" - - zope: - image: zms-base:latest - depends_on: - - zeo - stop_grace_period: 1s # SIGKILL after 1s, as zope is always taking the full 10 seconds - ports: - - 80:80 - volumes: - - ./zope/etc/:/home/zope/etc/ - - ./zope/var/:/home/zope/var/ - - ..:/home/zope/venv/src/zms/ - - zeo: - image: zms-base:latest - command: runzeo --configure etc/zeo.conf - volumes: - - ./zeo/etc/:/home/zope/etc/ - - ./zeo/var/:/home/zope/var/ From 01b720eb77569d4608fd18bc501474b7c5fdce90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Tue, 1 Oct 2024 11:36:15 +0200 Subject: [PATCH 25/39] Adapt VSCode run configuration to new docker configuration --- docker/.vscode/ZMS5-Docker.code-workspace | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docker/.vscode/ZMS5-Docker.code-workspace b/docker/.vscode/ZMS5-Docker.code-workspace index a4448e0cf..dea565780 100755 --- a/docker/.vscode/ZMS5-Docker.code-workspace +++ b/docker/.vscode/ZMS5-Docker.code-workspace @@ -24,7 +24,7 @@ "**/cache/**": true, "**/Data.*": true, }, - "search.exclude": { + "search.exclude": { "**/apidocs/**": true }, "files.eol": "\n", @@ -55,24 +55,24 @@ "args": [ "--debug", "--verbose", - "/home/zope/venv/instance/zms5/etc/zope.ini", + "/home/zope/etc/zope.ini", "debug-mode=on", "http_port=8087", ], "env": { "PYTHONUNBUFFERED":"1", - "CONFIG_FILE": "/home/zope/venv/instance/zms5/etc/zope.ini", - "INSTANCE_HOME": "/home/zope/venv/instance/zms5", - "CLIENT_HOME": "/home/zope/venv/instance/zms5", + "CONFIG_FILE": "/home/zope/etc/zope.ini", + "INSTANCE_HOME": "/home/zope/", + "CLIENT_HOME": "/home/zope/", "PYTHON": "/home/zope/venv/bin/python", "SOFTWARE_HOME": "/home/zope/venv/bin" }, "serverReadyAction":{ - "pattern":"Serving on http://0.0.0.0:8087", - "uriFormat": "http://127.0.0.1:8087/manage_main", + "pattern":"Serving on http://0.0.0.0:80", + "uriFormat": "http://admin:admin@127.0.0.1:80/manage_main", "action": "openExternally", }, }, ] } -} \ No newline at end of file +} From d2592e3b7cccf9b248bb9e967d0e5f36a132be88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Tue, 1 Oct 2024 11:36:23 +0200 Subject: [PATCH 26/39] Update todos --- docker/TODO.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) mode change 100644 => 100755 docker/TODO.md diff --git a/docker/TODO.md b/docker/TODO.md old mode 100644 new mode 100755 index b9d6434f9..35451dd6a --- a/docker/TODO.md +++ b/docker/TODO.md @@ -9,6 +9,7 @@ - [ ] example systemd files to run everything - [ ] this should show how automated container updates are done! - [ ] example nginx config so you get the same experience as on the server +- [ ] Allow working on zms inside the container # TODOs @@ -16,4 +17,4 @@ - [x] specialize them for zeoserver and zope - [x] create docker-compose file that runs each server separately - [ ] add devcontainer.json to develop and run everything from vscode -- [ ] … +- [ ] mount the zms source live into the container so working within it becomes possible From d06e0c3f34e14bdc1627ebcc6a207e1f0a128ae2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Tue, 1 Oct 2024 11:37:03 +0200 Subject: [PATCH 27/39] Comment --- docker/zms-base/Dockerfile | 1 + 1 file changed, 1 insertion(+) mode change 100644 => 100755 docker/zms-base/Dockerfile diff --git a/docker/zms-base/Dockerfile b/docker/zms-base/Dockerfile old mode 100644 new mode 100755 index 2ddb679d8..1967145d2 --- a/docker/zms-base/Dockerfile +++ b/docker/zms-base/Dockerfile @@ -56,6 +56,7 @@ RUN --mount=type=cache,uid=$UID,target=$PIP_CACHE_DIR,sharing=locked < Date: Tue, 1 Oct 2024 11:37:11 +0200 Subject: [PATCH 28/39] Update pemissions --- docker/zeo/.gitignore | 0 docker/zms-base/zope.conf | 0 docker/zms-base/zope.ini | 0 docker/zope/.gitignore | 0 4 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 docker/zeo/.gitignore mode change 100644 => 100755 docker/zms-base/zope.conf mode change 100644 => 100755 docker/zms-base/zope.ini mode change 100644 => 100755 docker/zope/.gitignore diff --git a/docker/zeo/.gitignore b/docker/zeo/.gitignore old mode 100644 new mode 100755 diff --git a/docker/zms-base/zope.conf b/docker/zms-base/zope.conf old mode 100644 new mode 100755 diff --git a/docker/zms-base/zope.ini b/docker/zms-base/zope.ini old mode 100644 new mode 100755 diff --git a/docker/zope/.gitignore b/docker/zope/.gitignore old mode 100644 new mode 100755 From bccc75ded8be11b08b312587e01df78fdd21df99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Tue, 1 Oct 2024 11:37:44 +0200 Subject: [PATCH 29/39] Ignore extensions, as it contains generated files --- docker/zope/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/zope/.gitignore b/docker/zope/.gitignore index 186857b9e..8f23638b6 100755 --- a/docker/zope/.gitignore +++ b/docker/zope/.gitignore @@ -1 +1,2 @@ var +Extensions From c8d808b46eac2c519c0f8c6d81e1bb7b8dd12f40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Tue, 1 Oct 2024 11:38:19 +0200 Subject: [PATCH 30/39] Comment --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index d504ff206..0baf9030a 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,6 +15,7 @@ services: volumes: - ./docker/zope/etc/:/home/zope/etc/ - ./docker/zope/var/:/home/zope/var/ + # TODO seems to contain only generated files. Consider not mapping this folder? - ./docker/zope/Extensions/:/home/zope/Extensions/ - .:/home/zope/venv/src/zms/ # allow attaching to the container to debug with `breakpoint()` From e5da3b8fc01d75bd019c618d3a2f610e4c62cc31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Tue, 1 Oct 2024 11:40:56 +0200 Subject: [PATCH 31/39] Update Readme with changes to containers --- docker/Readme.md | 69 +++++++++++------------------------------------- 1 file changed, 16 insertions(+), 53 deletions(-) diff --git a/docker/Readme.md b/docker/Readme.md index c60894988..677db7348 100755 --- a/docker/Readme.md +++ b/docker/Readme.md @@ -1,71 +1,34 @@ -# Running ZMS in a Docker container with Alpine Linux +# Running ZMS in a Docker container -Important: *The here presented Docker environment is not recommended for production, just for testing and exploration.* +Important: *The presented Docker environment is not yet recommended for production, just for testing and exploration.* We do plan to evolve these to be production ready, but we are not there yet. -The ZMS source folder `./docker` contains two minimalistic Docker files: -1. the [dockerfile](https://github.com/zms-publishing/ZMS/blob/main/docker/dockerfile) for creating a Docker *image* and -2. the [docker-compose](https://github.com/zms-publishing/ZMS/blob/main/docker/docker-compose.yml) file for building a Docker *container*. +The ZMS source folder `./docker` contains two minimalistic Docker files: -The image utilizes a minimal *alpine*-Linux with a fresh compiled Python3 and some additional software packages (like mariadb and openldap). The ZMS installation happens with pip in a successively created virtual python environment (`/home/zope/venv`) and provides the ZMS code in the pip-"editable" mode. Both the ZMS source code (`/home/zope/venv/src/ZMS/.git`) and the Zope instance are placed in the virtual python environment folder (`/home/zope/venv/instance/zms5`) +1. the [Dockerfile](zms-base/Dockerfile) for creating a Docker *image* and +2. the [docker-compose.yml](../docker-compose.yml) file for building the Docker *containers*. -To make Zope running there are some crucial config files needed which usually (created by `mkwsgiinstance`) are set on default values. In a Docker environment these defaults must be modified; moreover the setup contains a ZEO-server for running multiple Zope processes in parallel (e.g. for debugging). That is why a small set of config files is provided as presets via the the source-folders -1. ./docker/var -2. ./docker/etc -3. ./docker/Extensions +The image utilizes a Linux with a fresh Python3 and some additional software packages (like mariadb and openldap). The ZMS installation happens with pip in a virtual python environment (`/home/zope/venv`) and provides the ZMS code in the pip-"editable" mode. Both the ZMS source code (`/home/zope/venv/src/ZMS/.git`) and the Zope instance are placed in the virtual python environment folder (`/home/zope/`) -These sources will be copied into the *image* (on building) -```yaml -# dockerfile -COPY ./etc venv/instance/zms5/etc -COPY ./var venv/instance/zms5/var -COPY ./Extensions venv/instance/zms5/Extensions -``` -or referenced as *volume mounts* from the *container* (on composing): -```yaml -# docker-compose - volumes: - - ./etc/:/home/zope/venv/instance/zms5/etc/ - - ./var/:/home/zope/venv/instance/zms5/var/ - - ./Extensions/: /home/zope/venv/instance/zms5/Extensions -``` +To make Zope running there are some crucial config files needed which usually (created by `mkwsgiinstance`) are set on default values. In a Docker environment these defaults must be modified; moreover the setup contains a ZEO-server for running multiple Zope processes in parallel (e.g. for debugging). That is why a small set of config files is provided as presets via the the source-folders +1. ./docker/{zope,zeo}/etc +1. ./docker/{zope,zeo}/var +1. ./docker/zope/Extensions +These sources are mapped into the respective *containers* ## Overview of Docker- and all Zope config-files -*Hint: to ease the file access from the container the config files are not restricted:* `chmod -r 777` -``` -$ tree -p -. -β”œβ”€β”€ [-rw-r--r--] docker-compose.yml -β”œβ”€β”€ [-rw-r--r--] dockerfile -β”œβ”€β”€ [drwxrwxrwx] Extensions -β”œβ”€β”€ [drwxrwxrwx] etc -β”‚ β”œβ”€β”€ [-rwxrwxrwx] start.sh -β”‚ β”œβ”€β”€ [-rwxrwxrwx] zeo.conf -β”‚ β”œβ”€β”€ [-rwxrwxrwx] zope.conf -β”‚ └── [-rwxrwxrwx] zope.ini -└── [drwxrwxrwx] var - β”œβ”€β”€ [-rwxrwxrwx] Data.fs - β”œβ”€β”€ [-rwxrwxrwx] Data.fs.index - β”œβ”€β”€ [-rwxrwxrwx] Data.fs.lock - β”œβ”€β”€ [-rwxrwxrwx] Data.fs.tmp - β”œβ”€β”€ [-rwxrwxrwx] Z4.pid - β”œβ”€β”€ [drwxrwxrwx] cache - β”œβ”€β”€ [drwxrwxrwx] log - β”‚ β”œβ”€β”€ [-rwxrwxrwx] Z4.log - β”‚ β”œβ”€β”€ [-rwxrwxrwx] event.log - β”‚ └── [-rwxrwxrwx] zeo.log - └── [srwxrwxrwx] zeosocket -``` +*Hint: to ease the file access from the container the config files are not restricted:* `chmod -R 777 ./docker/` ## Running the ZMS Container with VSCode -The VSCode Docker Extension [ms-azuretools.vscode-docker](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker) is a perfect tool for handling containers. A right mouse click on the file Β΄docker-compose.yamlΒ΄ starts composing the container. Initially ZEO will be started and Zope will run on port 8085. +The VSCode Docker Extension [ms-azuretools.vscode-docker](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker) is a perfect tool for handling containers. A right mouse click on the file Β΄docker-compose.yamlΒ΄ starts composing the container. Initially ZEO will be started and Zope will run on http://localhost/, the management interface on http://admin:admin@localhost/manage_main. ![Running the ZMS Container with VSCode](../docs/images/admin_docker_run.gif) ## Attach VSCode to the ZMS Container -Another right click on the running container-ID allows to intrude the container with VSCode and launch a new Zope instance in debugging mode. + +Another right click on the running container-ID allows to intrude the container with VSCode and launch a new Zope instance in debugging mode. Hint: For this purpose the docker-container folder `/home/zope/venv/src/zms/docker/.vscode/` contains a prepared VSCode-workspace file and a launch file for starting Zope in debug-mode within the container [launch.json](https://github.com/zms-publishing/ZMS/blob/main/docker/.vscode/launch.json). The thus launched Zope instance will run port 8087. -![Attach VSCode to the ZMS Container](../docs/images/admin_docker_debug_zeo.gif) \ No newline at end of file +![Attach VSCode to the ZMS Container](../docs/images/admin_docker_debug_zeo.gif) From 3cb2c5300cbe0927cb0a1b67fa62d6f9eb0628f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Tue, 1 Oct 2024 15:36:51 +0200 Subject: [PATCH 32/39] Remove base container, and build zope directly. This gives us a simpler compose file. --- docker-compose.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 0baf9030a..8fd933682 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,12 +1,7 @@ services: - zms-base: - build: ./docker/zms-base - image: zms-base:latest - entrypoint: "bash -c" - command: "exit 0" - zope: - image: zms-base:latest + build: ./docker/base + image: zope:latest depends_on: - zeo stop_grace_period: 1s # SIGKILL after 1s, as zope is always taking the full 10 seconds @@ -23,7 +18,7 @@ services: tty: true zeo: - image: zms-base:latest + image: zope:latest command: runzeo --configure etc/zeo.conf volumes: - ./docker/zeo/etc/:/home/zope/etc/ From bf9e9265f23b83ed6fa7cca865a82479deae7a32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Tue, 1 Oct 2024 15:37:47 +0200 Subject: [PATCH 33/39] Pull up zms source as it's the most important --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 8fd933682..afe8dcada 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,11 +8,11 @@ services: ports: - 80:80 volumes: + - .:/home/zope/venv/src/zms/ - ./docker/zope/etc/:/home/zope/etc/ - ./docker/zope/var/:/home/zope/var/ # TODO seems to contain only generated files. Consider not mapping this folder? - ./docker/zope/Extensions/:/home/zope/Extensions/ - - .:/home/zope/venv/src/zms/ # allow attaching to the container to debug with `breakpoint()` stdin_open: true tty: true From 6fd0c360b48e1291794462706371843d75faa296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Tue, 1 Oct 2024 15:38:05 +0200 Subject: [PATCH 34/39] Stop sharing Extensions folder for now, as it contains auto generated code. --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index afe8dcada..184a334d3 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,8 +11,8 @@ services: - .:/home/zope/venv/src/zms/ - ./docker/zope/etc/:/home/zope/etc/ - ./docker/zope/var/:/home/zope/var/ - # TODO seems to contain only generated files. Consider not mapping this folder? - - ./docker/zope/Extensions/:/home/zope/Extensions/ + # TODO we may want to map these in from outside to ease debugging + # - ./docker/zope/Extensions/:/home/zope/Extensions/ # allow attaching to the container to debug with `breakpoint()` stdin_open: true tty: true From 3a2b53df792ed91b2d292335ed255cd985ea7d8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Tue, 1 Oct 2024 15:38:38 +0200 Subject: [PATCH 35/39] Forgot to record the renames from the dockerfile --- docker/{zms-base => base}/Dockerfile | 9 +-------- docker/{zms-base => base}/start.sh | 0 docker/{zms-base => base}/zope.conf | 0 docker/{zms-base => base}/zope.ini | 0 4 files changed, 1 insertion(+), 8 deletions(-) rename docker/{zms-base => base}/Dockerfile (92%) rename docker/{zms-base => base}/start.sh (100%) rename docker/{zms-base => base}/zope.conf (100%) rename docker/{zms-base => base}/zope.ini (100%) diff --git a/docker/zms-base/Dockerfile b/docker/base/Dockerfile similarity index 92% rename from docker/zms-base/Dockerfile rename to docker/base/Dockerfile index 1967145d2..20c54e48a 100755 --- a/docker/zms-base/Dockerfile +++ b/docker/base/Dockerfile @@ -60,8 +60,6 @@ RUN --mount=type=cache,uid=$UID,target=$PIP_CACHE_DIR,sharing=locked < Date: Tue, 1 Oct 2024 15:39:50 +0200 Subject: [PATCH 36/39] Rename file for clarity --- .vscode/{ZMS5.code-workspace => Native.code-workspace} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .vscode/{ZMS5.code-workspace => Native.code-workspace} (100%) diff --git a/.vscode/ZMS5.code-workspace b/.vscode/Native.code-workspace similarity index 100% rename from .vscode/ZMS5.code-workspace rename to .vscode/Native.code-workspace From 8565e1bda3b18b98235f6745ac9e40008a4e9e14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Tue, 1 Oct 2024 15:40:16 +0200 Subject: [PATCH 37/39] Move and cleanup file for working with devcontainer --- .vscode/Docker.code-workspace | 40 ++++++++++++ docker/.vscode/ZMS5-Docker.code-workspace | 78 ----------------------- 2 files changed, 40 insertions(+), 78 deletions(-) create mode 100755 .vscode/Docker.code-workspace delete mode 100755 docker/.vscode/ZMS5-Docker.code-workspace diff --git a/.vscode/Docker.code-workspace b/.vscode/Docker.code-workspace new file mode 100755 index 000000000..4cce77ffd --- /dev/null +++ b/.vscode/Docker.code-workspace @@ -0,0 +1,40 @@ +{ + "folders": [ + { + "name": "ZMS-Docker", + "path": "../.." + }, + ], + + "launch": { + "version": "0.2.0", + "configurations": [ + { + "name": "ZMS-Docker", + "type": "debugpy", + "request": "launch", + "justMyCode": false, + "console": "integratedTerminal", + "program": "/home/zope/venv/bin/runwsgi", + "args": [ + "--debug", + "--verbose", + "/home/zope/etc/zope.ini", + ], + "env": { + "PYTHONUNBUFFERED":"1", + "CONFIG_FILE": "/home/zope/etc/zope.ini", + "INSTANCE_HOME": "/home/zope/", + "CLIENT_HOME": "/home/zope/", + "PYTHON": "/home/zope/venv/bin/python", + "SOFTWARE_HOME": "/home/zope/venv/bin" + }, + "serverReadyAction":{ + "pattern":"Serving on http://0.0.0.0:80", + "uriFormat": "http://admin:admin@127.0.0.1:80/manage_main", + "action": "openExternally", + }, + }, + ] + } +} diff --git a/docker/.vscode/ZMS5-Docker.code-workspace b/docker/.vscode/ZMS5-Docker.code-workspace deleted file mode 100755 index dea565780..000000000 --- a/docker/.vscode/ZMS5-Docker.code-workspace +++ /dev/null @@ -1,78 +0,0 @@ -{ - "folders": [ - { - "name": "ZMS5-Docker", - "path": "../.." - }, - ], - "settings": { - "python.defaultInterpreterPath": "/home/zope/venv/bin/python", - "window.zoomLevel": 0, - "git.ignoreMissingGitWarning": true, - "editor.minimap.enabled": false, - "editor.renderWhitespace": "all", - "editor.renderControlCharacters": false, - "workbench.iconTheme": "vs-minimal", - "files.associations": { - "*.zpt": "html", - "*.zcml": "xml" - }, - "scm.alwaysShowActions": true, - "files.exclude": { - "*.pyc": true, - "*-all.min.*":true, - "**/cache/**": true, - "**/Data.*": true, - }, - "search.exclude": { - "**/apidocs/**": true - }, - "files.eol": "\n", - "files.autoSave": "afterDelay", - "workbench.colorTheme": "Visual Studio Light", - "python.linting.enabled": false, - "python.formatting.provider": "none", - // "python.testing.pytestEnabled": false, - // "python.testing.unittestEnabled": true, - // "python.testing.unittestArgs": [ - // "-v", - // "-s", - // "./tests", - // "-p", - // "test*.py" - // ], - }, - "launch": { - "version": "0.2.0", - "configurations": [ - { - "name": "ZMS5-Docker", - "type": "debugpy", - "request": "launch", - "program": "/home/zope/venv/bin/runwsgi", - "justMyCode": false, - "console": "integratedTerminal", - "args": [ - "--debug", - "--verbose", - "/home/zope/etc/zope.ini", - "debug-mode=on", - "http_port=8087", - ], - "env": { - "PYTHONUNBUFFERED":"1", - "CONFIG_FILE": "/home/zope/etc/zope.ini", - "INSTANCE_HOME": "/home/zope/", - "CLIENT_HOME": "/home/zope/", - "PYTHON": "/home/zope/venv/bin/python", - "SOFTWARE_HOME": "/home/zope/venv/bin" - }, - "serverReadyAction":{ - "pattern":"Serving on http://0.0.0.0:80", - "uriFormat": "http://admin:admin@127.0.0.1:80/manage_main", - "action": "openExternally", - }, - }, - ] - } -} From 0c60d9727fb9be0803bec1cad180c3490a0f3eb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Tue, 1 Oct 2024 15:40:30 +0200 Subject: [PATCH 38/39] Add devcontainer --- .devcontainer/devcontainer.json | 78 ++++++++++++++++++++++++++++++++ .devcontainer/docker-compose.yml | 6 +++ 2 files changed, 84 insertions(+) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/docker-compose.yml diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..b7232d9ab --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,78 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose +{ + "name": "ZMS Development Environment", + // Update the 'dockerComposeFile' list if you have more compose files or use different names. + // The .devcontainer/docker-compose.yml file contains any overrides you need/want to make. + "dockerComposeFile": ["../docker-compose.yml", "docker-compose.yml"], + // The 'service' property is the name of the service for the container that VS Code should + // use. Update this value and .devcontainer/docker-compose.yml to the real service name. + "service": "zope", + // The optional 'workspaceFolder' property is the path VS Code should open by default when + // connected. This is typically a file mount in .devcontainer/docker-compose.yml + "workspaceFolder": "/home/zope/", + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + // Uncomment the next line if you want start specific services in your Docker Compose config. + // "runServices": [], + // Uncomment the next line if you want to keep your containers running after VS Code shuts down. + "shutdownAction": "stopCompose", + // Uncomment the next line to run commands after the container is created. + // "postCreateCommand": "cat /etc/os-release", + // Configure tool-specific properties. + // "customizations": {}, + "customizations": { + "vscode": { + "extensions": [ + "ms-python.python", + "ms-python.vscode-pylance" + // "ms-python.autopep8" + ], + "settings": { + "terminal.integrated.defaultProfile.linux": "bash", + "python.defaultInterpreterPath": "/home/zope/venv/bin/python", + "window.zoomLevel": 0, + "git.ignoreMissingGitWarning": true, + "editor.minimap.enabled": false, + "editor.renderWhitespace": "all", + "editor.renderControlCharacters": false, + "workbench.iconTheme": "vs-minimal", + "files.associations": { + "*.zpt": "html", + "*.zcml": "xml" + }, + "scm.alwaysShowActions": true, + "files.exclude": { + "*.pyc": true, + "*-all.min.*": true, + "**/cache/**": true, + "**/Data.*": true + }, + "search.exclude": { + "**/apidocs/**": true + }, + "files.eol": "\n", + "files.autoSave": "afterDelay", + "workbench.colorTheme": "Visual Studio Light", + "python.linting.enabled": false, + "python.formatting.provider": "none" + // "python.testing.pytestEnabled": false, + // "python.testing.unittestEnabled": true, + // "python.testing.unittestArgs": [ + // "-v", + // "-s", + // "./tests", + // "-p", + // "test*.py" + // ], + // "[python]": { + // "editor.defaultFormatter": "ms-python.autopep8" + // } + } + } + } + // Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "devcontainer" +} diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml new file mode 100644 index 000000000..26f63927d --- /dev/null +++ b/.devcontainer/docker-compose.yml @@ -0,0 +1,6 @@ +services: + zope: + volumes: + - .:/home/zope/workspace/:cached + # Overrides default command so things don't shut down after the process ends. + command: sleep infinity From 4dc339e21aa0d8cf18a507cbbc1576ba0afb2b4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Tue, 1 Oct 2024 15:51:56 +0200 Subject: [PATCH 39/39] Update todos --- docker/TODO.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/TODO.md b/docker/TODO.md index 35451dd6a..42e6c1691 100755 --- a/docker/TODO.md +++ b/docker/TODO.md @@ -9,7 +9,8 @@ - [ ] example systemd files to run everything - [ ] this should show how automated container updates are done! - [ ] example nginx config so you get the same experience as on the server -- [ ] Allow working on zms inside the container +- [x] Allow working on zms inside the container +- [ ] Full development experience with all dependennt services locally (mariadb, memcached, …) # TODOs