mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2026-08-02 08:51:32 -04:00
- Introduced .dockerignore to exclude unnecessary files from Docker context. - Added .env.aio.example for minimal configuration of the AdventureLog All-in-One setup. - Updated .env.example to include optional SITE_URL and GUNICORN_WORKERS settings. - Enhanced deploy.sh script for improved deployment flexibility and backup options. - Updated docker-compose files to use PostGIS 16-3.5 and added health checks for services. - Created docker-compose.aio.yml for All-in-One deployment configuration. - Improved health checks and service dependencies in docker-compose.dev.yml and docker-compose.yml. - Added GitHub workflows for building and pushing Docker images, including smoke tests for AIO setup.
119 lines
3.7 KiB
Bash
Executable File
119 lines
3.7 KiB
Bash
Executable File
#!/bin/bash
|
|
# AIO configuration wizard and .env.aio writer.
|
|
set -euo pipefail
|
|
|
|
prompt_aio_core_config() {
|
|
print_step_header 2 "$WIZARD_TOTAL" "Core configuration (AIO)"
|
|
log_info "All-in-One uses a single URL and port."
|
|
echo ""
|
|
|
|
local default_site="http://localhost:8015"
|
|
while true; do
|
|
SITE_URL="$(prompt_with_default "Public site URL" "$default_site")"
|
|
if validate_url "$SITE_URL"; then
|
|
break
|
|
fi
|
|
log_error "Enter a valid http:// or https:// URL"
|
|
done
|
|
SITE_URL="${SITE_URL%/}"
|
|
HOST_PORT="$(extract_port_from_url "$SITE_URL" "8015")"
|
|
local port_override
|
|
port_override="$(tui_input "Host port to bind [${HOST_PORT}]" "$HOST_PORT")"
|
|
HOST_PORT="${port_override:-$HOST_PORT}"
|
|
log_success "Site: $SITE_URL (port $HOST_PORT)"
|
|
|
|
POSTGRES_PASSWORD="$(generate_secure_password 32)"
|
|
log_success "Generated secure database password"
|
|
|
|
if tui_confirm "Change default admin credentials (admin/admin)?" "y"; then
|
|
DJANGO_ADMIN_USERNAME="$(prompt_with_default "Admin username" "admin")"
|
|
DJANGO_ADMIN_PASSWORD="$(generate_secure_password 24)"
|
|
DJANGO_ADMIN_EMAIL="$(prompt_with_default "Admin email" "admin@example.com")"
|
|
else
|
|
DJANGO_ADMIN_USERNAME="admin"
|
|
DJANGO_ADMIN_PASSWORD="admin"
|
|
DJANGO_ADMIN_EMAIL="admin@example.com"
|
|
log_warning "Using default admin/admin — change after first login"
|
|
fi
|
|
echo ""
|
|
}
|
|
|
|
write_env_aio() {
|
|
local target="$ENV_FILE"
|
|
{
|
|
echo "# AdventureLog All-in-One — generated by installer"
|
|
echo "POSTGRES_PASSWORD=$(format_env_value "$POSTGRES_PASSWORD")"
|
|
echo "SITE_URL=$(format_env_value "$SITE_URL")"
|
|
echo "HOST_PORT=$(format_env_value "$HOST_PORT")"
|
|
echo "DJANGO_ADMIN_USERNAME=$(format_env_value "$DJANGO_ADMIN_USERNAME")"
|
|
echo "DJANGO_ADMIN_PASSWORD=$(format_env_value "$DJANGO_ADMIN_PASSWORD")"
|
|
echo "DJANGO_ADMIN_EMAIL=$(format_env_value "$DJANGO_ADMIN_EMAIL")"
|
|
} > "$target"
|
|
save_optional_env_to_file "$target"
|
|
log_success "Wrote $target"
|
|
}
|
|
|
|
show_aio_review() {
|
|
local opt_count=0
|
|
[[ -v OPTIONAL_ENV_LINES ]] && opt_count="${#OPTIONAL_ENV_LINES[@]}"
|
|
print_step_header 5 "$WIZARD_TOTAL" "Review configuration"
|
|
print_summary_row "Setup" "All-in-One (AIO)"
|
|
print_summary_row "Site URL" "$SITE_URL"
|
|
print_summary_row "Host port" "$HOST_PORT"
|
|
print_summary_row "PostGIS image" "$POSTGIS_IMAGE"
|
|
print_summary_row "Admin user" "$DJANGO_ADMIN_USERNAME"
|
|
print_summary_row "Optional vars" "$opt_count configured"
|
|
echo ""
|
|
if ! tui_confirm "Proceed with installation?" "y"; then
|
|
log_info "Installation cancelled."
|
|
exit 0
|
|
fi
|
|
}
|
|
|
|
save_credentials_file() {
|
|
if [[ "$DRY_RUN" == true ]]; then
|
|
return 0
|
|
fi
|
|
if ! tui_confirm "Save credentials to credentials.txt (mode 600)?" "y"; then
|
|
return 0
|
|
fi
|
|
cat > credentials.txt << EOF
|
|
AdventureLog credentials — $(date)
|
|
Site URL: ${SITE_URL}
|
|
Admin username: ${DJANGO_ADMIN_USERNAME}
|
|
Admin password: ${DJANGO_ADMIN_PASSWORD}
|
|
Database password: ${POSTGRES_PASSWORD}
|
|
EOF
|
|
chmod 600 credentials.txt
|
|
log_success "Saved credentials.txt (keep this secure)"
|
|
}
|
|
|
|
print_aio_success() {
|
|
print_success_banner
|
|
log_success "Installation completed!"
|
|
echo ""
|
|
echo -e "${BOLD}Access:${NC} ${CYAN}${SITE_URL}${NC}"
|
|
echo ""
|
|
echo -e "${BOLD}Admin:${NC} ${GREEN}${DJANGO_ADMIN_USERNAME}${NC} / ${GREEN}${DJANGO_ADMIN_PASSWORD}${NC}"
|
|
echo ""
|
|
echo -e "${BOLD}Config:${NC} $(pwd)/${ENV_FILE}"
|
|
echo ""
|
|
echo -e "${BOLD}Management:${NC}"
|
|
echo -e " Re-run installer: curl -sSL https://get.adventurelog.app | bash"
|
|
echo -e " Update: bash deploy.sh --backup"
|
|
echo -e " Logs: docker logs ${LOG_CONTAINER} -f"
|
|
echo -e " Stop: docker compose -f ${COMPOSE_FILE} down"
|
|
echo ""
|
|
}
|
|
|
|
run_aio_install_wizard() {
|
|
SETUP_TYPE="aio"
|
|
resolve_compose_settings
|
|
WIZARD_TOTAL=7
|
|
prompt_aio_core_config
|
|
run_port_checks
|
|
run_optional_features_wizard
|
|
write_postgis_override
|
|
show_aio_review
|
|
}
|