README.rst 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. DAK Setup
  2. =========
  3. This document describes deployment for use in production. For information
  4. about development, see ``docs/development.rst``.
  5. Initialising a dak database schema
  6. ----------------------------------
  7. The following packages are needed for the database::
  8. postgresql-9.6 postgresql-client-9.6 postgresql-9.6-debversion
  9. and the following packages for dak itself::
  10. python3-psycopg2 python3-sqlalchemy python3-apt gnupg dpkg-dev lintian
  11. binutils-multiarch python3-yaml less python3-ldap python3-pyrss2gen python3-rrdtool
  12. symlinks python3-debian python3-debianbts python3-tabulate
  13. (the schema assumes at least postgresql 9.1; ftpmaster in Debian currently uses
  14. the postgresql 9.6 version from Debian 9)
  15. The following roles are assumed to exist:
  16. * dak: database superuser: needs to be an actual user
  17. * ftpmaster: role which should be given to archive administrators
  18. * ftpteam: people who can do NEW processing, overrides, removals, etc
  19. * ftptrainee: people who can add notes to packages in NEW
  20. For the purposes of this document, we'll be working in /srv/dak
  21. Set up the dak user::
  22. sudo addgroup ftpmaster
  23. sudo adduser dak --disabled-login --ingroup ftpmaster --shell /bin/bash
  24. Set up the dak directory::
  25. sudo mkdir /etc/dak
  26. sudo mkdir /srv/dak
  27. Create a symlink to /srv/dak/etc/dak.conf in /etc/dak
  28. (The actual file will be created by the setup script)::
  29. sudo ln -s /srv/dak/etc/dak.conf /etc/dak/dak.conf
  30. This script does the rest of the work. It uses the generic variables set in
  31. init_vars, which can be customized if needed::
  32. setup/dak-setup.sh
  33. The above script symlinks the dak.py script to /srv/dak/bin/dak, you should also
  34. update your PATH variable to be able to execute dak::
  35. export PATH="/srv/dak/bin:${PATH}"
  36. **WARNING:** Please check the templates in /srv/dak/templates over and customise
  37. as necessary
  38. Set up a private signing key: don't set a passphrase as dak will not
  39. pass one through to gpg. Guard this key carefully!
  40. The key only needs to be able to sign, it doesn't need to be able
  41. to encrypt.
  42. ::
  43. # gpg --homedir /srv/dak/keyrings/s3kr1t/dot-gnupg --gen-key
  44. Remember the signing key id for when creating the suite below.
  45. Here we'll pretend it is DDDDDDDD for convenience
  46. Import some developer keys.
  47. Either import from keyservers (here AAAAAAAA)::
  48. # gpg --no-default-keyring --keyring /srv/dak/keyrings/upload-keyring.gpg --recv-key AAAAAAAA
  49. or import from files::
  50. # gpg --no-default-keyring --keyring /srv/dak/keyrings/upload-keyring.gpg --import /path/to/keyfile
  51. Import the developer keys into the database
  52. The -U '%s' tells dak to add UIDs automatically::
  53. # dak import-keyring -U '%s' /srv/dak/keyrings/upload-keyring.gpg
  54. Add some architectures you care about::
  55. # dak admin architecture add i386 "Intel x86 port"
  56. # dak admin architecture add amd64 "AMD64 port"
  57. Add a suite (origin=, label= and codename= are optional)::
  58. signingkey= will ensure that Release files are signed
  59. # dak admin suite add-all-arches unstable x.y.z origin=MyDistro label=Master codename=sid signingkey=DDDDDDDD
  60. Add the components to the suite::
  61. # dak admin s-c add unstable main contrib non-free-firmware non-free
  62. Re-run dak init-dirs to add new suite directories to /srv/dak::
  63. # dak init-dirs
  64. Example package flow
  65. --------------------
  66. For this example, we've grabbed and built the hello source package
  67. for AMD64 and copied it into /srv/dak/queue/unchecked.
  68. We start by performing initial package checks which will
  69. result in the package being moved to NEW::
  70. # dak process-upload -d /srv/dak/queue/unchecked
  71. -----------------------------------------------------------------------
  72. hello_2.6-1_amd64.changes
  73. hello (2.6-1) unstable; urgency=low
  74. .
  75. * New upstream release.
  76. * Drop unused INSTALL_PROGRAM stuff.
  77. * Switch to 3.0 (quilt) source format.
  78. * Standards-Version: 3.9.1 (no special changes for this).
  79. source:hello
  80. binary:hello
  81. binary:hello is NEW.
  82. source:hello is NEW.
  83. [N]ew, Skip, Quit ? N
  84. ACCEPT-TO-NEW
  85. Installed 1 package set, 646 KB.
  86. -----------------------------------------------------------------------
  87. We can now look at the NEW queue-report::
  88. # dak queue-report
  89. -----------------------------------------------------------------------
  90. NEW
  91. ---
  92. hello | 2.6-1 | source amd64 | 42 seconds old
  93. 1 new source package / 1 new package in total / 0 new package to be processed.
  94. -----------------------------------------------------------------------
  95. And we can then process the NEW queue::
  96. # dak process-new
  97. -----------------------------------------------------------------------
  98. hello_2.6-1_amd64.changes
  99. -------------------------
  100. Target: unstable
  101. Changed-By: Santiago Vila <sanvila@debian.org>
  102. NEW
  103. hello optional devel
  104. dsc:hello optional misc
  105. Add overrides, Edit overrides, Check, Manual reject, Note edit, Prod, [S]kip, Quit ?A
  106. PENDING ACCEPT
  107. ++++++++++++++
  108. At this stage, the package has been marked as ACCEPTed from NEW.
  109. We now need to process the NEW policy queue::
  110. # dak process-policy new
  111. -----------------------------------------------------------------------
  112. Processing changes file: hello_2.6-1_amd64.changes
  113. ACCEPT
  114. -----------------------------------------------------------------------
  115. We can now see that dak knows about the package::
  116. # dak ls -S hello
  117. -----------------------------------------------------------------------
  118. hello | 2.6-1 | unstable | source, amd64
  119. -----------------------------------------------------------------------
  120. # dak control-suite -l unstable
  121. -----------------------------------------------------------------------
  122. hello 2.6-1 amd64
  123. hello 2.6-1 source
  124. -----------------------------------------------------------------------
  125. Next, we can generate the packages and sources files::
  126. # dak generate-packages-sources2
  127. (zcat /srv/dak/ftp/dists/unstable/main/binary-amd64/Packages.gz for instance)
  128. And finally, we can generate the signed Release files::
  129. # dak generate-release
  130. -----------------------------------------------------------------------
  131. Processing new
  132. Processing byhand
  133. Processing unstable
  134. -----------------------------------------------------------------------
  135. (Look at ``/srv/dak/ftp/dists/unstable/Release``, ``Release.gpg``, and
  136. ``InRelease``)
  137. Enable email notifications
  138. ++++++++++
  139. Comment out `No-Mail "true";` line under Dinstall::Options in `/etc/dak/dak.conf`::
  140. Dinstall
  141. {
  142. Options
  143. {
  144. // No-Mail "true";
  145. };
  146. Next steps
  147. ++++++++++
  148. The debian archive automates most of these steps in jobs called
  149. cron.unchecked, cron.hourly and cron.dinstall.
  150. A simplified example that process unchecked uploads everyday and updates release files.
  151. Create `/etc/dak/cron.sh`::
  152. #!/bin/sh
  153. set -e
  154. DAK=/srv/dak/bin/dak
  155. $DAK process-upload -d /srv/ftp/pub/UploadQueue -a
  156. $DAK generate-packages-sources2
  157. $DAK generate-release
  158. and `/etc/cron.d/dak` (you can adjust the time and frequency as needed)::
  159. 25 10 * * * dak /etc/dak/cron.sh