Implemented sftpgo docker
This commit is contained in:
commit
b0495fb2a1
2
.env
Normal file
2
.env
Normal file
@ -0,0 +1,2 @@
|
||||
# Path on your host machine where SFTPGo data will be stored
|
||||
SFTPGO_BASE_PATH=/data/sftpgo/
|
33
docker-compose.yml
Normal file
33
docker-compose.yml
Normal file
@ -0,0 +1,33 @@
|
||||
services:
|
||||
|
||||
# This service run as root to change the permissions to bind mounted folder
|
||||
# After this, the actual container is able to create files and folders inside the mounts
|
||||
init-permissions:
|
||||
image: busybox
|
||||
command: sh -c "mkdir -p /srv/sftpgo/data /var/lib/sftpgo /var/lib/sftpgo/plugins && chown -R 1000:1000 /srv/sftpgo /var/lib/sftpgo"
|
||||
volumes:
|
||||
- ${SFTPGO_BASE_PATH}/data:/srv/sftpgo/data
|
||||
- ${SFTPGO_BASE_PATH}/config:/var/lib/sftpgo
|
||||
- ${SFTPGO_BASE_PATH}/plugins:/var/lib/sftpgo/plugins
|
||||
user: root
|
||||
restart: "no"
|
||||
|
||||
sftpgo:
|
||||
image: drakkan/sftpgo:v2.6-plugins
|
||||
depends_on:
|
||||
- init-permissions
|
||||
container_name: sftpgo
|
||||
ports:
|
||||
- "2022:2022"
|
||||
- "8080:8080"
|
||||
- "8081:8081"
|
||||
volumes:
|
||||
- ${SFTPGO_BASE_PATH}/data:/srv/sftpgo/data
|
||||
- ${SFTPGO_BASE_PATH}/config:/var/lib/sftpgo
|
||||
- ${SFTPGO_BASE_PATH}/plugins:/var/lib/sftpgo/plugins
|
||||
environment:
|
||||
- SFTPGO_WEBDAVD__BINDINGS__0__PORT=8081
|
||||
- SFTPGO_HTTPD__BINDINGS__0__PORT=8080
|
||||
- SFTPGO_DATA_PROVIDER__DRIVER=sqlite
|
||||
- SFTPGO_DATA_PROVIDER__NAME=/var/lib/sftpgo/sftpgo.db
|
||||
restart: unless-stopped
|
68
install.sh
Executable file
68
install.sh
Executable file
@ -0,0 +1,68 @@
|
||||
#!/bin/bash
|
||||
|
||||
wget -O docker-compose.yml https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml
|
||||
|
||||
wget -O .env https://github.com/immich-app/immich/releases/latest/download/example.env
|
||||
|
||||
|
||||
# Helper function to check a command
|
||||
command_exists() {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
DOCKER_OK=true
|
||||
COMPOSE_OK=true
|
||||
|
||||
# Check for Docker
|
||||
if ! command_exists docker; then
|
||||
DOCKER_OK=false
|
||||
fi
|
||||
|
||||
# Check for Docker Compose (plugin or legacy)
|
||||
if ! docker compose version >/dev/null 2>&1 && ! command_exists docker-compose; then
|
||||
COMPOSE_OK=false
|
||||
fi
|
||||
|
||||
# If either is missing, run install script
|
||||
if [[ "$DOCKER_OK" = false || "$COMPOSE_OK" = false ]]; then
|
||||
echo "Missing required tools. Running installer..."
|
||||
git clone https://git.giovanesaggio.com/Selfhosting/docker_setup.git
|
||||
./docker_setup/docker_setup.sh
|
||||
rm -r docker_setup
|
||||
fi
|
||||
|
||||
# Parse and prompt for .env variables
|
||||
ENV_FILE=".env"
|
||||
|
||||
if [[ ! -f "$ENV_FILE" ]]; then
|
||||
echo "$ENV_FILE not found. Creating a new one."
|
||||
touch "$ENV_FILE"
|
||||
fi
|
||||
|
||||
declare -A ENV_VARS
|
||||
|
||||
# Load existing env vars
|
||||
while IFS='=' read -r key value; do
|
||||
[[ "$key" =~ ^[A-Z_][A-Z0-9_]*$ ]] || continue
|
||||
ENV_VARS["$key"]="$value"
|
||||
done < "$ENV_FILE"
|
||||
|
||||
echo "Configure environment variables (press ENTER to keep current value):"
|
||||
|
||||
# Prompt for each variable
|
||||
for key in "${!ENV_VARS[@]}"; do
|
||||
current="${ENV_VARS[$key]}"
|
||||
read -p "$key [$current]: " new_value
|
||||
if [[ -n "$new_value" ]]; then
|
||||
ENV_VARS["$key"]="$new_value"
|
||||
fi
|
||||
done
|
||||
|
||||
# Overwrite .env with updated values
|
||||
> "$ENV_FILE"
|
||||
for key in "${!ENV_VARS[@]}"; do
|
||||
echo "$key=${ENV_VARS[$key]}" >> "$ENV_FILE"
|
||||
done
|
||||
|
||||
# Launch Docker
|
||||
docker compose up -d
|
Loading…
x
Reference in New Issue
Block a user