# auto-sys-deploy.sh Documentation ## Overview The `auto-sys-deploy.sh` script is an automated system deployment script for FRPC (Fast Reverse Proxy Client). It's designed to set up and configure FRP client instances with interactive prompts for user input. The script handles instance configuration, Docker container management, and updates the proxy server configuration automatically. ## Features - Interactive instance name selection with validation - Docker network selection with support for existing networks - FRP client configuration generation with dynamic proxy support - Docker container lifecycle management - Automatic proxy server configuration updates - Support for dynamic proxy configurations based on environment variables - Backup and restore of existing configurations - Comprehensive logging with color-coded output ## Functions ### Core Functions - `prompt_instance_name()`: Handles user prompts for instance name, with validation and existing instance detection - `select_docker_network()`: Allows user to select Docker network with options for custom networks - `generate_frpc_config()`: Creates FRP client configuration (frpc.toml) with dynamic proxy types based on environment variables - `start_docker_container()`: Manages the Docker container lifecycle (create/start) - `update_proxy_server_config()`: Updates the proxy server configuration remotely via SSH ### Utility Functions - `log_info()`, `log_error()`, `log_warn()`: Color-coded logging functions - `save_parameters()`, `load_parameters()`: Parameter persistence to Docker volumes - `extract_frp_server_address()`, `extract_remote_ports()`: Configuration retrieval functions - `display_container_commands()`: Shows useful Docker commands for the deployed instance ## Usage ``` ./auto-sys-deploy.sh [COMMAND] [OPTIONS] Available commands: setup-rvs-prxy Available options: -l, --list List all available systems -h, --help Show this help message ``` ## Parameters - **Instance Name**: Alphanumeric, hyphens, and underscores only - **Docker Network**: Existing Docker network or custom network name - **FRP Server Address**: IP address of the FRP server - **FRP Server Port**: Default is 16999 - **Dynamic Proxy Ports**: Configurable remote ports using environment variables in the format `PROXY_*_PORT` (e.g., `PROXY_API_PORT=8080`, `PROXY_DATABASE_PORT=5432`) - **Default Proxy Ports**: Configurable remote ports for rad (if `RAD_REMOTE_PORT` is set, default 8776), ssh (if `SSH_REMOTE_PORT` is set, default 22), and web (if `WEB_REMOTE_PORT` is set, default 80) proxies ## Architecture The script uses Docker containers with the `snowdreamtech/frpc:0.62.0-alpine3.21` image and creates persistent volumes with the naming convention `rad-git-sshd-itl-frpc-` to store configuration files. ## Prerequisites - Docker and Docker Compose installed - SSH key at `~/.ssh/itl-devs1` for proxy server access - SSH key at `~/.ssh/itl-devs1` for proxy server access - User permissions for Docker commands - SSH keys for authentication (`~/.ssh/authorized_keys` and `~/.ssh/devs1`) ## Configuration Persistence The script stores network selection preferences in a `.para` file within the Docker volume, allowing for configuration continuity between runs.