King Zone - bash
type: channel
link: https://www.kingtam.win/tag/bash/
items: Automatically deploy FRP server and client services using Docker via bash script

Automatically deploy FRP server and client services using Docker via bash script
type: item
date: 2023-03-21T15:05:00+08:00
description: Automatically deploy FRP server and client services using DockerAutomatically deploy fast reverse proxy server and client services using Docker.pngIt is an easy way to deploy FRP server and client services using Docker, which simplifies the setup process by breaking it down into four parts.Breakdown of contentPart1, Menu Settings function display_menu { echo "Please select a service as you want to deploy:" echo "1. FRP(S) Service" echo "2. FRP(C) Service" echo "0. Exit" }2023-03-21_120127.pngThe script starts with a menu that presents the user with three options to choose from. This menu is essential to guide the user through the rest of the process.Part2, FRP Server service deploy function handle_option_1 { }This part sets up the FRP server service as a function.include the followingif ! command -v docker &> /dev/null then echo "Docker is not installed. Installing Docker now..." curl -O https://kingtam.win/usr/uploads/script/install-docker.sh && chmod +x install-docker.sh && ./install-docker.sh fiIt detects if Docker is installed and if not, installs it.echo "What port would you like to use for the frps service? Press enter to use the default port of 7000, type 'r' to generate a random port, or enter a port number:" read -r port_choice if [[ $port_choice == "r" ]]; then port=$(shuf -i 7001-9000 -n 1) elif [[ -z $port_choice ]]; then port=7000 else port=$port_choice fi echo "What port would you like to use for the HTTP service? Press enter to use the default port of 80, or enter a port number:" read -r http_choice if [[ -z $http_choice ]]; then http=80 else http=$http_choice fi echo "What port would you like to use for the HTTPS service? Press enter to use the default port of 443, or enter a port number:" read -r https_choice if [[ -z $https_choice ]]; then https=443 else https=$https_choice fi echo "Would you like to generate a random token or enter a password for the frps service? Press enter to generate a random token, or enter a password:" read -r token_choice i…