|
| 1 | +# This file is an example .container file for eLabFTW service. Also place the .network file and possible configure HAProxy accordingly. |
| 2 | +# Place it in /etc/containers/systemd so a quadlet is generated and the service can be managed by systemd. |
| 3 | +# Documentation: https://docs.podman.io/en/latest/markdown/podman-systemd.unit.5.html |
| 4 | + |
| 5 | +[Unit] |
| 6 | +Description=elabftw container service |
| 7 | +After=network.target |
| 8 | + |
| 9 | +[Container] |
| 10 | +# Note: it is recommended to pin to a specific version instead of using the "stable" tag. |
| 11 | +Image=docker.io/elabftw/elabimg:stable |
| 12 | +ContainerName=elabftw |
| 13 | + |
| 14 | +# CAPABILITIES |
| 15 | +DropCapability=ALL |
| 16 | +AddCapability=CHOWN |
| 17 | +AddCapability=SETGID |
| 18 | +AddCapability=SETUID |
| 19 | +AddCapability=FOWNER |
| 20 | +AddCapability=DAC_OVERRIDE |
| 21 | +AddCapability=NET_BIND_SERVICE |
| 22 | + |
| 23 | +NoNewPrivileges=true |
| 24 | + |
| 25 | +# HEALTHCHECK |
| 26 | +HealthCmd=curl http://localhost:443/healthcheck |
| 27 | +HealthInterval=5s |
| 28 | +HealthTimeout=5s |
| 29 | +HealthRetries=20 |
| 30 | + |
| 31 | +# ENVIRONMENT VARIABLES |
| 32 | +Environment=DB_HOST=10.X.Y.Z |
| 33 | +Environment=DB_NAME=elabftw |
| 34 | +Environment=DB_USER=elabftw |
| 35 | +Environment=DB_PORT=3306 |
| 36 | +Secret=elabftw-db-password,type=env,target=DB_PASSWORD |
| 37 | +Environment=DB_CERT_PATH=/mysql-cert/mysql.pem |
| 38 | +Secret=elabftw-secret-key,type=env,target=SECRET_KEY |
| 39 | +Environment=SERVER_NAME=eln.example.org |
| 40 | +# in this example we run http server behind TLS terminating proxy |
| 41 | +Environment=DISABLE_HTTPS=true |
| 42 | +Environment=MAX_PHP_MEMORY=512M |
| 43 | +Environment=MAX_UPLOAD_SIZE=1G |
| 44 | +Environment=PHP_TIMEZONE=Europe/Paris |
| 45 | +Environment=TZ=Europe/Paris |
| 46 | +Environment=SET_REAL_IP=true |
| 47 | +Environment=SET_REAL_IP_FROM=10.X.Y.Z |
| 48 | +Environment=PHP_MAX_CHILDREN=50 |
| 49 | +Environment=PHP_MAX_EXECUTION_TIME=90 |
| 50 | +Environment=USE_REDIS=true |
| 51 | +Environment=REDIS_HOST=10.X.Y.Z |
| 52 | +Environment=REDIS_PORT=6379 |
| 53 | +Environment=REDIS_USERNAME=elabftw_php_sessions |
| 54 | +Secret=redis-password,type=env,target=REDIS_PASSWORD |
| 55 | +Environment=ENABLE_IPV6=false |
| 56 | +Environment=SITE_URL=https://eln.example.org |
| 57 | +Environment=ELABFTW_USER=nobody |
| 58 | +Environment=ELABFTW_GROUP=nobody |
| 59 | +Environment=ELABFTW_USERID=65534 |
| 60 | +Environment=ELABFTW_GROUPID=65534 |
| 61 | +Environment=STATUS_PASSWORD=secr3t |
| 62 | +# if using S3 storage |
| 63 | +Secret=elabftw-s3-ak,type=env,target=ELAB_AWS_ACCESS_KEY |
| 64 | +Secret=elabftw-s3-sk,type=env,target=ELAB_AWS_SECRET_KEY |
| 65 | + |
| 66 | +# VOLUMES |
| 67 | +# if not using s3, bind mount the uploads folder in the host |
| 68 | +# do NOT add :z here because NFS cause an issue # |
| 69 | +# host:container |
| 70 | +Volume=/mnt/data/elabftw_uploads:/elabftw/uploads |
| 71 | +# this is necessary if you encrypt mysql connection and thus want the container to have access to the mysql cert |
| 72 | +Volume=/deltablot/mysql:/mysql-cert:z |
| 73 | + |
| 74 | +# NETWORKS |
| 75 | +Network=elabftw.network |
| 76 | + |
| 77 | +[Service] |
| 78 | +# see: https://gist.github.com/ageis/f5595e59b1cddb1513d1b425a323db04 |
| 79 | +LockPersonality=yes |
| 80 | +PrivateTmp=yes |
| 81 | +ProtectHome=yes |
| 82 | +ProtectKernelModules=yes |
| 83 | +Restart=unless-stopped |
| 84 | +RestrictAddressFamilies=AF_UNIX AF_INET AF_NETLINK |
| 85 | +RestrictRealtime=yes |
| 86 | + |
| 87 | +# these ones break container execution |
| 88 | +#NoNewPrivileges=yes |
| 89 | +#PrivateDevices=yes |
| 90 | +#DevicePolicy=closed |
| 91 | +#ProtectSystem=strict |
| 92 | +#ProtectControlGroups=yes |
| 93 | +#ProtectKernelTunables=yes |
| 94 | +#RestrictNamespaces=yes |
| 95 | +#RestrictSUIDSGID=yes |
| 96 | +#MemoryDenyWriteExecute=yes |
| 97 | + |
| 98 | +[Install] |
| 99 | +WantedBy=multi-user.target |
0 commit comments