IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

README.md 7.0KB

4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. # Focker
  2. ## Introduction
  3. Focker is a FreeBSD image orchestration tool in the vein of Docker.
  4. ## Installation
  5. In order to use Focker you need a ZFS pool available in your FreeBSD installation.
  6. ### Installing the Python package from PyPi
  7. Run:
  8. ```bash
  9. pip install focker
  10. ```
  11. ### Installing the Python package from GitHub
  12. Run:
  13. ```bash
  14. git clone https://github.com/sadaszewski/focker.git
  15. cd focker/
  16. python setup.py install
  17. ```
  18. or (if you want an uninstaller):
  19. ```bash
  20. git clone https://github.com/sadaszewski/focker.git
  21. cd focker/
  22. python setup.py sdist
  23. pip install dist/focker-0.9.tgz
  24. ```
  25. ### Setting up ZFS
  26. Upon first execution of the `focker` command, Focker will automatically create the necessary directories and ZFS datasets. You just need to exclude the unlikely case that you are already using `/focker` in your filesystem hierarchy. The layout after initialization will look the following:
  27. ```
  28. /focker
  29. /focker/images
  30. /focker/jails
  31. /focker/volumes
  32. ```
  33. `images`, `jails`, and `volumes` have corresponding ZFS datasets with `canmount=off` so that they serve as mountpoint anchors for child entries.
  34. ### Preparing base image
  35. To bootstrap the images system you need to install FreeBSD in jail mode to a ZFS dataset placed in `/focker/images` and provide two user-defined properties - `focker:sha256` and `focker:tags`. One way to achieve this would be the following (using Bash shell):
  36. ```bash
  37. TAGS="freebsd-latest freebsd-$(freebsd-version | cut -d'-' -f1)"
  38. VERSION="FreeBSD $(freebsd-version)"
  39. SHA256=$(echo -n ${VERSION} | sha256)
  40. NAME=${SHA256:0:7}
  41. zfs create -o focker:sha256=${SHA256} -o focker:tags="${TAGS}" zroot/focker/images/${NAME}
  42. bsdinstall jail /focker/images/${NAME}
  43. zfs set readonly=on zroot/focker/images/${NAME}
  44. zfs snapshot zroot/focker/images/${NAME}@1
  45. ```
  46. ## Usage
  47. At this point, Focker is ready to use.
  48. ### `focker` command syntax
  49. The `focker` command is the single entrypoint to all of the Focker's functionality. The overview of its syntax is presented below as a tree where the `focker` command is the root, the first level of descendants represents the choice of Level 1 mode (`image`, `jail`, `volume` or `compose`), the second level - the Level 2 mode (dependent on L1 mode) and the final third level lists required and optional arguments specific to the given combination of L1/L2 modes.
  50. ```
  51. focker
  52. |- image|img|im|i
  53. | |- build|b
  54. | | |- FOCKER_DIR
  55. | | `- --tags|-t TAG [...TAG]
  56. | |- tag|t
  57. | | |- REFERENCE
  58. | | `- TAG [...TAG]
  59. | |- untag|u
  60. | | `- TAG [...TAG]
  61. | |- list|ls|l
  62. | | `- --full-sha256|-f
  63. | |- prune|p
  64. | `- remove|r
  65. | |- REFERENCE
  66. | `- --remove-dependents|-R
  67. |- jail|j
  68. | |- create|c
  69. | | |- IMAGE
  70. | | |- --command|-c COMMAND (default: /bin/sh)
  71. | | |- --env|-e VAR1:VALUE1 [...VARN:VALUEN]
  72. | | |- --mounts|-m FROM1:ON1 [...FROMN:ONN]
  73. | | `- --hostname|-n HOSTNAME
  74. | |- start|s
  75. | | `- REFERENCE
  76. | |- stop|S
  77. | | `- REFERENCE
  78. | |- remove|r
  79. | | `- REFERENCE
  80. | |- exec|e
  81. | | |- REFERENCE
  82. | | `- [...COMMAND]
  83. | |- oneshot|o
  84. | | `- IMAGE
  85. | | `- --env|-e VAR1:VALUE1 [...VARN:VALUEN]
  86. | | `- --mounts|-m FROM1:ON1 [...FROMN:ONN]
  87. | | `- [...COMMAND]
  88. | |- list|ls|l
  89. | | `- --full-sha256|-f
  90. | |- tag|t
  91. | | |- REFERENCE
  92. | | `- TAG [...TAG]
  93. | |- untag|u
  94. | | `- TAG [...TAG]
  95. | `- prune|p
  96. | `- --force|-f
  97. |- volume
  98. | |- create
  99. | | `- --tags|-t TAG [...TAG]
  100. | |- prune
  101. | |- list
  102. | | `- --full-sha256|-f
  103. | |- tag
  104. | | |- REFERENCE
  105. | | `- TAG [...TAG]
  106. | `- untag
  107. | `- TAG [...TAG]
  108. `- compose
  109. |- build
  110. | `- FILENAME
  111. `- run
  112. |- FILENAME
  113. `- COMMAND
  114. ```
  115. Individual combinations are briefly described below:
  116. #### focker image|img|im|i
  117. The `focker image` mode groups commands related to Focker images.
  118. ##### build|b FOCKER_DIR [--tags TAG [...TAG]]
  119. Build a Focker image according to the specification in a Fockerfile present in the specified FOCKER_DIR. Fockerfile syntax is very straightforward and explained below.
  120. ##### tag|t REFERENCE TAG [...TAG]
  121. Applies one or more tags to the given image. REFERENCE can be the SHA256 of an image or one of its existing tags. It can be just a few first characters as long as they are unambiguous.
  122. ##### untag|u TAG [...TAG]
  123. Removes one or more image tags.
  124. ##### list|ls|l [--full-sha256|-f]
  125. Lists existing Focker images, optionally with full SHA256 checksums (instead of the default 7 first characters).
  126. ##### prune|p
  127. Greedily removes existing Focker images without tags and without dependents.
  128. ##### remove|r REFERENCE
  129. Removes the specified image.
  130. #### focker jail|j
  131. The `focker jail` mode groups commands related to Focker-managed jails.
  132. ##### create|c IMAGE [--command|-c COMMAND] [--env|-e VAR1:VALUE1 [...VARN:VALUEN]] [--mounts|-m FROM1:ON1 [...FROMN:ONN]] [--hostname|-n HOSTNAME]
  133. Creates a new Focker-managed jail. A jail consists of a clone of the given `IMAGE` and an entry in `/etc/jail.conf`. The configuration entry uses `exec.prestart` and `exec.start` to specify how the runtime environment (mounts and environmental variables) should be set up. It also calls `COMMAND` as last in `exec.start`. If not specified `COMMAND` defaults to `/bin/sh`. The hostname can be specified using the `HOSTNAME` parameter. Mounts and environment variables are provided as tuples separated by a colon (:). The environmental variable specification consists of variable name followed by variable value. The mount specification consists of the "from path", followed by the "on path". "From path" can be a local system path or a volume name.
  134. ##### start|s REFERENCE
  135. Starts the given jail specified by `REFERENCE`. `REFERENCE` can be the SHA256 of an existing jail or one of its existing tags. It can be just a few first characters as long as they are unambiguous. This command is equivalent of calling `jail -c`.
  136. ##### stop|S REFERENCE
  137. Stops the given jail specified by `REFERENCE`. This command is equivalent to calling `jail -r`.
  138. ##### remove|r REFERENCE
  139. Removes the given jail specified by `REFERENCE`. The jail is stopped if running, any filesystems mounted under its root directory are unmounted, its ZFS dataset and entry in `/etc/jail.conf` are removed.
  140. ##### exec|e REFERENCE [...COMMAND]
  141. Executes given `COMMAND` (or `/bin/sh` if not specified) in the given running jail specified by `REFERENCE`. This command is the equivalent of calling `jexec`.
  142. ##### oneshot|o IMAGE [--env|-e VAR1:VALUE1 [...VARN:VALUEN]] [--mounts|-m FROM1:ON1 [...FROMN:ONN]] [...COMMAND]
  143. Create a new one-time Focker-managed jail. The syntax and logic is identical to `focker jail create`, the difference being that the hostname cannot be specified and that the jail will be automatically removed when the `COMMAND` exits.
  144. Example: `focker jail oneshot freebsd-latest -e FOO:bar -- ls -al`
  145. ##### list|ls|l
  146. ##### tag
  147. ##### untag
  148. ##### prune
  149. #### focker volume
  150. ##### create
  151. ##### prune
  152. ##### list
  153. ##### tag
  154. ##### untag
  155. #### focker compose
  156. ##### build
  157. ##### run