{"id":18794694,"url":"https://github.com/cneira/jail-task-driver","last_synced_at":"2025-07-28T05:04:18.421Z","repository":{"id":57495631,"uuid":"196088412","full_name":"cneira/jail-task-driver","owner":"cneira","description":"nomad task driver that uses FreeBSD jails","archived":false,"fork":false,"pushed_at":"2020-02-18T15:52:21.000Z","size":12477,"stargazers_count":38,"open_issues_count":3,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-13T15:13:47.723Z","etag":null,"topics":["freebsd","freebsd-jail-manager","freebsd-jails","nomad","nomad-driver","nomad-task-driver"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cneira.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-09T21:47:25.000Z","updated_at":"2024-12-07T16:54:51.000Z","dependencies_parsed_at":"2022-08-28T19:51:03.263Z","dependency_job_id":null,"html_url":"https://github.com/cneira/jail-task-driver","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/cneira/jail-task-driver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cneira%2Fjail-task-driver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cneira%2Fjail-task-driver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cneira%2Fjail-task-driver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cneira%2Fjail-task-driver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cneira","download_url":"https://codeload.github.com/cneira/jail-task-driver/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cneira%2Fjail-task-driver/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267464522,"owners_count":24091505,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["freebsd","freebsd-jail-manager","freebsd-jails","nomad","nomad-driver","nomad-task-driver"],"created_at":"2024-11-07T21:30:31.829Z","updated_at":"2025-07-28T05:04:18.374Z","avatar_url":"https://github.com/cneira.png","language":"Go","funding_links":["https://ko-fi.com/J3J4YM9U","https://www.patreon.com/neirac"],"categories":["Plugins"],"sub_categories":["User Interfaces and Dashboards"],"readme":"FreeBSD Jail Task Driver\n===========================\n\nTask driver for [FreeBSD](https://www.freebsd.org/) jails. \n\n\n- Website: https://www.nomadproject.io\n\nRequirements\n------------\n\n- [Nomad](https://www.nomadproject.io/downloads.html) 0.9+\n- [Go](https://golang.org/doc/install) 1.11 (to build the provider plugin)\n- [FreeBSD 12.0-RELEASE](https://www.freebsd.org/where.html) *Should work with 11*\n- [Consul](https://releases.hashicorp.com/consul/1.5.2/consul_1.5.2_freebsd_amd64.zip)\n\nInstallation\n------------\n\nInstall(and compile) the jail-task-driver binary and put it in [plugin_dir](https://www.nomadproject.io/docs/configuration/index.html#plugin_dir) and then add a `plugin \"jail-task-driver\" {}` line in your nomad config file.\n\n\n```shell\ngo get github.com/cneira/jail-task-driver\ncp $GOPATH/bin/jail-task-driver YOURPLUGINDIR\n```\n\nThen in your nomad config file, set\n```hcl\nplugin \"jail-task-driver\" {}\n```\n\nIn 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.\nthen you can run it like:\n\n`nomad agent -dev -config nomad.config`\n\nFor more details see the nomad [docs](https://www.nomadproject.io/docs/configuration/plugin.html).\n\nParameters\n-----------\nParameters used by the driver support most of JAIL(8) functionality, parameter names \nclosely match the ones in JAIL(8).  \n   \n\n[Parameters documentation ](https://github.com/cneira/jail-task-driver/blob/master/Parameters.md)  \n\nExamples \n---------\n\nBasic jail \n---------\n\n```hcl\njob \"test\" {\n  datacenters = [\"dc1\"]\n  type        = \"service\"\n\n  group \"test\" {\n    restart {\n      attempts = 0\n      mode     = \"fail\"\n    }\n\n    task \"test01\" {\n      driver = \"jail-task-driver\"\n\n      config {\n        Path    = \"/zroot/iocage/jails/myjail/root\"\n\tPersist  = true\n      }\n    }\n  }\n}\n```\nNon vnet jail\n-------------\n```hcl \njob \"non-vnet\" {\n  datacenters = [\"dc1\"]\n  type        = \"service\"\n\n  group \"test\" {\n    restart {\n      attempts = 0\n      mode     = \"fail\"\n    }\n\n    task \"test01\" {\n      driver = \"jail-task-driver\"\n\n      config {\n        Path              = \"/zroot/iocage/jails/myjail/root\"\n        Ip4               = \"new\"\n        Allow_raw_sockets = true\n        Allow_chflags     = true\n        Ip4_addr          = \"em1|192.168.1.102\"\n        Exec_start        = \"/usr/local/bin/http-echo -listen :9999 -text hello\"\n      }\n    }\n  }\n}\n```\n\nVnet jail example \n-----------------\n\n```hcl\njob \"vnet-example\" {\n  datacenters = [\"dc1\"]\n  type        = \"service\"\n\n  group \"test\" {\n    restart {\n      attempts = 0\n      mode     = \"fail\"\n    }\n\n    task \"test01\" {\n      driver = \"jail-task-driver\"\n\n      config {\n        Path    = \"/zroot/iocage/jails/myjail/root\"\n\tPersist  = true\n \tHost_hostname = \"mwl.io\"\n\tExec_clean = true\t\n\tExec_start = \"sh /etc/rc\"\n\tExec_stop = \"sh /etc/rc.shutdown\"\n\tMount_devfs = true\n\tExec_prestart = \"logger trying to start \"\t\n\tExec_poststart = \"logger jail has started\"\t\n\tExec_prestop = \"logger shutting down jail \"\t\n\tExec_poststop = \"logger has shut down jail \"\t\n\tExec_consolelog =\"/var/tmp/vnet-example\"\n\tVnet = true\n\tVnet_nic = \"e0b_loghost\"\n\tExec_prestart = \"/usr/share/examples/jails/jib addm loghost em1\"\n\tExec_poststop = \"/usr/share/examples/jails/jib destroy loghost \"\n      }\n    }\n  }\n}\n```\nSetting resource limits\n----------------------\n```hcl\njob \"vnet-example2\" {\n  datacenters = [\"dc1\"]\n  type        = \"service\"\n\n  group \"test\" {\n    restart {\n      attempts = 0\n      mode     = \"fail\"\n    }\n\n    task \"test01\" {\n      driver = \"jail-task-driver\"\n\n      config {\n        Path            = \"/zroot/iocage/jails/myjail/root\"\n        Host_hostname   = \"mwl.io\"\n        Exec_clean      = true\n        Exec_start      = \"sh /etc/rc\"\n        Exec_stop       = \"sh /etc/rc.shutdown\"\n        Mount_devfs     = true\n        Exec_prestart   = \"logger trying to start \"\n        Exec_poststart  = \"logger jail has started\"\n        Exec_prestop    = \"logger shutting down jail \"\n        Exec_poststop   = \"logger has shut down jail \"\n        Exec_consolelog = \"/var/tmp/vnet-example\"\n        Vnet            = true\n        Vnet_nic        = \"e0b_loghost\"\n        Exec_prestart   = \"/usr/share/examples/jails/jib addm loghost em1\"\n        Exec_poststop   = \"/usr/share/examples/jails/jib destroy loghost \"\n\n        Rctl = {\n          Vmemoryuse = {\n            Action = \"deny\"\n            Amount = \"1G\"\n            Per    = \"process\"\n          }\n          Openfiles = {\n            Action = \"deny\"\n            Amount = \"500\"\n          }\n        }\n      }\n    }\n  }\n}\n```\n##  Demo\n[![asciicast](https://asciinema.org/a/256519.svg)](https://asciinema.org/a/256519)\n\n## Support\n\n[![ko-fi](https://www.ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/J3J4YM9U)  \n      \nIt's also possible to support the project on [Patreon](https://www.patreon.com/neirac)  \n    \n## References\n\n- [Lucas, Michael W. FreeBSD Mastery: Jails (IT Mastery Book 15)](https://mwl.io/nonfiction/os#fmjail)\n- [FreeBSD HandBook](https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/)\n- [RCTL(8)](https://www.freebsd.org/cgi/man.cgi?query=rctl\u0026sektion=8)\n\n\n TODO:\n-------\n\n* ~~Implement exec interface~~\n* ~~Implement RecoverTask interface~~\n* Test All jail options\n* Refactor to match parameters as closely as JAIL(8)\n* Create jails using docker images\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcneira%2Fjail-task-driver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcneira%2Fjail-task-driver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcneira%2Fjail-task-driver/lists"}