This is a tool to build a freebsd service cluster
- Basic Idea
-
Use consul as service discovery
-
Use nomad to schedule services
-
Use traefik as service redirect
-
Use CARP to handle service fail over
-
Use FreeBSD jail management tool(pot) to manage service jail
-
Use vxlan to connect jails inside cluster
- Usage
- get help
./bin/sc usage
- build a service cluster
2.1 create configuration of cluster
See examples at examples/conf/cluster.conf
2.2 build service cluster
for each hosts in the cluster, run:
./bin/sc install -c examples/conf/cluster.conf -i em0
- em0 is the netif used by consul/nomad/traefik
2.3 update configuration
Please edit configuration file /usr/local/etc/sc/sc.conf then:
sc apply
sc start
- build jail image of service
3.1 create jail with required packages installed
3.2 export the jail image
3.3 upload the jail image to repository which can be accessed by service cluster
- create nomad job for jail service
See examples/jobs for detail
-
submit job to make service online
-
configure DNS service to resolve service domain to CARP address
data_center.your_domain
- Others
create pull request if you found any issue.