From 9c03e38f51a4f85960f30e9dc9bff3cfcd804da6 Mon Sep 17 00:00:00 2001 From: Daniel Ding Date: Sat, 6 Jan 2024 17:44:00 +0800 Subject: [PATCH] docs: introduce docker compose --- Makefile | 10 +++++++ README.cn.md | 1 + README.en.md | 1 + docker/docker-compose.yml | 12 -------- docs/docker.md | 61 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 73 insertions(+), 12 deletions(-) create mode 100644 docs/docker.md diff --git a/Makefile b/Makefile index 146c953..284d6e4 100755 --- a/Makefile +++ b/Makefile @@ -49,6 +49,16 @@ vendor: go mod tidy go mod vendor -v +config: + cd $(BD) && mkdir -p config/openlan + cp -rvf ../docker/docker-compose.yml config/openlan + + mkdir -p config/openlan/etc + cp -rvf ../dist/rootfs/etc/openlan config/openlan/etc + + cd config && tar -cf ../config.tar openlan && cd .. + gzip -f config.tar + docker: linux-bin docker-rhel docker-deb ## build docker images docker-rhel: diff --git a/README.cn.md b/README.cn.md index fc177b7..277fe54 100755 --- a/README.cn.md +++ b/README.cn.md @@ -128,3 +128,4 @@ OpenLAN提供一种局域网数据报文在广域网的传输实现,并能够 - [全互连网络](docs/fabric.md) - [IPSec网络](docs/ipsec.md) - [零信任网络](docs/ztrust.md) +- [Docker Compose](docs/docker.md) diff --git a/README.en.md b/README.en.md index 039a678..b2a0634 100755 --- a/README.en.md +++ b/README.en.md @@ -125,3 +125,4 @@ If you have more flexible VPN business needs and need to use VPN to access the e - [Fullly Interconnected Network](docs/fabric.md) - [IPSec Network](docs/ipsec.md) - [Zero Trust Network](docs/ztrust.md) +- [Docker Compose](docs/docker.md) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 5a84859..31c66ac 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -82,15 +82,3 @@ services: depends_on: - confd - switch - dns: - restart: always - image: "adguard/dnsproxy:latest.x86_64" - # privileged: true - # network_mode: "host" - network_mode: service:confd - entrypoint: ["/opt/dnsproxy/dnsproxy", "--config-path=/opt/dnsproxy/config.yaml"] - volumes: - - /opt/openlan/etc/dnsproxy/config.yaml:/opt/dnsproxy/config.yaml - depends_on: - - confd - - switch diff --git a/docs/docker.md b/docs/docker.md new file mode 100644 index 0000000..50cac73 --- /dev/null +++ b/docs/docker.md @@ -0,0 +1,61 @@ +# Deployment OpenLAN by docker compose + +Please ensure you already installed the following softwares: +* docker +* docker-compose + +## Download config's source package + +``` +wget https://github.com/luscis/openlan/releases/download/v24.01.01/config.tar.gz +``` + +## Unarchive it to your roootfs + +``` +tar -xvf config.tar.gz -C /opt +``` + +## Now you can edit your network + +``` +[root@example openlan]# cd /opt/openlan/etc/openlan/switch/network +[root@example network]# +[root@example network]# cat ./example.json +{ + "name": "example", + "bridge": { + "address": "172.32.100.40/24" + } +} +[root@example network]# +``` + +## Update image version + +you can find latest version on [docker hub]() +``` +[root@example network]# cd /opt/openlan +[root@example openlan]# sed -i -e 's/:latest.x86_64/:v24.01.01.x86_64/' docker-compose.yml +[root@example openlan]# +``` + +## Bootstrap OpenLAN by compose + +``` +[root@example openlan]# docker-compose up -d +Recreating openlan_confd_1 ... done +Recreating openlan_ovsdb-server_1 ... done +Recreating openlan_ovs-vswitchd_1 ... done +Recreating openlan_switch_1 ... done +Recreating openlan_proxy_1 ... +[root@example openlan]# +[root@example openlan]# docker ps +CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES +aafb3cc2b8f9 luscis/openlan:v24.01.01.x86_64 "/usr/bin/openlan-..." 12 seconds ago Up 12 seconds openlan_proxy_1 +0bb9b586ed53 luscis/openlan:v24.01.01.x86_64 "/var/openlan/scri..." 13 seconds ago Up 13 seconds openlan_switch_1 +d5543d22db6e luscis/openlan:v24.01.01.x86_64 "/var/openlan/scri..." 18 seconds ago Up 17 seconds openlan_ovs-vswitchd_1 +a1d86acdb6b4 luscis/openlan:v24.01.01.x86_64 "/var/openlan/scri..." 18 seconds ago Up 18 seconds openlan_ovsdb-server_1 +e42f200f6694 luscis/openlan:v24.01.01.x86_64 "/var/openlan/scri..." 19 seconds ago Up 19 seconds openlan_confd_1 +[root@example openlan]# +``` \ No newline at end of file