Commit 6bdb52cd authored by Open Science Conservation Fund's avatar Open Science Conservation Fund
Browse files

better handling of docker named volume oermissions; refreshed logos

parent 024c1aaa
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -56,7 +56,9 @@ RUN echo '{ "version": "'${APP_VERSION}'" }' > /version.json
RUN groupadd -g ${TRAPPER_USER_GID} trapper && \
    useradd trapper -u ${TRAPPER_USER_UID} -g ${TRAPPER_USER_GID} && \
    chown -R trapper /app/trapper-project && \
    chown -R trapper /app/locale
    chown -R trapper /app/locale && \
    mkdir -p /app/static /app/media /app/external_media && \
    chown trapper:trapper /app/static /app/media /app/external_media

ENTRYPOINT ["/app/entrypoint.sh"]
CMD ["/app/command_prod.sh"]
+3 −1
Original line number Diff line number Diff line
@@ -56,7 +56,9 @@ RUN echo '{ "version": "'${APP_VERSION}'" }' > /version.json
RUN groupadd -g ${TRAPPER_USER_GID} trapper && \
    useradd trapper -u ${TRAPPER_USER_UID} -g ${TRAPPER_USER_GID} && \
    chown -R trapper /app/trapper-project && \
    chown -R trapper /app/locale
    chown -R trapper /app/locale && \
    mkdir -p /app/static /app/media /app/external_media && \
    chown trapper:trapper /app/static /app/media /app/external_media

ENTRYPOINT ["/app/entrypoint.sh"]
CMD ["/app/command_dev.sh"]
+1 −2
Original line number Diff line number Diff line
<p align="center">
  <img src="https://gitlab.com/trapper-project/trapper/-/raw/master/trapper/trapper-project/trapper/apps/common/static/images/logo/logo_text.png">
  <img src="trapper/trapper-project/trapper/apps/common/static/images/logo/logo_text.png">
</p>

<div align="center"> 
@@ -65,7 +65,6 @@ TRAPPER offers a novel solution: a fully open-source web application that uses s
If you want to install Trapper Expert with the basic functionalities of the system, then execute each of the steps below.

1. You need Docker Engine and Docker Compose to run TRAPPER:

   - Installing [Docker Engine](https://docs.docker.com/install/)
   - Installing [Docker Compose](https://docs.docker.com/compose/)

+42 −9
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@ USER_UID=${TRAPPER_USER_UID:-"1000"}
USER_GID=${TRAPPER_USER_GID:-"1000"}
FORCE_CHOWN=${TRAPPER_USER_CHOWN:-"0"}

# Change UID and GID if provided if different then 1000
# Change UID and GID if provided and  different from 1000
if [[ "$USER_GID" != "1000" ]]
then
    echo "Changing UID and GID to $USER_UID:$USER_GID"
@@ -17,7 +17,7 @@ then
    usermod -u $USER_UID trapper
    groupmod -g $USER_GID trapper
    chown trapper:trapper /app/trapper-project/
    # Chown logs file is necessary to start the container
    # Changing ownership of the logs file is necessary to start the container
    if [ -f "trapper-project/celerybeat-schedule" ]; then
        chown -R trapper:trapper /app/trapper-project/celerybeat-schedule
    fi
@@ -27,15 +27,48 @@ fi
if [[ "$FORCE_CHOWN" != "0" ]]
then
    # Change ownership of /app and necessary directories to the created user
    # Please note that all files which are located in the user’s home directory will
    # have the file UID changed automatically. However, files outside user’s home 
    # directory need to be changed manually. To manually change files with old GID and 
    # UID respectively.
    # WARNING: This can be very slow for volumes with many files (e.g., media directories)
    # Only use this for initial setup or when absolutely necessary
    echo "WARNING: TRAPPER_USER_CHOWN is set - performing full chown (this may be slow)"
    chown -R trapper:trapper /app
else
    # Smart chown: only fix ownership of critical directories that need write access
    # Skip large volume directories (media, external_media, static) unless explicitly requested
    echo "Ensuring ownership of critical directories (skipping large volumes)"
    
    # Only chown if ownership is incorrect (check first to avoid unnecessary operations)
    for dir in /app/trapper-project/logs; do
        if [ -d "$dir" ]; then
            DIR_UID=$(stat -c '%u' "$dir")
            DIR_GID=$(stat -c '%g' "$dir")
            if [[ "$DIR_UID" != "$USER_UID" ]] || [[ "$DIR_GID" != "$USER_GID" ]]; then
                echo "Fixing ownership of $dir"
                chown -R trapper:trapper "$dir"
            fi
        fi
    done
    
    # Create volume mount points with correct ownership if they don't exist
    # This ensures new volumes start with correct permissions
    for dir in /app/static /app/media /app/external_media; do
        if [ ! -d "$dir" ]; then
            echo "Creating $dir with correct ownership"
            mkdir -p "$dir"
            chown trapper:trapper "$dir"
        else
            # Only fix the mount point itself, not recursively
            DIR_UID=$(stat -c '%u' "$dir")
            DIR_GID=$(stat -c '%g' "$dir")
            if [[ "$DIR_UID" != "$USER_UID" ]] || [[ "$DIR_GID" != "$USER_GID" ]]; then
                echo "Fixing ownership of $dir (mount point only)"
                chown trapper:trapper "$dir"
            fi
        fi
    done
fi

# start myapp
echo "INFO: Running myapp as ${USERNAME} (${USER_UID}:${USER_GID})"
# Start the main container process as the trapper user
echo "INFO: Running TRAPPER as ${USERNAME} (${USER_UID}:${USER_GID})"

# exec and run the actual process specified in the CMD of the Dockerfile (which gets passed as ${*})
# Execute the process specified by the Dockerfile CMD (passed as ${*})
exec gosu "${USERNAME}" "${@}" 
+1 −1
Original line number Diff line number Diff line
body {
    padding: 70px 0 40px;
    background: #eee
    background: #ffffff
}

h2+h3 {
Loading