mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 13:10:37 -04:00
fix(installer): change data directories only after checks and downloads
install.sh created the resource directories and ran chown -R and chmod -R on source, ssh, and images before step 1. When a check or a CDN download failed, the changed owners and modes stayed although nothing was installed. Create only /data/coolify and source (for the log and the downloads) at the start. Create the other directories and set the permissions in the SSH key step, after the checks and downloads succeed. Closes #11973 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
6785c08961
commit
97f451cc2a
+18
-8
@@ -31,14 +31,21 @@ fi
|
||||
|
||||
# Resource directories hold data whose owner and mode the resource images or a non-root SSH user need.
|
||||
# Set their owner and mode only when they are created, never on an upgrade (#11945).
|
||||
for COOLIFY_DIRECTORY in /data/coolify /data/coolify/{applications,databases,backups,services,proxy,proxy/dynamic,sentinel}; do
|
||||
if [ ! -d "$COOLIFY_DIRECTORY" ]; then
|
||||
mkdir -p "$COOLIFY_DIRECTORY"
|
||||
chown 9999:root "$COOLIFY_DIRECTORY"
|
||||
chmod 700 "$COOLIFY_DIRECTORY"
|
||||
create_data_directory() {
|
||||
if [ ! -d "$1" ]; then
|
||||
mkdir -p "$1"
|
||||
chown 9999:root "$1"
|
||||
chmod 700 "$1"
|
||||
fi
|
||||
done
|
||||
mkdir -p /data/coolify/source /data/coolify/images /data/coolify/ssh/{keys,mux}
|
||||
}
|
||||
|
||||
# Run only after the checks and downloads succeed, so a failed run does not change the data directories (#11973).
|
||||
create_coolify_directories() {
|
||||
for COOLIFY_DIRECTORY in /data/coolify/{applications,databases,backups,services,proxy,proxy/dynamic,sentinel}; do
|
||||
create_data_directory "$COOLIFY_DIRECTORY"
|
||||
done
|
||||
mkdir -p /data/coolify/images /data/coolify/ssh/{keys,mux}
|
||||
}
|
||||
|
||||
# Coolify's own directories, used by the coolify container (UID 9999)
|
||||
set_coolify_directory_permissions() {
|
||||
@@ -46,7 +53,9 @@ set_coolify_directory_permissions() {
|
||||
chmod -R 700 /data/coolify/{source,ssh,images}
|
||||
}
|
||||
|
||||
set_coolify_directory_permissions
|
||||
# The installation log and the downloaded files go to /data/coolify/source, so only it is created before the checks.
|
||||
create_data_directory /data/coolify
|
||||
mkdir -p /data/coolify/source
|
||||
|
||||
INSTALLATION_LOG_WITH_DATE="/data/coolify/source/installation-${DATE}.log"
|
||||
|
||||
@@ -1070,6 +1079,7 @@ step_done
|
||||
|
||||
step_start "Checking SSH key for localhost access"
|
||||
SSH_KEY_DETAIL="existing key"
|
||||
create_coolify_directories
|
||||
if [ ! -f ~/.ssh/authorized_keys ]; then
|
||||
mkdir -p ~/.ssh
|
||||
chmod 700 ~/.ssh
|
||||
|
||||
Reference in New Issue
Block a user