Compare commits

..

2 commits

Author SHA1 Message Date
Dejan R. 0a3e744ca9 added install and unninstall script 2025-11-30 13:54:42 +00:00
Dejan R. 76819bf2c2 fix docker-compose.yml 2025-11-30 13:54:08 +00:00
2 changed files with 121 additions and 11 deletions

View file

@ -3,18 +3,16 @@ services:
image: mariadb:10.11 image: mariadb:10.11
restart: unless-stopped restart: unless-stopped
environment: environment:
# --- REPLACE THESE NOW ---
MYSQL_ROOT_PASSWORD: SuperSecretRoot123! MYSQL_ROOT_PASSWORD: SuperSecretRoot123!
MYSQL_DATABASE: filerun MYSQL_DATABASE: filerun
MYSQL_USER: filerun MYSQL_USER: filerun
MYSQL_PASSWORD: SuperSecretFileRun456! MYSQL_PASSWORD: SuperSecretFileRun456!
# ------------------------
volumes: volumes:
- ./db_data:/var/lib/mysql - ./db_data:/var/lib/mysql
networks: networks:
- internal - internal
ffilerun: filerun:
image: filerun/filerun:8.1.arm64v8 image: filerun/filerun:8.1.arm64v8
restart: unless-stopped restart: unless-stopped
environment: environment:
@ -23,35 +21,53 @@ services:
FR_DB_NAME: filerun FR_DB_NAME: filerun
FR_DB_USER: filerun FR_DB_USER: filerun
FR_DB_PASS: SuperSecretFileRun456! FR_DB_PASS: SuperSecretFileRun456!
APACHE_RUN_USER: www-data APACHE_RUN_USER: www-data
APACHE_RUN_USER_ID: 33
APACHE_RUN_GROUP: www-data APACHE_RUN_GROUP: www-data
APACHE_RUN_GROUP_ID: 33
# Critical: enable proxy support in FileRun!
FR_USE_PROXY: "true"
volumes: volumes:
- ./filerun_html:/var/www/html - ./filerun_html:/var/www/html
- ./user_data:/user-files - ./user_data:/user-files
expose:
- "80" # TO MORA BITI TUKAJ!
networks: networks:
- internal - internal
- traefik_default - traefik_default
depends_on: depends_on:
- db - db
labels: labels:
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.http.middlewares.filerun-headers.headers.customresponseheaders.X-Forwarded-Proto=https" - "traefik.docker.network=traefik_default"
# Create redirect middleware to HTTPS
- "traefik.http.middlewares.filerun-redirect.redirectscheme.scheme=https"
- "traefik.http.middlewares.filerun-redirect.redirectscheme.permanent=true"
# FileRun headers (required behind proxy)
- "traefik.http.middlewares.filerun-headers.headers.customrequestheaders.X-Forwarded-Proto=https"
- "traefik.http.middlewares.filerun-headers.headers.customrequestheaders.X-Forwarded-Host=filerun.rozic-dev.com"
# HTTP Router → redirect to HTTPS
- "traefik.http.routers.filerun-http.entrypoints=web" - "traefik.http.routers.filerun-http.entrypoints=web"
- "traefik.http.routers.filerun-http.rule=Host(`filerun.rozic-dev.com`)" - "traefik.http.routers.filerun-http.rule=Host(`filerun.rozic-dev.com`)"
- "traefik.http.routers.filerun-http.middlewares=redirectscheme" - "traefik.http.routers.filerun-http.middlewares=filerun-redirect@docker"
- "traefik.http.middlewares.redirectscheme.redirectscheme.scheme=https"
# HTTPS Router
- "traefik.http.routers.filerun-https.entrypoints=websecure" - "traefik.http.routers.filerun-https.entrypoints=websecure"
- "traefik.http.routers.filerun-https.rule=Host(`filerun.rozic-dev.com`)" - "traefik.http.routers.filerun-https.rule=Host(`filerun.rozic-dev.com`)"
- "traefik.http.routers.filerun-https.tls=true" - "traefik.http.routers.filerun-https.tls=true"
- "traefik.http.routers.filerun-https.tls.certresolver=letsencrypt" - "traefik.http.routers.filerun-https.tls.certresolver=letsencrypt"
- "traefik.http.routers.filerun-https.middlewares=filerun-headers" - "traefik.http.routers.filerun-https.middlewares=filerun-headers@docker"
- "traefik.http.routers.filerun-https.priority=100"
# Backend service
- "traefik.http.services.filerun.loadbalancer.server.port=80" - "traefik.http.services.filerun.loadbalancer.server.port=80"
networks: networks:
internal: internal:
driver: bridge driver: bridge
traefik_default: traefik_default:
external: true # This connects to your existing Traefik network external: true

94
install.sh Executable file
View file

@ -0,0 +1,94 @@
#!/bin/bash
# --- Configuration ---
# File name of the FileRun distribution ZIP archive
FILERUN_ZIP="FileRun-2024.1.2-PHP-8.1.zip"
# Directories used for persistent data and code
DATA_DIRS=("db_data" "filerun_html" "user_data")
# UID and GID for the www-data user inside the FileRun container (from docker-compose.yml)
CONTAINER_UID_GID="33:33"
# Temporary directory for extraction
TEMP_DIR="./temp_filerun_extract"
# ---------------------
echo "--- FileRun Installation Script ---"
# --- 1. Create and prepare directories ---
echo "1. Creating and ensuring directories exist..."
for dir in "${DATA_DIRS[@]}"; do
if [ ! -d "$dir" ]; then
echo " -> Creating directory: ${dir}/"
mkdir -p "$dir"
fi
done
# --- 2. Unzip FileRun distribution and move files ---
if [ -f "${FILERUN_ZIP}" ]; then
echo "2. Unzipping ${FILERUN_ZIP} into a temporary folder and moving contents to ./filerun_html..."
# Create temporary directory for extraction
mkdir -p "$TEMP_DIR"
# Unzip to temporary folder
unzip -q "${FILERUN_ZIP}" -d "$TEMP_DIR"
if [ $? -ne 0 ]; then
echo "❌ ERROR: Failed to unzip ${FILERUN_ZIP}. Check if 'unzip' is installed or if the file is corrupted."
rm -rf "$TEMP_DIR"
exit 1
fi
# Move contents from temp to final location (./filerun_html)
mv "$TEMP_DIR"/* ./filerun_html/
# Clean up temporary directory
rm -rf "$TEMP_DIR"
echo " [SUCCESS] Files extracted and moved to ./filerun_html."
else
echo "❌ ERROR: File not found: ${FILERUN_ZIP}. Please ensure it is in the current directory."
exit 1
fi
# --- 3. Set correct ownership for container user (33:33) ---
echo "3. Setting ownership to ${CONTAINER_UID_GID} (www-data) for required FileRun paths..."
# 3a. Set ownership for the FileRun system data directory (mapped from /var/www/html/system/data)
SYSTEM_DATA_PATH="./filerun_html/system/data"
echo " -> Setting ownership for ${SYSTEM_DATA_PATH}/"
sudo chown -R ${CONTAINER_UID_GID} "${SYSTEM_DATA_PATH}"
# 3b. Set ownership for the user files directory (mapped from /user-files)
USER_DATA_PATH="./user_data"
echo " -> Setting ownership for ${USER_DATA_PATH}/"
sudo chown -R ${CONTAINER_UID_GID} "${USER_DATA_PATH}"
echo " [SUCCESS] Ownership set for application use."
# --- 4. Start Docker Compose services ---
echo "4. Starting Docker services..."
docker compose up -d
if [ $? -ne 0 ]; then
echo "❌ ERROR: Docker Compose failed to start services. Check your docker-compose.yml for errors."
exit 1
fi
echo " [SUCCESS] Services started in detached mode."
# --- 5. Verify container status ---
echo "5. Checking FileRun container status..."
# Wait a few seconds for startup
sleep 5
CONTAINER_STATUS=$(docker compose ps -q filerun | xargs docker inspect --format '{{.State.Status}}')
if [ "$CONTAINER_STATUS" == "running" ]; then
echo "✅ FileRun container is running."
echo ""
echo "--- NEXT STEPS ---"
echo "FileRun is now accessible via Traefik at: https://filerun.rozic-dev.com"
echo "If you still encounter a 'Database error', the application needs to run its initial setup."
echo "1. Check the detailed application logs for the specific PHP error:"
echo " docker compose logs filerun"
echo "2. The database initialization (tables/schema) may take a moment."
else
echo "❌ WARNING: FileRun container status is '$CONTAINER_STATUS'. Check logs for details:"
echo " docker compose logs filerun"
fi