mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-20 06:26:57 +00:00
Merge pull request #1249 from nextcloud/enh/1233/nextcloud-entrypoint-root
change entrypoint of nextcloud container to root
This commit is contained in:
commit
d6f0023a42
7 changed files with 28 additions and 21 deletions
|
|
@ -202,6 +202,7 @@ RUN set -ex; \
|
|||
postgresql-client \
|
||||
tzdata \
|
||||
mawk \
|
||||
sudo \
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
|
@ -249,7 +250,8 @@ VOLUME /mnt/ncdata
|
|||
# Give root a random password
|
||||
RUN echo "root:$(openssl rand -base64 12)" | chpasswd
|
||||
|
||||
USER www-data
|
||||
USER root
|
||||
ENTRYPOINT ["/start.sh"]
|
||||
CMD ["sudo", "-u", "www-data", "/usr/bin/supervisord", "-c", "/supervisord.conf"]
|
||||
|
||||
HEALTHCHECK CMD (nc -z localhost 9000 && nc -z localhost 7867) || exit 1
|
||||
HEALTHCHECK CMD (sudo -u www-data nc -z localhost 9000 && sudo -u www-data nc -z localhost 7867) || exit 1
|
||||
|
|
@ -32,8 +32,8 @@ fi
|
|||
touch "$NEXTCLOUD_DATA_DIR/this-is-a-test-file" &>/dev/null
|
||||
if ! [ -f "$NEXTCLOUD_DATA_DIR/this-is-a-test-file" ]; then
|
||||
echo "The www-data user doesn't seem to have access rights in the datadir.
|
||||
Did you maybe change the datadir and did forget to apply the correct permissions?
|
||||
See https://github.com/nextcloud/all-in-one#how-to-change-the-default-location-of-nextclouds-datadir
|
||||
Most likely are the files located on a drive that does not follow linux permissions.
|
||||
Please adjust the permissions like mentioned below.
|
||||
The found permissions are:
|
||||
$(stat -c "%u:%g %a" "$NEXTCLOUD_DATA_DIR")
|
||||
(userID:groupID permissions)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ "$EUID" = 0 ]]; then
|
||||
sudo -u www-data -sE
|
||||
fi
|
||||
|
||||
SUBJECT="$1"
|
||||
MESSAGE="$2"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Only start container if database is accessible
|
||||
while ! nc -z "$POSTGRES_HOST" 5432; do
|
||||
while ! sudo -u www-data nc -z "$POSTGRES_HOST" 5432; do
|
||||
echo "Waiting for database to start..."
|
||||
sleep 5
|
||||
done
|
||||
|
|
@ -13,7 +13,7 @@ export POSTGRES_USER
|
|||
# Fix false database connection on old instances
|
||||
if [ -f "/var/www/html/config/config.php" ]; then
|
||||
sleep 2
|
||||
while ! psql -d "postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:5432/$POSTGRES_DB" -c "select now()"; do
|
||||
while ! sudo -u www-data psql -d "postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:5432/$POSTGRES_DB" -c "select now()"; do
|
||||
echo "Waiting for the database to start..."
|
||||
sleep 5
|
||||
done
|
||||
|
|
@ -28,8 +28,16 @@ if [ -n "$TRUSTED_CACERTS_DIR" ]; then
|
|||
update-ca-certificates
|
||||
fi
|
||||
|
||||
# Check datadir permissions
|
||||
sudo -u www-data touch "$NEXTCLOUD_DATA_DIR/this-is-a-test-file" &>/dev/null
|
||||
if ! [ -f "$NEXTCLOUD_DATA_DIR/this-is-a-test-file" ]; then
|
||||
chown -R www-data:root "$NEXTCLOUD_DATA_DIR"
|
||||
chmod 750 -R "$NEXTCLOUD_DATA_DIR"
|
||||
fi
|
||||
sudo -u www-data rm -f "$NEXTCLOUD_DATA_DIR/this-is-a-test-file"
|
||||
|
||||
# Run original entrypoint
|
||||
if ! bash /entrypoint.sh; then
|
||||
if ! sudo -u www-data bash /entrypoint.sh; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue