为了更好的为您提供服务, 云效 邀请您使用持续交付相关功能。云效结合ECS、EDAS等服务为您提供完备的发布、部署、测试全研发流程,大大提升您的研发效率. 了解更多>

提交 af701ab576d453fa269f33321c04749b2bde4df8

作者 Clang
1 个父辈 6c1d7956

frp-docker 0.20.0

... ... @@ -2,7 +2,7 @@
2 2 FROM alpine:latest
3 3 MAINTAINER clangcn@gmail.com
4 4  
5   -ENV frpc_version=0.12.0 \
  5 +ENV frpc_version=0.20.0 \
6 6 frpc_DIR=/usr/local/frpc
7 7  
8 8 RUN set -ex && \
... ... @@ -18,6 +18,5 @@ RUN set -ex && \
18 18 rm -rf /var/cache/apk/* ~/.cache ${frpc_DIR}/${frpc_latest_filename} ${frpc_DIR}/frp_${frpc_version}_linux_amd64
19 19  
20 20 ADD entrypoint.sh /entrypoint.sh
21   -ADD start_frpc.sh /start_frpc.sh
22   -RUN chmod +x /entrypoint.sh /start_frpc.sh
  21 +RUN chmod +x /entrypoint.sh
23 22 ENTRYPOINT ["/entrypoint.sh"]
... ...
... ... @@ -3,28 +3,11 @@
3 3 基于Dockerfile文件编译出一个frpc的容器镜像。
4 4  
5 5 ##2、版本
6   -[frp 0.12.0](https://github.com/fatedier/frp/releases/latest)
  6 +[frp 0.20.0](https://github.com/fatedier/frp/releases/latest)
7 7  
8 8 ##3、问题
9 9 如何安装Docker
10   -
11   -1)官网安装地址
12   -```bash
13   -curl -Lk https://get.docker.com/ | sh
14   -```
15   -2)阿里云安装地址
16   -```bash
17   -curl -sSL http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/internet | sh -
18   -```
19   -RHEL、CentOS、Fedora的用户可以使用`setenforce 0`来禁用selinux以达到解决一些问题
20   -
21   -如果你已经禁用了selinux并且使用的是最新版的Docker。
22   -
23   -当你在issue 提交问题的时候请注意提供一下信息:
24   -- 宿主机的发行版和版本号.
25   -- 使用 `docker version` 命令来给出Docker版本信息.
26   -- 使用 `docker info` 命令来给出进一步信息.
27   -- 提供 `docker run` 命令的详情 (注意打码你的隐私信息).
  10 +自行百度吧
28 11  
29 12 # 二、安装
30 13 ##下载镜像导入
... ...
  1 +version: '2'
  2 +services:
  3 + frpc-docker:
  4 + image: frpc-docker:latest
  5 + container_name: frpc-docker
  6 + hostname: frpc-docker
  7 + volumes:
  8 + - "./frpc.ini:/usr/local/frpc/frpc.ini"
  9 + environment:
  10 + - str_log_level=info
  11 + restart: always
... ...
1 1 #!/bin/bash
2 2 #########################################################################
3 3 # File Name: frpc.sh
4   -# Version:1.1.20170627
5   -# Created Time: 2017-06-27
  4 +# Version:1.2.20180602
  5 +# Created Time: 2018-06-02
6 6 #########################################################################
  7 +__readINI() {
  8 + INIFILE=$1; SECTION=$2; ITEM=$3
  9 + _readIni=`awk -F '=' '/\['$SECTION'\]/{a=1}a==1&&$1~/'$ITEM'/{print $2;exit}' $INIFILE`
  10 +echo ${_readIni}
  11 +}
7 12  
8 13 set -e
9 14 FRPC_BIN="/usr/local/frpc/frpc"
10 15 FRPC_CONF="/usr/local/frpc/frpc.ini"
11   -FRPC_LOG="/var/log/frpc.log"
12   -
  16 +FRPC_LOG=$(__readINI ${FRPC_CONF} common log_file)
13 17 str_log_level=${str_log_level:-info} # set log level: debug, info, warn, error
14 18  
15 19 echo "+---------------------------------------------+"
... ... @@ -24,7 +28,8 @@ if [ ! -r ${FRPC_CONF} ]; then
24 28 echo "config file ${FRPC_CONF} not found"
25 29 exit 1
26 30 fi
  31 +[ -z ${FRPC_LOG} ] && echo "Log file not setting,exit!" && exit 1
27 32 touch ${FRPC_LOG} > /dev/null 2>&1
28   -. ./start_frpc.sh
29   -tail -f ${FRPC_LOG}
  33 +echo "Starting frpc $(${FRPC_BIN} -v) ..."
  34 +${FRPC_BIN} -c ${FRPC_CONF} &
30 35 exec "tail" -f ${FRPC_LOG}
... ...
... ... @@ -3,7 +3,7 @@
3 3 # A literal address or host name for IPv6 must be enclosed
4 4 # in square brackets, as in "[::1]:80", "[ipv6-host]:http" or "[ipv6-host%zone]:80"
5 5 server_addr = your server ip
6   -server_port = 7000
  6 +server_port = 5443
7 7  
8 8 # for authentication
9 9 privilege_token = password
... ... @@ -21,6 +21,12 @@ user = admin
21 21 # default is true
22 22 login_fail_exit = false
23 23  
  24 +# console or real logFile path like ./frpc.log
  25 +log_file = ./frpc.log
  26 +# trace, debug, info, warn, error
  27 +log_level = info
  28 +log_max_days = 3
  29 +
24 30 # communication protocol used to connect to server
25 31 # now it supports tcp and kcp, default is tcp
26 32 protocol = tcp
... ...
1   -#!/bin/bash
2   -#########################################################################
3   -# File Name: frpc.sh
4   -# Version:1.1.20170627
5   -# Created Time: 2017-06-27
6   -#########################################################################
7   -echo "Starting frpc $(${FRPC_BIN} -v) ..."
8   -echo "${FRPC_BIN} -c ${FRPC_CONF} -L ${FRPC_LOG} --log-level=${str_log_level}"
9   -${FRPC_BIN} -c ${FRPC_CONF} -L ${FRPC_LOG} --log-level=${str_log_level} &
... ... @@ -2,7 +2,7 @@
2 2 FROM alpine:latest
3 3 MAINTAINER clangcn@gmail.com
4 4  
5   -ENV frps_version=0.12.0 \
  5 +ENV frps_version=0.20.0 \
6 6 frps_DIR=/usr/local/frps
7 7  
8 8 RUN set -ex && \
... ...
... ... @@ -3,28 +3,11 @@
3 3 基于Dockerfile文件编译出一个frps的容器镜像。
4 4  
5 5 ##2、版本
6   -[frp 0.12.0](https://github.com/fatedier/frp/releases/latest)
  6 +[frp 0.20.0](https://github.com/fatedier/frp/releases/latest)
7 7  
8 8 ##3、问题
9 9 如何安装Docker
10   -
11   -1)官网安装地址
12   -```bash
13   -curl -Lk https://get.docker.com/ | sh
14   -```
15   -2)阿里云安装地址
16   -```bash
17   -curl -sSL http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/internet | sh -
18   -```
19   -RHEL、CentOS、Fedora的用户可以使用`setenforce 0`来禁用selinux以达到解决一些问题
20   -
21   -如果你已经禁用了selinux并且使用的是最新版的Docker。
22   -
23   -当你在issue 提交问题的时候请注意提供一下信息:
24   -- 宿主机的发行版和版本号.
25   -- 使用 `docker version` 命令来给出Docker版本信息.
26   -- 使用 `docker info` 命令来给出进一步信息.
27   -- 提供 `docker run` 命令的详情 (注意打码你的隐私信息).
  10 +自定百度吧,方法太多了
28 11  
29 12 # 二、安装
30 13 ##下载镜像导入
... ... @@ -47,30 +30,39 @@ docker load < frps-docker.tar
47 30 ##启动命令
48 31 ```bash
49 32 docker run -h="frps-docker" --name frps-docker -d \
50   --e set_bind_port=5443 \
51   --p 5443:5443 \
52   --e set_dashboard_port=6443 \
53   --p 6443:6443 \
54   --e set_vhost_http_port=80 \
55   --p 80:80 \
56   --e set_vhost_https_port=443 \
57   --p 443:443 \
58   --e set_privilege_token=password \
  33 +-p 6443:5443/tcp \
  34 +-p 6443:5443/udp \
  35 +-p 6444:5444/udp \
  36 +-p 7443:5445/tcp \
  37 +-p 8080:80/tcp \
  38 +-p 8443:443/tcp \
  39 +-e set_token=password \
  40 +-e set_subdomain_host= \
59 41 -e set_max_pool_count=50 \
60 42 -e str_log_level=info \
61 43 -e set_log_max_days=3 \
62 44 "frps-docker:latest"
63 45 ```
64 46 ---
  47 +##端口说明
  48 +
  49 +| Docker内定义 | Docker内默认值 | 描述 |
  50 +| :------------------- |:-----------:| :------------------------------------- |
  51 +| bind_port | 5443(TCP) | frps服务端口 |
  52 +| kcp_bind_port | 5443(UDP) | KCP加速端口 |
  53 +| bind_udp_port | 5444(UDP) | udp端口帮助udp洞洞穿nat |
  54 +| dashboard_port | 5445(TCP) | Frps控制台端口 |
  55 +| vhost_http_port | 80(TCP) | http穿透的端口。 |
  56 +| vhost_https_port | 443(TCP) | https穿透服务的端口 |
  57 +
  58 +---
65 59 ##变量说明(变量名区分大小写)
66 60  
67 61 | 变量名 | 默认值 | 描述 |
68   -| :------------------- |:-----------:| :------------------------------------- |
69   -| set_bind_port | 5443 | frps服务端口,用于客户端连接 |
70   -| set_vhost_http_port | 80 | 默认http穿透的端口。 |
71   -| set_vhost_https_port | 443 | 默认https穿透服务的端口 |
72   -| set_privilege_token | password | frps的特权密码,用于客户端连接 |
73   -| set_max_pool_count | 50 | 最大连接池数,貌似不用这个了 |
74   -| str_log_level | info | 日志等级,可选项:debug, info, warn, error |
75   -| set_log_max_days | 3 | 日志保存天数,默认保存3天的 |
  62 +| :------------------- |:-----------:| :------------------------------------------------ |
  63 +| set_privilege_token | password | frps的特权密码,用于客户端连接 |
  64 +| set_subdomain_host | | frps子域名设置,默认为空,可以输入类似abc.com这样的域名 |
  65 +| set_max_pool_count | 50 | 最大连接池数,貌似不用这个了 |
  66 +| str_log_level | info | 日志等级,可选项:debug, info, warn, error |
  67 +| set_log_max_days | 3 | 日志保存天数,默认保存3天的 |
76 68  
... ...
  1 +version: '2'
  2 +services:
  3 + frps-docker:
  4 + image: frps-docker:latest
  5 + container_name: frps-docker
  6 + hostname: frps-docker
  7 + environment:
  8 + - set_token=password
  9 + - set_subdomain_host=
  10 + - set_max_pool_count=50
  11 + - str_log_level=info
  12 + - set_log_max_days=3
  13 + ports:
  14 + - "6443:5443/tcp"
  15 + - "6443:5443/udp"
  16 + - "6444:5444/udp"
  17 + - "7443:5445/tcp"
  18 + - "8080:80/tcp"
  19 + - "8443:443/tcp"
  20 + restart: always
... ...
1 1 #!/bin/bash
2 2 #########################################################################
3 3 # File Name: frps.sh
4   -# Version:1.1.20170627
5   -# Created Time: 2017-06-27
  4 +# Version:1.2.20180602
  5 +# Created Time: 2018-06-02
6 6 #########################################################################
7 7  
8 8 set -e
... ... @@ -10,14 +10,10 @@ FRPS_BIN="/usr/local/frps/frps"
10 10 FRPS_CONF="/usr/local/frps/frps.ini"
11 11 FRPS_LOG="/var/log/frps.log"
12 12 # ======= FRPS CONFIG ======
13   -set_bind_port=${set_bind_port:-5443} #bind_port = 5443
14   -set_kcp_bind_port=${set_bind_port} #kcp_bind_port = bind_port
15   -set_vhost_http_port=${set_vhost_http_port:-80} #vhost_http_port = 80
16   -set_vhost_https_port=${set_vhost_https_port:-443} #vhost_https_port = 443
17   -set_dashboard_port=${set_dashboard_port:-6443} #dashboard_port = 6443
18 13 set_dashboard_user=${set_dashboard_user:-admin} #dashboard_user = admin
19 14 set_dashboard_pwd=${set_dashboard_pwd:-admin} #dashboard_pwd = admin
20   -set_privilege_token=${set_privilege_token:-password} #privilege_token = password
  15 +set_token=${set_token:-password} #token = password
  16 +set_subdomain_host=${set_subdomain_host:-} #subdomain_host =
21 17 set_tcp_mux=${set_tcp_mux:-true} #tcp_mux = true
22 18 set_max_pool_count=${set_max_pool_count:-50} #max_pool_count = 50
23 19 str_log_level=${str_log_level:-info} #log_level = info
... ... @@ -29,25 +25,35 @@ set_log_max_days=${set_log_max_days:-3} #log_max_days = 3
29 25 # A literal address or host name for IPv6 must be enclosed
30 26 # in square brackets, as in "[::1]:80", "[ipv6-host]:http" or "[ipv6-host%zone]:80"
31 27 bind_addr = 0.0.0.0
32   -bind_port = ${set_bind_port}
  28 +bind_port = 5443
  29 +# udp port to help make udp hole to penetrate nat
  30 +bind_udp_port = 5444
33 31 # udp port used for kcp protocol, it can be same with 'bind_port'
34 32 # if not set, kcp is disabled in frps
35   -kcp_bind_port = ${set_bind_port}
36   -# if you want to configure or reload frps by dashboard, dashboard_port must be set
37   -dashboard_port = ${set_dashboard_port}
  33 +kcp_bind_port = 5443
  34 +# set dashboard_addr and dashboard_port to view dashboard of frps
  35 +# dashboard_addr's default value is same with bind_addr
  36 +# dashboard is available only if dashboard_port is set
  37 +dashboard_addr = 0.0.0.0
  38 +dashboard_port = 5445
38 39 # dashboard user and pwd for basic auth protect, if not set, both default value is admin
39 40 dashboard_user = ${set_dashboard_user}
40 41 dashboard_pwd = ${set_dashboard_pwd}
41 42  
42   -vhost_http_port = ${set_vhost_http_port}
43   -vhost_https_port = ${set_vhost_https_port}
  43 +vhost_http_port = 80
  44 +vhost_https_port = 443
44 45 # console or real logFile path like ./frps.log
45 46 log_file = ${FRPS_LOG}
46 47 # debug, info, warn, error
47 48 log_level = ${str_log_level}
48 49 log_max_days = ${set_log_max_days}
49 50 # if you enable privilege mode, frpc can create a proxy without pre-configure in frps when privilege_token is correct
50   -privilege_token = ${set_privilege_token}
  51 +token = ${set_token}
  52 +
  53 +# if subdomain_host is not empty, you can set subdomain when type is http or https in frpc's configure file
  54 +# when subdomain is test, the host used by routing is test.frps.com
  55 +subdomain_host = ${set_subdomain_host}
  56 +
51 57 # pool_count in each proxy will change to max_pool_count if they exceed the maximum value
52 58 max_pool_count = ${set_max_pool_count}
53 59 # if tcp stream multiplexing is used, default is true
... ... @@ -63,6 +69,7 @@ echo "| Intro: https://github.com/clangcn |"
63 69 echo "+---------------------------------------------+"
64 70 echo ""
65 71 rm -f ${FRPS_LOG} > /dev/null 2>&1
  72 +echo "subdomain_host = ${set_subdomain_host}"
66 73 echo "Starting frps $(${FRPS_BIN} -v) ..."
67 74 ${FRPS_BIN} -c ${FRPS_CONF} &
68 75 sleep 0.3
... ...