/freebsd_sc

tool to create service cluster in FreeBSD

Primary LanguageShell

FreeBSD Service cluster tool

This is a tool to build a freebsd service cluster

  • Basic Idea
  1. Use consul as service discovery

  2. Use nomad to schedule services

  3. Use traefik as service redirect

  4. Use CARP to handle service fail over

  5. Use FreeBSD jail management tool(pot) to manage service jail

  6. Use vxlan to connect jails inside cluster

  • Usage
  1. get help
./bin/sc usage
  1. 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
  1. 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

  1. create nomad job for jail service

See examples/jobs for detail

  1. submit job to make service online

  2. configure DNS service to resolve service domain to CARP address

    data_center.your_domain

  • Others

create pull request if you found any issue.