https://github.com/ler0ever/swarm-setup
Code that powers my server cluster
https://github.com/ler0ever/swarm-setup
Last synced: about 2 months ago
JSON representation
Code that powers my server cluster
- Host: GitHub
- URL: https://github.com/ler0ever/swarm-setup
- Owner: LER0ever
- License: other
- Created: 2018-06-25T20:25:51.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-06-25T20:26:12.000Z (almost 7 years ago)
- Last Synced: 2024-10-29T07:07:33.147Z (7 months ago)
- Homepage: https://code.rongyi.io/LER0ever/Swarm-Setup
- Size: 274 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Server Manifest
This repo contains configurations for my servers and workstation clustering setup.
(And now also contains detailed explanations and guide:)## Features
- Basic Load-Balancing using Reverse Proxy Round-Robin
- Dynamic Reverse Proxy from Docker Flow
- Cluster Visualizer using Docker Swarm Visualizer
- Vitualized subnet for both local dorm computers and remote servers
- High Availability, Service auto-restarting## Services
- My own git hosting (gitea)
- Continuous Integration (drone-ci)
- LAN Ports forwarding (frp)
- Kanban Task Board (kanboard)
- Status pages for each node (netdata)
- Dev branch of my personal website (caddy, gatsby)
- Shadowsocks
- Transmission Daemon for downloading you-know-what
- Portainer Management
- Mastodon (deleted, too memory consuming)
- More to come## Screenshots
#### Swarm Visualizer

#### Code Hosting

#### NPM Registry

#### Kanban (one of the boards)

#### Drone CI

#### Transmission WebUI
## Technical Details
### 1. Private networking
**This is achieved using Weave Net.**Installation:
```bash
sudo curl -L git.io/weave -o /usr/local/bin/weave
sudo chmod a+x /usr/local/bin/weave
```Before starting the swarm, weave is started in docker and created an overlay
network between hosts both in my dorm and in the cloud, so as to create a
virtual subnet containing all the nodes.Then, `weave expose` is executed to not only connects docker containers to that
virtual network, but also brings the physical hosts in, which enables me to later
create a swarm without having to manually expose 2377, 4xxx ports on each
computers which are behind the firewall.After doing these, my addresses for each node would become for example:
- Main Server: 10.40.0.0
- Singapore Server: 10.44.0.0
- LosAngeles Server: 10.48.0.0
- Dorm Desktop: 10.38.0.0
- Dorm Samsung: 10.34.0.0
- Laptop Somewhere: 10.32.0.1And they can reach each other using the above addresses.
Additionally, one can use Weave scope to visualize the virtual network and
manage containers in the network.### 2. Swarm Setup
Once the nodes have their own `10.x.x.x` virtual address, docker swarm mode
can be easily setup by running the following:##### On the master node:
```bash
eval $(weave env)
docker swarm init --advertise-addr 10.40.0.0:2377
# and you'll get a command for workers to join
```##### On every worker node:
```bash
eval $(weave env)
docker swarm join --token xxxx --advertise-addr 10.3x.x.x:2377
```### 3. Docker Stack deploy
The monitor stack and the actual services are seperated so that they won't affect each other.```bash
# Deploy monitor stack
docker stack deploy -c monitor-stack.yml m_prod_180625# Deploy services
docker stack deploy -c swarm-stack.yml prod_180625
```My own stack visualizer is live (or not) at [swarm.rongyi.io](https://swarm.rongyi.io)
## License
The code and configuration in this repo is open source under the terms of Apache 2.0