-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
146 additions
and
58 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"flake8.cwd": "${workspaceFolder}", | ||
"flake8.args": ["--config=pyproject.toml"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
if [ -z "${PIP_PARAMS}" ]; then | ||
PIP_PARAMS="" | ||
fi | ||
|
||
# Only in build time we should have a secret with | ||
# admin password | ||
if [ -f "/run/secrets/ADMIN_PASSWORD" ]; then | ||
echo "Found /run/secrets/ADMIN_PASSWORD file, using it as secret" | ||
ADMIN_PASSWORD=$(cat /run/secrets/ADMIN_PASSWORD); | ||
export ADMIN_PASSWORD=${ADMIN_PASSWORD} | ||
fi | ||
|
||
# CLIENT HOME | ||
CLIENT_HOME="/data/$(hostname)/$(hostid)" | ||
export CLIENT_HOME=$CLIENT_HOME | ||
|
||
USER="$(id -u)" | ||
|
||
# Create directories to be used by Plone | ||
mkdir -p /data/filestorage /data/blobstorage /data/cache /data/log $CLIENT_HOME | ||
if [ "$USER" = '0' ]; then | ||
find /data -not -user plone -exec chown plone:plone {} \+ | ||
sudo="gosu plone" | ||
else | ||
sudo="" | ||
fi | ||
|
||
# MAIN ENV Vars | ||
[ -z ${SECURITY_POLICY_IMPLEMENTATION+x} ] && export SECURITY_POLICY_IMPLEMENTATION=C | ||
[ -z ${VERBOSE_SECURITY+x} ] && export VERBOSE_SECURITY=off | ||
[ -z ${DEFAULT_ZPUBLISHER_ENCODING+x} ] && export DEFAULT_ZPUBLISHER_ENCODING=utf-8 | ||
[ -z ${DEBUG_MODE+x} ] && export DEBUG_MODE=off | ||
[ -z ${ZOPE_FORM_MEMORY_LIMIT+x} ] && export ZOPE_FORM_MEMORY_LIMIT=50MB | ||
|
||
# ZODB ENV Vars | ||
[ -z ${ZODB_CACHE_SIZE+x} ] && export ZODB_CACHE_SIZE=50000 | ||
|
||
if [[ -v RELSTORAGE_DSN ]]; then | ||
MSG="Using Relstorage configuration" | ||
CONF=relstorage.conf | ||
# Relstorage ENV Vars | ||
[ -z ${RELSTORAGE_NAME+x} ] && export RELSTORAGE_NAME=storage | ||
[ -z ${RELSTORAGE_READ_ONLY+x} ] && export RELSTORAGE_READ_ONLY=off | ||
[ -z ${RELSTORAGE_KEEP_HISTORY+x} ] && export RELSTORAGE_KEEP_HISTORY=true | ||
[ -z ${RELSTORAGE_COMMIT_LOCK_TIMEOUT+x} ] && export RELSTORAGE_COMMIT_LOCK_TIMEOUT=30 | ||
[ -z ${RELSTORAGE_CREATE_SCHEMA+x} ] && export RELSTORAGE_CREATE_SCHEMA=true | ||
[ -z ${RELSTORAGE_SHARED_BLOB_DIR+x} ] && export RELSTORAGE_SHARED_BLOB_DIR=false | ||
[ -z ${RELSTORAGE_BLOB_CACHE_SIZE+x} ] && export RELSTORAGE_BLOB_CACHE_SIZE=100mb | ||
[ -z ${RELSTORAGE_BLOB_CACHE_SIZE_CHECK+x} ] && export RELSTORAGE_BLOB_CACHE_SIZE_CHECK=10 | ||
[ -z ${RELSTORAGE_BLOB_CACHE_SIZE_CHECK_EXTERNAL+x} ] && export RELSTORAGE_BLOB_CACHE_SIZE_CHECK_EXTERNAL=false | ||
[ -z ${RELSTORAGE_BLOB_CHUNK_SIZE+x} ] && export RELSTORAGE_BLOB_CHUNK_SIZE=1048576 | ||
[ -z ${RELSTORAGE_CACHE_LOCAL_MB+x} ] && export RELSTORAGE_CACHE_LOCAL_MB=10 | ||
[ -z ${RELSTORAGE_CACHE_LOCAL_OBJECT_MAX+x} ] && export RELSTORAGE_CACHE_LOCAL_OBJECT_MAX=16384 | ||
[ -z ${RELSTORAGE_CACHE_LOCAL_COMPRESSION+x} ] && export RELSTORAGE_CACHE_LOCAL_COMPRESSION=none | ||
[ -z ${RELSTORAGE_CACHE_DELTA_SIZE_LIMIT+x} ] && export RELSTORAGE_CACHE_DELTA_SIZE_LIMIT=100000 | ||
elif [[ -v ZEO_ADDRESS ]]; then | ||
MSG="Using ZEO configuration" | ||
CONF=zeo.conf | ||
# Check ZEO variables | ||
[ -z ${ZEO_SHARED_BLOB_DIR+x} ] && export ZEO_SHARED_BLOB_DIR=off | ||
[ -z ${ZEO_READ_ONLY+x} ] && export ZEO_READ_ONLY=false | ||
[ -z ${ZEO_CLIENT_READ_ONLY_FALLBACK+x} ] && export ZEO_CLIENT_READ_ONLY_FALLBACK=false | ||
[ -z ${ZEO_STORAGE+x} ] && export ZEO_STORAGE=1 | ||
[ -z ${ZEO_CLIENT_CACHE_SIZE+x} ] && export ZEO_CLIENT_CACHE_SIZE=128MB | ||
[ -z ${ZEO_DROP_CACHE_RATHER_VERIFY+x} ] && export ZEO_DROP_CACHE_RATHER_VERIFY=false | ||
else | ||
MSG="Using default configuration" | ||
CONF=zope.conf | ||
fi | ||
|
||
# Handle CORS | ||
$sudo /app/bin/python /app/scripts/cors.py | ||
|
||
# Handle ADDONS installation | ||
if [[ -v ADDONS ]]; then | ||
echo "=======================================================================================" | ||
echo "Installing ADDONS ${ADDONS}" | ||
echo "THIS IS NOT MEANT TO BE USED IN PRODUCTION" | ||
echo "Read about it: https://github.com/plone/plone-backend/#extending-from-this-image" | ||
echo "=======================================================================================" | ||
/app/bin/pip install ${ADDONS} ${PIP_PARAMS} | ||
fi | ||
|
||
# Handle development addons | ||
if [[ -v DEVELOP ]]; then | ||
echo "=======================================================================================" | ||
echo "Installing DEVELOPment addons ${DEVELOP}" | ||
echo "THIS IS NOT MEANT TO BE USED IN PRODUCTION" | ||
echo "Read about it: https://github.com/plone/plone-backend/#extending-from-this-image" | ||
echo "=======================================================================================" | ||
/app/bin/pip install --editable ${DEVELOP} ${PIP_PARAMS} | ||
fi | ||
|
||
if [[ "$1" == "start" ]]; then | ||
# Handle Site creation | ||
if [[ -v SITE ]]; then | ||
export TYPE=${TYPE:-volto} | ||
echo "=======================================================================================" | ||
echo "Creating Plone ${TYPE} SITE: ${SITE}" | ||
echo "Additional profiles: ${PROFILES}" | ||
echo "THIS IS NOT MEANT TO BE USED IN PRODUCTION" | ||
echo "Read about it: https://github.com/plone/plone-backend/#extending-from-this-image" | ||
echo "=======================================================================================" | ||
export SITE_ID=${SITE} | ||
$sudo /app/bin/zconsole run etc/${CONF} /app/scripts/create_site.py | ||
fi | ||
echo $MSG | ||
exec $sudo /app/bin/runwsgi -v etc/zope.ini config_file=${CONF} | ||
elif [[ "$1" == "create-classic" ]]; then | ||
export TYPE=classic | ||
exec $sudo /app/bin/zconsole run etc/${CONF} /app/scripts/create_site.py | ||
elif [[ "$1" == "create-volto" ]]; then | ||
export TYPE=volto | ||
exec $sudo /app/bin/zconsole run etc/${CONF} /app/scripts/create_site.py | ||
elif [[ "$1" == "create-site" ]]; then | ||
export TYPE=volto | ||
exec $sudo /app/bin/zconsole run etc/${CONF} /app/scripts/create_site.py | ||
elif [[ "$1" == "console" ]]; then | ||
exec $sudo /app/bin/zconsole debug etc/${CONF} | ||
elif [[ "$1" == "run-maintenance" ]]; then | ||
exec $sudo /app/bin/zconsole run etc/${CONF} /app/scripts/run_maintenance.py ${@:2} | ||
elif [[ "$1" == "run" ]]; then | ||
exec $sudo /app/bin/zconsole run etc/${CONF} ${@:2} | ||
else | ||
# Custom | ||
exec "$@" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters