Fix user creation issues and add debugging
This commit is contained in:
parent
3558003bf1
commit
f9c17035f7
61
start.sh
61
start.sh
@ -85,10 +85,24 @@ EOT
|
|||||||
echo " 3. Rename the file to s3.env"
|
echo " 3. Rename the file to s3.env"
|
||||||
echo " 4. Restart the app"
|
echo " 4. Restart the app"
|
||||||
|
|
||||||
# Exit with a message if this is the first run
|
# For initial setup, create a placeholder S3 config to allow user creation
|
||||||
|
# This will let the app start and allow initial setup
|
||||||
if [[ ! -f /app/data/config/s3.env ]]; then
|
if [[ ! -f /app/data/config/s3.env ]]; then
|
||||||
echo "==> Exiting. Please configure S3 storage and restart the app."
|
echo "==> Creating temporary S3 configuration to allow initial setup"
|
||||||
exit 1
|
cat > /app/data/config/s3.env <<EOT
|
||||||
|
# Temporary S3 configuration - please replace with real values
|
||||||
|
S3_ENDPOINT=http://localhost:9000
|
||||||
|
S3_REGION=us-east-1
|
||||||
|
S3_BUCKET=ente-test
|
||||||
|
S3_ACCESS_KEY=minioadmin
|
||||||
|
S3_SECRET_KEY=minioadmin
|
||||||
|
S3_PREFIX=ente/
|
||||||
|
EOT
|
||||||
|
echo "==> Temporary S3 configuration created to allow initial user creation"
|
||||||
|
echo "==> Please replace with real S3 credentials after first user is created"
|
||||||
|
|
||||||
|
# Modify config to make S3 optional during initial setup
|
||||||
|
sed -i 's/storage.type: "s3"/storage.type: "local"/' /app/data/config/config.yaml
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -103,6 +117,13 @@ fi
|
|||||||
# Load S3 environment variables
|
# Load S3 environment variables
|
||||||
source /app/data/config/s3.env
|
source /app/data/config/s3.env
|
||||||
|
|
||||||
|
# Print S3 configuration (without sensitive values)
|
||||||
|
echo "==> S3 Configuration:"
|
||||||
|
echo " Endpoint: ${S3_ENDPOINT}"
|
||||||
|
echo " Region: ${S3_REGION}"
|
||||||
|
echo " Bucket: ${S3_BUCKET}"
|
||||||
|
echo " Prefix: ${S3_PREFIX:-ente/}"
|
||||||
|
|
||||||
# Update the config file with S3 credentials
|
# Update the config file with S3 credentials
|
||||||
sed -i \
|
sed -i \
|
||||||
-e "s|%%S3_ENDPOINT%%|${S3_ENDPOINT}|g" \
|
-e "s|%%S3_ENDPOINT%%|${S3_ENDPOINT}|g" \
|
||||||
@ -183,6 +204,8 @@ http {
|
|||||||
proxy_set_header Connection 'upgrade';
|
proxy_set_header Connection 'upgrade';
|
||||||
proxy_set_header Host \$host;
|
proxy_set_header Host \$host;
|
||||||
proxy_cache_bypass \$http_upgrade;
|
proxy_cache_bypass \$http_upgrade;
|
||||||
|
access_log /dev/stdout;
|
||||||
|
error_log /dev/stderr debug;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -284,6 +307,16 @@ cd "$SERVER_DIR"
|
|||||||
# Set Go module cache to a writable location
|
# Set Go module cache to a writable location
|
||||||
export GOPATH=/app/data/go
|
export GOPATH=/app/data/go
|
||||||
export GO111MODULE=on
|
export GO111MODULE=on
|
||||||
|
# Prevent Go from trying to download newer versions
|
||||||
|
export GOTOOLCHAIN=local
|
||||||
|
export GOPROXY=direct
|
||||||
|
|
||||||
|
# Set up more verbose logging for API debugging
|
||||||
|
export ENTE_LOG_LEVEL=debug
|
||||||
|
|
||||||
|
# Test if API endpoint is reachable
|
||||||
|
echo "==> Testing API connectivity"
|
||||||
|
curl -v http://localhost:8000/api/health || echo "API not yet available, this is normal during startup"
|
||||||
|
|
||||||
# Set up database environment variables
|
# Set up database environment variables
|
||||||
export ENTE_DB_USER="${CLOUDRON_POSTGRESQL_USERNAME}"
|
export ENTE_DB_USER="${CLOUDRON_POSTGRESQL_USERNAME}"
|
||||||
@ -307,18 +340,36 @@ chown -R cloudron:cloudron /app/data
|
|||||||
# Start Museum server on port 8000 (different from the NGINX port 8080)
|
# Start Museum server on port 8000 (different from the NGINX port 8080)
|
||||||
echo "==> Starting Museum server"
|
echo "==> Starting Museum server"
|
||||||
|
|
||||||
|
# Modify environment variables for frontend
|
||||||
|
echo "==> Setting up environment variables for frontend"
|
||||||
|
# For web frontend, these aren't changing
|
||||||
|
export NEXT_PUBLIC_ENTE_ENDPOINT="${CLOUDRON_APP_ORIGIN}"
|
||||||
|
|
||||||
# First check for pre-built Museum binary
|
# First check for pre-built Museum binary
|
||||||
if find "$SERVER_DIR" -name "museum" -type f -executable | grep -q .; then
|
if find "$SERVER_DIR" -name "museum" -type f -executable | grep -q .; then
|
||||||
MUSEUM_BIN=$(find "$SERVER_DIR" -name "museum" -type f -executable | head -1)
|
MUSEUM_BIN=$(find "$SERVER_DIR" -name "museum" -type f -executable | head -1)
|
||||||
echo "==> Found Museum binary at $MUSEUM_BIN"
|
echo "==> Found Museum binary at $MUSEUM_BIN"
|
||||||
/usr/local/bin/gosu cloudron:cloudron "$MUSEUM_BIN" --port 8000 &
|
/usr/local/bin/gosu cloudron:cloudron "$MUSEUM_BIN" --port 8000 \
|
||||||
|
--storage.s3.endpoint="${S3_ENDPOINT}" \
|
||||||
|
--storage.s3.region="${S3_REGION}" \
|
||||||
|
--storage.s3.bucket="${S3_BUCKET}" \
|
||||||
|
--storage.s3.accessKey="${S3_ACCESS_KEY}" \
|
||||||
|
--storage.s3.secretKey="${S3_SECRET_KEY}" \
|
||||||
|
--storage.s3.prefix="${S3_PREFIX:-ente/}" &
|
||||||
SERVER_PID=$!
|
SERVER_PID=$!
|
||||||
echo "==> Museum server started with PID $SERVER_PID"
|
echo "==> Museum server started with PID $SERVER_PID"
|
||||||
# Next check for cmd/museum directory pattern
|
# Next check for cmd/museum directory pattern
|
||||||
elif [ -d "$SERVER_DIR/cmd/museum" ]; then
|
elif [ -d "$SERVER_DIR/cmd/museum" ]; then
|
||||||
echo "==> Found Museum source in cmd/museum, running with go run"
|
echo "==> Found Museum source in cmd/museum, running with go run"
|
||||||
cd "$SERVER_DIR"
|
cd "$SERVER_DIR"
|
||||||
/usr/local/bin/gosu cloudron:cloudron go run cmd/museum/main.go --port 8000 &
|
/usr/local/bin/gosu cloudron:cloudron go run cmd/museum/main.go --port 8000 \
|
||||||
|
--storage.s3.endpoint="${S3_ENDPOINT}" \
|
||||||
|
--storage.s3.region="${S3_REGION}" \
|
||||||
|
--storage.s3.bucket="${S3_BUCKET}" \
|
||||||
|
--storage.s3.accessKey="${S3_ACCESS_KEY}" \
|
||||||
|
--storage.s3.secretKey="${S3_SECRET_KEY}" \
|
||||||
|
--storage.s3.prefix="${S3_PREFIX:-ente/}" \
|
||||||
|
--log.level=debug &
|
||||||
SERVER_PID=$!
|
SERVER_PID=$!
|
||||||
echo "==> Museum server started with PID $SERVER_PID"
|
echo "==> Museum server started with PID $SERVER_PID"
|
||||||
# Next try to find any main.go for the Museum
|
# Next try to find any main.go for the Museum
|
||||||
|
Loading…
x
Reference in New Issue
Block a user