Compare commits

...

5 Commits

Author SHA1 Message Date
9a838df27c FIX #7: ignore healthchecks entries
All checks were successful
Container Publish / on-success-skip (push) Has been skipped
Container Publish / build-image (amd64) (push) Successful in 19s
Container Publish / build-image (arm64) (push) Successful in 21s
Vulnerability Scan / Daily Vulnerability Scan (amd64, latest) (push) Successful in 23s
Vulnerability Scan / Daily Vulnerability Scan (amd64, latest-php74) (push) Successful in 23s
Vulnerability Scan / Daily Vulnerability Scan (arm64, latest) (push) Successful in 7s
Vulnerability Scan / Daily Vulnerability Scan (arm64, latest-php74) (push) Successful in 6s
Container Publish / update docker manifest (push) Successful in 10s
2025-07-31 15:44:14 +02:00
b8c4e51fbe FIX #4: added DISABLE_STATS flag and moved stats refresh in a dedicated script 2025-07-31 15:43:47 +02:00
8d534bfd9b fix #7: goaccess ignore localhost 2025-07-31 15:34:25 +02:00
7323fab689 docs 2025-07-31 15:31:01 +02:00
796341c7a0 FIX #2: added DISABLE_SFTP flag 2025-07-31 15:26:45 +02:00
7 changed files with 57 additions and 31 deletions

View File

@@ -17,25 +17,36 @@ services:
- 2222:22 # sftp access
volumes:
- ./data:/data
- ./ssh:/ssh # add authorized_keys file here
- ./extra_nginx.conf:/etc/nginx/custom.d/extra.conf # optional
- ./htpasswd:/app/htpasswd # optional, for webdav auth
environment:
LOG_DAYS: 14 # default 7
WEBDAV_PORT: 8080 # default: 8080
STATS_PORT: 8081 # default: 8081
PHP: php84 # none (default), php82, php83, php84
POSTSIZE: 256M # default: 256M
PUID: 1000 # default: 1000
PGID: 1000 # default: 1000
USERNAME: theuser # default: theuser
GROUPNAME: thegroup # default: thegroup
TZ: Etc/UTC # default: Etc/UTC
FPM_MAX_CHILDREN: 5 # default: 5
FPM_START_SERVERS: 1 # default: 1
FPM_MIN_SPARE_SERVERS: 1 # default: 1
FPM_MAX_SPARE_SERVERS: 3 # default: 3
DISABLE_WEBROOT_CHOWN: 1 # default: 0
LOG_DAYS: 14 # default 7
WEBDAV_PORT: 8080 # default: 8080
STATS_PORT: 8081 # default: 8081
PHP: php84 # none (default), php82, php83, php84
POSTSIZE: 256M # default: 256M
PUID: 1000 # default: 1000
PGID: 1000 # default: 1000
USERNAME: theuser # default: theuser
GROUPNAME: thegroup # default: thegroup
TZ: Etc/UTC # default: Etc/UTC
FPM_MAX_CHILDREN: 5 # default: 5
FPM_START_SERVERS: 1 # default: 1
FPM_MIN_SPARE_SERVERS: 1 # default: 1
FPM_MAX_SPARE_SERVERS: 3 # default: 3
DISABLE_WEBROOT_CHOWN: 1 # default: 0
DISABLE_SFTP: 1 # default: 0
DISABLE_STATS: 1 # default: 0
```
The `/data/www` and `/data/logs` directories and their contents will be chowned to `$PUID:$PGID` and chmodded to `0755` for directories and `0644` for files at container start.
## data direcvtory layout
| directory | content |
|-----------|-----------------------------------------------|
| auth | htpasswd files for stats and webdav |
| logs | nginx access logs (logrotated) and error logs |
| ssh | host keys and authorized keys |
| stats | html statistical report |
| stats.db | internal statistical db |
| www | webroot |

View File

@@ -1,11 +0,0 @@
services:
web:
image: docker.asperti.com/paspo/webserver-nginx
ports:
- 8888:80
- 2222:22
volumes:
- ./www:/data/www
- ./ssh:/ssh # add authorized_keys file here
environment:
PHP: php84 # none (default), php82, php83, php84

View File

@@ -25,6 +25,8 @@ FPM_MIN_SPARE_SERVERS=${FPM_MIN_SPARE_SERVERS:-1}
FPM_MAX_SPARE_SERVERS=${FPM_MAX_SPARE_SERVERS:-3}
DISABLE_WEBROOT_CHOWN=${DISABLE_WEBROOT_CHOWN:-0}
DISABLE_SFTP=${DISABLE_SFTP:-0}
DISABLE_STATS=${DISABLE_STATS:-0}
export USERNAME
export GROUPNAME
@@ -49,6 +51,8 @@ export FPM_MIN_SPARE_SERVERS
export FPM_MAX_SPARE_SERVERS
export DISABLE_WEBROOT_CHOWN
export DISABLE_SFTP
export DISABLE_STATS
# run all scripts in order
run-parts /app/entrypoint.sh.d

View File

@@ -18,7 +18,7 @@ ${PATH_LOGS}/nginx-access.log {
su ${USERNAME} ${GROUPNAME}
postrotate
/usr/sbin/nginx -s reopen
nice -n 19 /usr/bin/goaccess ${PATH_LOGS}/nginx-access.log.1 --agent-list --anonymize-ip --real-os --output ${PATH_STATS}/index.html --log-format COMBINED --tz="${TZ}" --db-path=${PATH_STATSDB} --persist --restore
nice -n 19 /app/stats.sh
endscript
}
EOF

View File

@@ -1,5 +1,9 @@
#!/bin/sh
if [ ${DISABLE_SFTP} -eq 1 ] ; then
exit 0
fi
echo "# Configuring ssh"
# make sure directory exists
@@ -23,8 +27,7 @@ if [ -d "${PATH_WEBROOT}/.ssh" ] ; then
chmod 0700 "${PATH_WEBROOT}/.ssh"
fi
# configure sshd
cat >/etc/ssh/sshd_config.d/sshd.conf <<EOF
HostKey ${PATH_SSH_HOST}/ssh_host_rsa_key
HostKey ${PATH_SSH_HOST}/ssh_host_ecdsa_key

View File

@@ -1,5 +1,9 @@
#!/bin/sh
if [ ${DISABLE_STATS} -eq 1 ] ; then
exit 0
fi
echo "# Configuring stats"
# make sure paths exists

15
rootfs/app/stats.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
if [ "${DISABLE_STATS:-0}" -eq 1 ] ; then
exit 0
fi
PATH_BASE=/data
PATH_STATS=${PATH_BASE}/stats
PATH_STATSDB=${PATH_BASE}/stats.db
PATH_LOGS=${PATH_BASE}/logs
/usr/bin/goaccess "${PATH_LOGS}/nginx-access.log.1" \
--agent-list --anonymize-ip --real-os --exclude-ip 127.0.0.1 \
--output "${PATH_STATS}/index.html" --log-format COMBINED \
--tz="${TZ}" "--db-path=${PATH_STATSDB}" --persist --restore