All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 39s
43 lines
1.1 KiB
Bash
Executable File
43 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
source "${AGENT_PATH}/common.sh"
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
_check_required_env_vars "CONTAINER_NAME" "DATA_PATH" "DB_NAME" "DB_USER" "DB_PASS"
|
|
|
|
_check_docker_installed || _die "Docker test failed, aborting installation..."
|
|
|
|
# Create data directories
|
|
mkdir -p "${DATA_PATH}/config" "${DATA_PATH}/data" "${DATA_PATH}/postgres"
|
|
|
|
# Create config.yml for Wiki.js to use PostgreSQL
|
|
cat > "${DATA_PATH}/config/config.yml" << EOF
|
|
port: 3000
|
|
bindIP: 0.0.0.0
|
|
|
|
db:
|
|
type: postgres
|
|
host: ${CONTAINER_NAME}_db
|
|
port: 5432
|
|
user: ${DB_USER}
|
|
pass: ${DB_PASS}
|
|
db: ${DB_NAME}
|
|
|
|
dataPath: /data
|
|
EOF
|
|
|
|
# Export variables for docker compose
|
|
export CONTAINER_NAME DATA_PATH HTTP_PORT PUID PGID TZ IMAGE_TAG DB_NAME DB_USER DB_PASS
|
|
|
|
cd "$SCRIPT_DIR"
|
|
|
|
# Pull images
|
|
docker compose pull || _die "Failed to pull images"
|
|
|
|
# Stop existing containers
|
|
docker compose down 2>/dev/null || true
|
|
|
|
# Start containers (--build ensures fresh state)
|
|
docker compose up -d --build || _die "Failed to start containers"
|
|
|
|
echo "Installation of ${CONTAINER_NAME} complete"
|
|
echo "Access Wiki.js at http://localhost:${HTTP_PORT}"
|