mirror of
https://github.com/projectsend/projectsend.git
synced 2026-09-16 16:45:07 +00:00
6e47d76ba6
Client file sharing, rebuilt from the ground up: a private area per client, resumable uploads, folders, groups and categories, sharing with expiry dates and download limits, comments, file versions, an activity log, a REST API, and sixteen languages. This repository begins here. ProjectSend 2 was developed privately, and that development history is not published — the previous generation remains available, with its own history, at projectsend/legacy. Free software under the GNU General Public License v2, or (at your option) any later version.
45 lines
2.1 KiB
Bash
45 lines
2.1 KiB
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
# php-fpm's master process must stay root: it forks workers as www-data
|
|
# itself via the pool config (php-fpm can't reopen its own error_log as
|
|
# non-root at startup). queue:work/schedule:work have no such fork model,
|
|
# so they drop straight to www-data (uid/gid matches the host user, see
|
|
# Dockerfile ARGs) instead of running as root for their whole lifetime.
|
|
|
|
# The app writes to these as www-data, and boot is the one moment this
|
|
# container runs as root — so repair ownership here, every boot. Root-run
|
|
# `docker compose exec` shells and uid changes across image rebuilds leave
|
|
# root-owned directories behind, and the first symptom is an opaque
|
|
# "mkdir(): Permission denied" 500 on upload. The file library's contents
|
|
# are deliberately NOT chowned recursively: -R over a large library on
|
|
# every boot is not free, and new writes only need the directories.
|
|
mkdir -p storage/app/files storage/app/private storage/app/public storage/app/uploads-tmp \
|
|
storage/framework/cache storage/framework/sessions storage/framework/testing storage/framework/views \
|
|
storage/logs bootstrap/cache
|
|
chown www-data:www-data storage storage/app storage/app/files storage/app/private storage/app/public
|
|
chown -R www-data:www-data storage/app/uploads-tmp storage/framework storage/logs bootstrap/cache
|
|
|
|
# First-boot bootstrap runs only for the FPM service (the worker execs
|
|
# straight through) and only when the app is actually installed.
|
|
if [ "$1" = "php-fpm" ] && [ -f vendor/autoload.php ]; then
|
|
su-exec www-data php artisan migrate --force
|
|
su-exec www-data php artisan storage:link --force
|
|
su-exec www-data php artisan projectsend:ensure-roles
|
|
|
|
# Unattended provisioning: create the first administrator from the
|
|
# environment. Without these, the web setup screen prompts instead.
|
|
if [ -n "$ADMIN_EMAIL" ] && [ -n "$ADMIN_PASSWORD" ]; then
|
|
su-exec www-data php artisan projectsend:admin --if-none \
|
|
--name="${ADMIN_NAME:-Administrator}" \
|
|
--email="$ADMIN_EMAIL" \
|
|
--password="$ADMIN_PASSWORD"
|
|
fi
|
|
fi
|
|
|
|
if [ "$1" = "php-fpm" ]; then
|
|
exec "$@"
|
|
else
|
|
exec su-exec www-data "$@"
|
|
fi
|