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!
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

README.md 4.9KB

4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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:
  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
  117. The `focker image` mode groups commands related to Focker images.
  118. ##### build 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 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 TAG [...TAG]
  123. Removes one or more image tags.
  124. ##### list [--full-sha256|-f]
  125. Lists existing Focker images, optionally with full SHA256 checksums (instead of the default 7 first characters).
  126. ##### prune
  127. Greedily removes existing Focker images without tags and without dependents.
  128. ##### remove REFERENCE
  129. Removes the specified image.
  130. #### focker jail
  131. ##### create
  132. ##### start
  133. ##### stop
  134. ##### remove
  135. ##### exec
  136. ##### oneshot
  137. ##### list
  138. ##### tag
  139. ##### untag
  140. ##### prune
  141. #### focker volume
  142. ##### create
  143. ##### prune
  144. ##### list
  145. ##### tag
  146. ##### untag
  147. #### focker compose
  148. ##### build
  149. ##### run