README 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. Initialising a dak database schema
  2. ==================================
  3. The following packages are needed for the database:
  4. * postgresql-9.4 postgresql-client-9.4 postgresql-9.4-debversion
  5. and the following packages for dak itself:
  6. * python-psycopg2 python-sqlalchemy python-apt gnupg dpkg-dev lintian
  7. binutils-multiarch python-yaml less python-ldap python-pyrss2gen python-rrdtool
  8. symlinks python-debian
  9. (the schema assumes at least postgresql 9.1; ftpmaster in Debian currently uses
  10. the postgresql 9.4 version from Debian 8)
  11. The following roles are assumed to exist:
  12. * dak: database superuser: needs to be an actual user
  13. * ftpmaster: role which should be given to archive administrators
  14. * ftpteam: people who can do NEW processing, overrides, removals, etc
  15. * ftptrainee: people who can add notes to packages in NEW
  16. For the purposes of this document, we'll be working in /srv/dak
  17. Set up the dak user:
  18. # sudo addgroup ftpmaster
  19. # sudo adduser dak --disabled-login --ingroup ftpmaster --shell /bin/bash
  20. Create postgres roles and database:
  21. # sudo -u postgres psql
  22. CREATE USER dak CREATEROLE;
  23. CREATE ROLE ftpmaster WITH ROLE dak;
  24. CREATE ROLE ftpteam WITH ROLE ftpmaster;
  25. CREATE ROLE ftptrainee WITH ROLE ftpmaster, ftpteam;
  26. CREATE DATABASE projectb WITH OWNER dak TEMPLATE template0 ENCODING 'SQL_ASCII';
  27. \c projectb
  28. CREATE EXTENSION IF NOT EXISTS plpgsql;
  29. CREATE EXTENSION IF NOT EXISTS debversion;
  30. Set up the dak directory:
  31. # sudo mkdir /etc/dak
  32. # sudo mkdir /srv/dak
  33. # sudo chown dak:ftpmaster /srv/dak
  34. # sudo chmod 2775 /srv/dak
  35. Create a symlink to /srv/dak/dak.conf in /etc/dak
  36. (we'll create the config file in a bit)
  37. # sudo ln -s /srv/dak/dak.conf /etc/dak/dak.conf
  38. Become the dak user:
  39. # sudo -u dak -s -H
  40. Import the schema. We redirect STDOUT to /dev/null as otherwise it's
  41. impossible to see if something fails.
  42. # psql -1 -f current_schema.sql -d projectb >/dev/null
  43. Set up some core data in projectb to get started (read the init_vars file if
  44. you wish to customise various aspects):
  45. # ./init_core
  46. Create a minimal dak.conf
  47. # ./init_minimal_conf > /srv/dak/dak.conf
  48. Set up a symlink somewhere
  49. # mkdir ~dak/bin
  50. # ln -s /path/to/dak.py ~dak/bin/dak
  51. At this point, you should be able to test that the database schema is
  52. up-to-date
  53. # dak update-db
  54. Run dak init-dirs to set up the initial /srv/dak tree
  55. # dak init-dirs
  56. Copy the email templates into the /srv/dak tree.
  57. WARNING: Please check these templates over and customise as necessary
  58. # cp templates/* /srv/dak/templates/
  59. Set up a private signing key: don't set a passphrase as dak will not
  60. pass one through to gpg. Guard this key carefully!
  61. The key only needs to be able to sign, it doesn't need to be able
  62. to encrypt.
  63. # gpg --no-default-keyring --secret-keyring /srv/dak/keyrings/s3kr1t/dot-gnupg/secring.gpg --keyring /srv/dak/keyrings/s3kr1t/dot-gnupg/pubring.gpg --gen-key
  64. Remember the signing key id for when creating the suite below.
  65. Here we'll pretend it is DDDDDDDD for convenience
  66. Import some developer keys.
  67. Either import from keyservers (here AAAAAAAA):
  68. # gpg --no-default-keyring --keyring /srv/dak/keyrings/upload-keyring.gpg --recv-key AAAAAAAA
  69. or import from files:
  70. # gpg --no-default-keyring --keyring /srv/dak/keyrings/upload-keyring.gpg --import /path/to/keyfile
  71. Import the developer keys into the database
  72. The -U '%s' tells dak to add UIDs automatically
  73. # dak import-keyring -U '%s' /srv/dak/keyrings/upload-keyring.gpg
  74. Add some architectures you care about:
  75. # dak admin architecture add i386 "Intel x86 port"
  76. # dak admin architecture add amd64 "AMD64 port"
  77. Add a suite (origin=, label= and codename= are optional)
  78. signingkey= will ensure that Release files are signed
  79. # dak admin suite add-all-arches unstable x.y.z origin=MyDistro label=Master codename=sid signingkey=DDDDDDDD
  80. Add the components to the suite
  81. # dak admin s-c add unstable main contrib non-free
  82. Re-run dak init-dirs to add new suite directories to /srv/dak
  83. # dak init-dirs
  84. #######################################################################
  85. # Example package flow
  86. #######################################################################
  87. For this example, we've grabbed and built the hello source package
  88. for AMD64 and copied it into /srv/dak/queue/unchecked.
  89. We start by performing initial package checks which will
  90. result in the package being moved to NEW
  91. # dak process-upload -d /srv/dak/queue/unchecked
  92. -----------------------------------------------------------------------
  93. hello_2.6-1_amd64.changes
  94. hello (2.6-1) unstable; urgency=low
  95. .
  96. * New upstream release.
  97. * Drop unused INSTALL_PROGRAM stuff.
  98. * Switch to 3.0 (quilt) source format.
  99. * Standards-Version: 3.9.1 (no special changes for this).
  100. source:hello
  101. binary:hello
  102. binary:hello is NEW.
  103. source:hello is NEW.
  104. [N]ew, Skip, Quit ? N
  105. ACCEPT-TO-NEW
  106. Installed 1 package set, 646 KB.
  107. -----------------------------------------------------------------------
  108. We can now look at the NEW queue-report
  109. # dak queue-report
  110. -----------------------------------------------------------------------
  111. NEW
  112. ---
  113. hello | 2.6-1 | source amd64 | 42 seconds old
  114. 1 new source package / 1 new package in total / 0 new package to be processed.
  115. -----------------------------------------------------------------------
  116. And we can then process the NEW queue:
  117. # dak process-new
  118. -----------------------------------------------------------------------
  119. hello_2.6-1_amd64.changes
  120. -------------------------
  121. Target: unstable
  122. Changed-By: Santiago Vila <sanvila@debian.org>
  123. NEW
  124. hello optional devel
  125. dsc:hello extra misc
  126. Add overrides, Edit overrides, Check, Manual reject, Note edit, Prod, [S]kip, Quit ?A
  127. PENDING ACCEPT
  128. -----------------------------------------------------------------------
  129. At this stage, the package has been marked as ACCEPTed from NEW.
  130. We now need to process the NEW policy queue:
  131. # dak process-policy new
  132. -----------------------------------------------------------------------
  133. Processing changes file: hello_2.6-1_amd64.changes
  134. ACCEPT
  135. -----------------------------------------------------------------------
  136. We can now see that dak knows about the package:
  137. # dak ls -S hello
  138. -----------------------------------------------------------------------
  139. hello | 2.6-1 | unstable | source, amd64
  140. -----------------------------------------------------------------------
  141. # dak control-suite -l unstable
  142. -----------------------------------------------------------------------
  143. hello 2.6-1 amd64
  144. hello 2.6-1 source
  145. -----------------------------------------------------------------------
  146. Next, we can generate the packages and sources files:
  147. # dak generate-packages-sources2
  148. (zcat /srv/dak/ftp/dists/unstable/main/binary-amd64/Packages.gz for instance)
  149. And finally, we can generate the signed Release files:
  150. # dak generate-release
  151. -----------------------------------------------------------------------
  152. Processing new
  153. Processing byhand
  154. Processing unstable
  155. -----------------------------------------------------------------------
  156. (Look at /srv/dak/ftp/dists/unstable/Release, Release.gpg and InRelease)
  157. #######################################################################
  158. # Next steps
  159. #######################################################################
  160. The debian archive automates most of these steps in jobs called
  161. cron.unchecked, cron.hourly and cron.dinstall.
  162. TODO: Write example (simplified) versions of these cronjobs which will
  163. do for most installs.