All Projects → cneira → Jail Task Driver

cneira / Jail Task Driver

Licence: bsd-3-clause
nomad task driver that uses FreeBSD jails

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Jail Task Driver

Vkquake2
id Software's Quake 2 v3.21 with mission packs and Vulkan support (Windows, Linux, MacOS, FreeBSD, Raspberry Pi 4)
Stars: ✭ 543 (+1839.29%)
Mutual labels:  freebsd
Judge Server
Judging backend server for the DMOJ online judge.
Stars: ✭ 648 (+2214.29%)
Mutual labels:  freebsd
Arcan
Arcan - [Display Server, Multimedia Framework, Game Engine] -> "Desktop Engine"
Stars: ✭ 885 (+3060.71%)
Mutual labels:  freebsd
Persepolis
Persepolis Download Manager is a GUI for aria2.
Stars: ✭ 5,218 (+18535.71%)
Mutual labels:  freebsd
Rdrview
Firefox Reader View as a command line tool
Stars: ✭ 622 (+2121.43%)
Mutual labels:  freebsd
Solo5
A sandboxed execution environment for unikernels
Stars: ✭ 659 (+2253.57%)
Mutual labels:  freebsd
Freac
The fre:ac audio converter project
Stars: ✭ 518 (+1750%)
Mutual labels:  freebsd
Moosefs Freebsd Ports
Official FreeBSD Ports for MooseFS 3.0 (and MooseFS 2.0). If you're looking for MooseFS 2.0 ports, check the 2.0.x branch.
Stars: ✭ 10 (-64.29%)
Mutual labels:  freebsd
Htop
htop is an interactive text-mode process viewer for Unix systems. It aims to be a better 'top'.
Stars: ✭ 5,626 (+19992.86%)
Mutual labels:  freebsd
Raspberrypipkg
DEPRECATED - DO NOT USE | Go here instead ->
Stars: ✭ 758 (+2607.14%)
Mutual labels:  freebsd
Venice
Ruby Gem for In-App Purchase Receipt Verification
Stars: ✭ 578 (+1964.29%)
Mutual labels:  nomad
Filesystem
An implementation of C++17 std::filesystem for C++11 /C++14/C++17/C++20 on Windows, macOS, Linux and FreeBSD.
Stars: ✭ 603 (+2053.57%)
Mutual labels:  freebsd
Duf
Disk Usage/Free Utility - a better 'df' alternative
Stars: ✭ 7,240 (+25757.14%)
Mutual labels:  freebsd
Unifi Pfsense
A script that installs the UniFi Controller software on pfSense and other FreeBSD systems
Stars: ✭ 544 (+1842.86%)
Mutual labels:  freebsd
Swfw
Pure C Simple Window Framework (to be rebased soon).
Stars: ✭ 23 (-17.86%)
Mutual labels:  freebsd
Awesome Nomad
A curated list of amazingly awesome Nomad tools and shiny things.
Stars: ✭ 530 (+1792.86%)
Mutual labels:  nomad
Pyroute2
Python Netlink and PF_ROUTE library — network setup and monitoring
Stars: ✭ 658 (+2250%)
Mutual labels:  freebsd
Netkiller.github.io
Netkiller Free ebook - 免费电子书
Stars: ✭ 861 (+2975%)
Mutual labels:  freebsd
Trek
Trek is a CLI/ncurses explorer for HashiCorp Nomad clusters.
Stars: ✭ 26 (-7.14%)
Mutual labels:  nomad
Istio
Connect, secure, control, and observe services.
Stars: ✭ 28,970 (+103364.29%)
Mutual labels:  nomad

FreeBSD Jail Task Driver

Task driver for FreeBSD jails.

Requirements

Installation

Install(and compile) the jail-task-driver binary and put it in plugin_dir and then add a plugin "jail-task-driver" {} line in your nomad config file.

go get github.com/cneira/jail-task-driver
cp $GOPATH/bin/jail-task-driver YOURPLUGINDIR

Then in your nomad config file, set

plugin "jail-task-driver" {}

In developer/test mode(nomad agent -dev) , plugin_dir is unset it seems, so you will need to mkdir plugins and then copy the jail-task-driver binary to plugins and add a plugins_dir = "path/to/plugins" to the above config file. then you can run it like:

nomad agent -dev -config nomad.config

For more details see the nomad docs.

Parameters

Parameters used by the driver support most of JAIL(8) functionality, parameter names closely match the ones in JAIL(8).

Parameters documentation

Examples

Basic jail

job "test" {
  datacenters = ["dc1"]
  type        = "service"

  group "test" {
    restart {
      attempts = 0
      mode     = "fail"
    }

    task "test01" {
      driver = "jail-task-driver"

      config {
        Path    = "/zroot/iocage/jails/myjail/root"
	Persist  = true
      }
    }
  }
}

Non vnet jail

job "non-vnet" {
  datacenters = ["dc1"]
  type        = "service"

  group "test" {
    restart {
      attempts = 0
      mode     = "fail"
    }

    task "test01" {
      driver = "jail-task-driver"

      config {
        Path              = "/zroot/iocage/jails/myjail/root"
        Ip4               = "new"
        Allow_raw_sockets = true
        Allow_chflags     = true
        Ip4_addr          = "em1|192.168.1.102"
        Exec_start        = "/usr/local/bin/http-echo -listen :9999 -text hello"
      }
    }
  }
}

Vnet jail example

job "vnet-example" {
  datacenters = ["dc1"]
  type        = "service"

  group "test" {
    restart {
      attempts = 0
      mode     = "fail"
    }

    task "test01" {
      driver = "jail-task-driver"

      config {
        Path    = "/zroot/iocage/jails/myjail/root"
	Persist  = true
 	Host_hostname = "mwl.io"
	Exec_clean = true	
	Exec_start = "sh /etc/rc"
	Exec_stop = "sh /etc/rc.shutdown"
	Mount_devfs = true
	Exec_prestart = "logger trying to start "	
	Exec_poststart = "logger jail has started"	
	Exec_prestop = "logger shutting down jail "	
	Exec_poststop = "logger has shut down jail "	
	Exec_consolelog ="/var/tmp/vnet-example"
	Vnet = true
	Vnet_nic = "e0b_loghost"
	Exec_prestart = "/usr/share/examples/jails/jib addm loghost em1"
	Exec_poststop = "/usr/share/examples/jails/jib destroy loghost "
      }
    }
  }
}

Setting resource limits

job "vnet-example2" {
  datacenters = ["dc1"]
  type        = "service"

  group "test" {
    restart {
      attempts = 0
      mode     = "fail"
    }

    task "test01" {
      driver = "jail-task-driver"

      config {
        Path            = "/zroot/iocage/jails/myjail/root"
        Host_hostname   = "mwl.io"
        Exec_clean      = true
        Exec_start      = "sh /etc/rc"
        Exec_stop       = "sh /etc/rc.shutdown"
        Mount_devfs     = true
        Exec_prestart   = "logger trying to start "
        Exec_poststart  = "logger jail has started"
        Exec_prestop    = "logger shutting down jail "
        Exec_poststop   = "logger has shut down jail "
        Exec_consolelog = "/var/tmp/vnet-example"
        Vnet            = true
        Vnet_nic        = "e0b_loghost"
        Exec_prestart   = "/usr/share/examples/jails/jib addm loghost em1"
        Exec_poststop   = "/usr/share/examples/jails/jib destroy loghost "

        Rctl = {
          Vmemoryuse = {
            Action = "deny"
            Amount = "1G"
            Per    = "process"
          }
          Openfiles = {
            Action = "deny"
            Amount = "500"
          }
        }
      }
    }
  }
}

Demo

asciicast

Support

ko-fi

It's also possible to support the project on Patreon

References

TODO:

  • Implement exec interface
  • Implement RecoverTask interface
  • Test All jail options
  • Refactor to match parameters as closely as JAIL(8)
  • Create jails using docker images
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].