23 Commits

Author SHA1 Message Date
Clark Boylan
d72012fceb Use tmpfiles.d to create /var/run/reprepro
The mirror-update server uses /var/run/reprepro to stash reprepro flock
files. We do that to ensure that we don't have stale locks after a
reboot bceause /var/run is cleaned on reboot. Problem is we rely on
daily ansible runs to recreate this dir which means that after a reboot
we can wait up to 24 hours before we get reprepro mirroring again.

Fix this via the use of tmpfiles.d which instructs systemd to create the
dir for us on boot. We specifically note (via the !) that this directory
should only be created on boot and we set the age value to - to prevent
systemd from deleting this directory.

Change-Id: I68e49475c54e756ce5a6933390dbe13ace976c29
2021-06-11 15:35:56 -07:00
Zuul
b87ed55db3 Merge "reprepro: mirror Ubuntu UCA Xena" 2021-05-06 02:02:09 +00:00
Marcin Juszkiewicz
8c90c2a611 reprepro: mirror Ubuntu UCA Xena
Change-Id: I918baf8bc9f4c7bb28c471875c04e4ff2ff2c508
2021-05-05 17:44:48 +02:00
Ian Wienand
cc6b1c8810 reprepro : add labels
For reasons explained in [1] Debian's lsb_release.py on bullseye is
falling back to probing "apt-cache policy"

  When (as currently), stretch is the testing release,
  /etc/debian_version contains "stretch/sid", as shipped by
  base-files. It is therefore impossible to rely on that file to
  differentiate between a host running testing or unstable without
  asking apt what is actually preferred when installing packages
  (through parsing `apt-cache policy`). That's how `lsb-release --
  codename` returns "sid" _xor_ "stretch".

The problem is, this parses the output of "apt-cache policy" which
fails for two reasons; firsly we have cleared out all the cache files,
so our hosts return anything until "apt-get update" is run, but
secondly because our mirrors do not have a "label" that matches in
this code at [2]

e.g. what we get out of "apt-cache policy" is

  500 https://mirror.dfw.rax.opendev.org/debian bullseye/main amd64 Packages
      release o=Debian,n=bullseye,c=main,b=amd64
      origin mirror.dfw.rax.opendev.org

which is missing a "l=" field to make this parsing recognise it as a
valid source.

The label is set by reprepro [3]

  Label
    This optional field is simply copied into the Release files.

Add a label to make our mirrors look more like regular mirrors.

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=845651
[2] https://sources.debian.org/src/lsb/11.1.0/lsb_release.py/#L191
[3] https://manpages.debian.org/stretch/reprepro/reprepro.1.en.html

Change-Id: Id705acbb3a01f43ae635a24fa3c24d0a05bdaa16
2021-04-23 13:23:02 +10:00
Jeremy Stanley
2d33597b03 Correct debian-security repo codename for bullseye
Starting in bullseye, Debian's security suite will add -security to
dist codenames, meaning we have stretch, buster, and
bullseye-security entries. Looks inconsistent, but is actually
correct.

Change-Id: I34806145f099868c2cdd95893b69cb1f4915f56f
2021-03-31 21:30:16 +00:00
Jeremy Stanley
08af9a5ab8 Explicitly create empty reprepro dists
Call `reprepro export` to always recreate indices, even for empty
dists. This is sort of a shotgun approach, local testing on the
server indicates it increases total time of a noop update by ~5.5
minutes for the "debian" repo, which is by far the worst case of
anything we mirror.

If this proves problematic, we can engineer a more targeted solution
to check for empty dists and only export those.

Change-Id: I7e39e427e1941f055fae0408e4c1f2a2f2b35547
2021-03-31 19:26:43 +00:00
Zuul
d9723fda95 Merge "reprepo debian : fix line-ending" 2021-03-29 11:01:05 +00:00
Zuul
62ea8d1289 Merge "reprepro: add dist for Ubuntu UCA Wallaby" 2021-03-29 05:44:07 +00:00
Ian Wienand
9457b010f8 reprepo debian : fix line-ending
reprepro warns about lack of a trailing newline

Change-Id: I01c0cc2104cb1b3891ea55b6e4a3eab63885331a
2021-03-29 16:41:26 +11:00
Mark Goddard
0ab854d833 reprepro: add dist for Ubuntu UCA Wallaby
Change-Id: I68357fb8353022c1c808f3a83a3e14da872be6c4
2021-03-23 10:09:36 +00:00
Jonathan Rosser
17a005a69b Add Debian Bullseye to the reprepro config
Change-Id: I01a0dc2087fecfab39c7e6d49b8909d5bf9442ab
2021-03-01 10:27:06 +00:00
Ian Wienand
6b63afaa21 reprepro: only rotate .log files
It seems we're trying to rotate everything in this directory, leading
to an ever increasing set of weird rotation files as old rotations get
rotated themselves.

Change-Id: Ifd53879061baac35253782126367016b74a9cb70
2021-01-18 08:29:49 +11:00
Andrii Ostapenko
762a3dfb4c
Add focal octopus mirror
Signed-off-by: Andrii Ostapenko <andrii.ostapenko@att.com>
Change-Id: Ib89de52a927ea72152a90e79b83e4e4bd25dbc9c
2020-12-10 19:49:06 -06:00
Zuul
de7899b5ff Merge "mirror-update/reprepro : use common functions" 2020-11-10 00:59:37 +00:00
Ian Wienand
166b009613 reprepro: fix apt-puppetlabs volume name
This was missing the leading "apt-"

Change-Id: I61c9823972cf4333232a606c37f2349b0c6c7831
2020-10-29 14:09:42 +11:00
Ian Wienand
b22abc02ff reprepro: catch stderr of individual deb-docker runs
This should catch the stderr of each individual run into the separate
logfile.

Change-Id: Iace3511ee8ec876debfc7361ff814b1d181e1458
2020-10-29 09:41:19 +11:00
Ian Wienand
3ddbba92ae reprepro: fix cron config path and randomise times better
The config should use the full path to the config directory, append
/etc/reprepro to the job.

Currently all the reprepro jobs hash to the same start time because it
uses the hostname as a seed.  Use the unique string name as the seed
so each job starts at a unique time.

Change-Id: If2745d0cd274f390dbff6337b7a44093b5919908
2020-10-29 09:27:29 +11:00
Ian Wienand
6ee7a5a116 mirror-update/reprepro : use common functions
This converts the reprepro mirror script to use the common functions
for timestamps and vos release.  This function ssh's to the AFS server
and runs vos release directly there, avoiding many issues with
kerberos timeouts.  This has been working successfully for the rsync
mirrors.  This will also send stats back so we can keep an eye on the
timing.

Change-Id: I1be29f2d9ecaad03b22c87819e5ae8d16c4f177e
2020-10-28 16:55:02 +11:00
Ian Wienand
10b2cd5fed reprepo: enable cron jobs
Enable the Ansible based cron jobs, and disable the puppet host
versions to cut over the mirroring to the new server.

Change-Id: I0ffb1c484e64e67f5a5017dc3c3c8ebcdc3845c8
2020-10-28 11:29:26 +11:00
Ian Wienand
2ff0843b9e reprepro: deploy Ubuntu keys
I missed these in the original port.  For some reason we are
installing these directly from upstream keyservers in the puppet,
rather than from files like everything else.

Change-Id: Ie1fa956b96f3e6d091b3ffcaab5e0be370da8fc7
2020-10-28 11:29:26 +11:00
Ian Wienand
77eb5dfb66 reprepro: install keytab
In converting this to ansible I forgot to install the reprepro keytab.
The encoded secret has been added for production.

Change-Id: I39d586e375ad96136cc151a7aed6f4cd5365f3c7
2020-10-27 15:14:47 +11:00
Ian Wienand
5596d57be7 reprepro: fixup script name
Everything expects this to be called 'reprepro-mirror-update' (no
.sh); rename the file.

Change-Id: I8ec6ff4ed2afe6487959ef56dc0603f9d316d1a3
2020-10-27 15:09:46 +11:00
Ian Wienand
3eceba5749 reprepro: convert to Ansible
This converts the reprepro configuration from our existing puppet to
Ansible.

This takes a more direct approach; the templating done by the puppet
version started simple but over the years grew several different
options to handle various use-cases.  This means you not only had to
understand the rather obscure reprepro configuration, but then *also*
figure out how to translate that from our puppet template layers.

Here the configuration files are kept directly (they were copied from
the existing mirror-update.openstack.org) and deployed with some light
wrapper tasks in reprepro/tasks/utils which avoids most duplication.

Note the initial cron jobs are left disabled so we can run some manual
testing before letting it go automatically.

Change-Id: I96a9ff1efbf51c4164621028b7a3a1e2e1077d5c
2020-10-19 14:06:57 +11:00