add port forwarding
This commit is contained in:
12
README.md
12
README.md
@@ -21,6 +21,9 @@ services:
|
|||||||
- "./yggdrasil:/etc/yggdrasil"
|
- "./yggdrasil:/etc/yggdrasil"
|
||||||
sysctls:
|
sysctls:
|
||||||
- "net.ipv6.conf.all.disable_ipv6=0"
|
- "net.ipv6.conf.all.disable_ipv6=0"
|
||||||
|
environment:
|
||||||
|
- BIND_PORT=80
|
||||||
|
- BIND_ADDRESS=nginx
|
||||||
```
|
```
|
||||||
|
|
||||||
## docker cli
|
## docker cli
|
||||||
@@ -36,3 +39,12 @@ docker run \
|
|||||||
yggdrasil
|
yggdrasil
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# Parameters
|
||||||
|
|
||||||
|
Container images are configured using parameters passed at runtime.
|
||||||
|
|
||||||
|
|Parameter|Function|
|
||||||
|
|:--------|:-------|
|
||||||
|
|-e BIND_PORT|Port to forward.|
|
||||||
|
|-e BIND_ADDRESS|Address of another docker service to forward to.|
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ services:
|
|||||||
context: https://git.bitdeals.org/private/yggdrasil.git
|
context: https://git.bitdeals.org/private/yggdrasil.git
|
||||||
dockerfile: ./docker/Dockerfile
|
dockerfile: ./docker/Dockerfile
|
||||||
image: registry.bitdeals.org/yggdrasil
|
image: registry.bitdeals.org/yggdrasil
|
||||||
|
environment:
|
||||||
|
- BIND_PORT=
|
||||||
|
- BIND_ADDRESS=
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
cap_add:
|
cap_add:
|
||||||
- NET_ADMIN
|
- NET_ADMIN
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ FROM debian:testing-slim
|
|||||||
SHELL [ "/bin/sh", "-eux", "-c" ]
|
SHELL [ "/bin/sh", "-eux", "-c" ]
|
||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends yggdrasil wget ca-certificates unzip libcap2-bin gosu ;\
|
&& apt-get install -y --no-install-recommends yggdrasil wget ca-certificates unzip libcap2-bin gosu socat;\
|
||||||
apt-get clean ;\
|
apt-get clean ;\
|
||||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
BIND_PORT=${BIND_PORT:-80}
|
||||||
|
BIND_ADDRESS=${BIND_ADDRESS:-127.0.0.1}
|
||||||
|
|
||||||
if ! [ -d /var/run/yggdrasil ]
|
if ! [ -d /var/run/yggdrasil ]
|
||||||
then
|
then
|
||||||
install -d -o yggdrasil -g yggdrasil /run/yggdrasil /var/run/yggdrasil
|
install -d -o yggdrasil -g yggdrasil /run/yggdrasil /var/run/yggdrasil
|
||||||
@@ -13,14 +16,22 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Port forwarding to another docker service
|
||||||
|
while sleep 1;
|
||||||
|
do
|
||||||
|
socat TCP6-LISTEN:$BIND_PORT,fork,forever,reuseaddr TCP4:$BIND_ADDRESS:$BIND_PORT
|
||||||
|
done &
|
||||||
|
|
||||||
|
|
||||||
# Show node address
|
# Show node address
|
||||||
until yggdrasilctl getself | grep -v "^[[:digit:]]"
|
until yggdrasilctl getself | grep -v "^[[:digit:]]"
|
||||||
do
|
do
|
||||||
sleep 5
|
sleep 5
|
||||||
done &
|
done &
|
||||||
|
|
||||||
|
# Update available public peers
|
||||||
peers_updater --config /etc/yggdrasil/yggdrasil.conf --update_cfg --number 5
|
peers_updater --config /etc/yggdrasil/yggdrasil.conf --update_cfg --number 5
|
||||||
|
|
||||||
|
|
||||||
gosu yggdrasil /usr/sbin/yggdrasil -useconffile /etc/yggdrasil/yggdrasil.conf
|
gosu yggdrasil /usr/sbin/yggdrasil -useconffile /etc/yggdrasil/yggdrasil.conf
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user