first commit
This commit is contained in:
38
README.md
Normal file
38
README.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# Intro
|
||||
|
||||
[Yggdrasil](https://yggdrasil-network.github.io/about.html) is a new experimental compact routing scheme. It is designed to be a future-proof and decentralised alternative to the structured routing protocols commonly used today on the Internet, as well as an enabling technology for future large-scale mesh networks. The current implementation of Yggdrasil is a lightweight userspace software router which is easy to configure.
|
||||
|
||||
# Usage
|
||||
|
||||
The container generates new Yggdrasil config if empty. And automatically update available public peers in the Yggdrasil configuration file with [peers_updater](https://github.com/ygguser/peers_updater) at every start.
|
||||
|
||||
Here are some example snippets to help you get started creating a container.
|
||||
|
||||
## docker-compose
|
||||
|
||||
```yaml
|
||||
services:
|
||||
yggdrasil:
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
devices:
|
||||
- /dev/net/tun
|
||||
volumes:
|
||||
- "./yggdrasil:/etc/yggdrasil"
|
||||
sysctls:
|
||||
- "net.ipv6.conf.all.disable_ipv6=0"
|
||||
```
|
||||
|
||||
## docker cli
|
||||
|
||||
```sh
|
||||
docker run \
|
||||
--rm \
|
||||
--cap-add "NET_ADMIN" \
|
||||
--device "/dev/net/tun" \
|
||||
--volume "./yggdrasil.conf:/etc/yggdrasil/yggdrasil.conf" \
|
||||
--sysctl "net.ipv6.conf.all.disable_ipv6=0" \
|
||||
--mac-address "52:2a:ed:47:e9:25" \
|
||||
yggdrasil
|
||||
```
|
||||
|
||||
17
docker-compose.yml
Normal file
17
docker-compose.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
services:
|
||||
yggdrasil:
|
||||
build:
|
||||
context: https://git.bitdeals.org/private/yggdrasil.git
|
||||
dockerfile: ./docker/Dockerfile
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
devices:
|
||||
- /dev/net/tun
|
||||
volumes:
|
||||
- "yggdrasil:/etc/yggdrasil"
|
||||
sysctls:
|
||||
- "net.ipv6.conf.all.disable_ipv6=0"
|
||||
|
||||
volumes:
|
||||
yggdrasil:
|
||||
|
||||
23
docker/Dockerfile
Normal file
23
docker/Dockerfile
Normal file
@@ -0,0 +1,23 @@
|
||||
FROM debian:testing-slim
|
||||
|
||||
SHELL [ "/bin/sh", "-eux", "-c" ]
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends yggdrasil wget ca-certificates unzip libcap2-bin gosu ;\
|
||||
apt-get clean ;\
|
||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
RUN PU_VERSION="$(wget --server-response https://github.com/ygguser/peers_updater/releases/latest 2>&1 \
|
||||
| grep -E -m1 'Location: ' \
|
||||
| cut -d'/' -f8)" ;\
|
||||
wget https://github.com/ygguser/peers_updater/releases/download/$PU_VERSION/x86_64-unknown-linux-gnu.zip ;\
|
||||
unzip -d /usr/local/bin/ x86_64-unknown-linux-gnu.zip ;\
|
||||
rm x86_64-unknown-linux-gnu.zip
|
||||
|
||||
# Set file capability to run as regular user
|
||||
RUN setcap cap_net_admin=eip /usr/sbin/yggdrasil
|
||||
|
||||
COPY ./run.sh /usr/local/bin/run.sh
|
||||
|
||||
CMD ["/usr/local/bin/run.sh"]
|
||||
|
||||
26
docker/run.sh
Executable file
26
docker/run.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
|
||||
if ! [ -d /var/run/yggdrasil ]
|
||||
then
|
||||
install -d -o yggdrasil -g yggdrasil /run/yggdrasil /var/run/yggdrasil
|
||||
fi
|
||||
|
||||
|
||||
if ! [ -f /etc/yggdrasil/yggdrasil.conf ]
|
||||
then
|
||||
mkdir -p /etc/yggdrasil/
|
||||
yggdrasil -genconf > /etc/yggdrasil/yggdrasil.conf
|
||||
fi
|
||||
|
||||
|
||||
# Show node address
|
||||
until yggdrasilctl getself | grep -v "^[[:digit:]]"
|
||||
do
|
||||
sleep 5
|
||||
done &
|
||||
|
||||
|
||||
peers_updater --config /etc/yggdrasil/yggdrasil.conf --update_cfg --number 5
|
||||
|
||||
gosu yggdrasil /usr/sbin/yggdrasil -useconffile /etc/yggdrasil/yggdrasil.conf
|
||||
|
||||
Reference in New Issue
Block a user