rvs-prxy/Design_Doc/auto-sys-deploy.sh.md

2.9 KiB

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 presets
  • Docker container lifecycle management
  • Automatic proxy server configuration updates
  • Support for multiple proxy configurations (rad, ssh, web)
  • 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 three proxy types
  • 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-frpc

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
  • Proxy Ports: Configurable remote ports for rad (default 8776), ssh (default 22), and web (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-<instance_name> to store configuration files.

Prerequisites

  • Docker and Docker Compose installed
  • SSH key at ~/.ssh/itl-devs1 for proxy server access
  • DOWNLOAD_SOURCE environment variable set
  • 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.