opam.ocaml.org maintenance scripts
April 19, 2017 ยท View on GitHub
opam.ocaml.org is hosted on a Debian VM ; @avsm, @samoht and @AltGr have accounts there, but everything of interest is in an 'opam' account:
~opam
|-- git
| |-- opam (branch 1.2; updated every night)
| |-- opam2 (branch master; updated every night)
| |-- opamfu (updated, reset, compiled and installed every night)
| |-- opam2web (updated, reset, compiled and installed every night)
| `-- scripts (no auto-update: git pull manually)
|-- local (where the above are installed)
| |-- bin (contains the binaries and symlinks to the scripts)
| `-- share
|-- var
| `-- log (holds both the apache logs and cron logs)
|-- www (currently deployed opam web. Rebuilt every hour)
|-- www-bak (previous version)
`-- www-new (version currently being built by the scripts, swapped with www once done)
The scripts include:
cron-wrapper.shfills the logs and reports failures by mail to opam-commits@update-from-git.shsynchronises sources ingit/with git remotes, recompiles and installs, with specific instructions depending on the target (e.g.opam2installs the needed tools, e.g. opam-admin, into specific dir/filenames to not overlap withopam)update-opam-repo.shsynches the opam repo from github and upgrades. It works on~/www-new/, but keeps thearchives/and1.1/subdirectories along from~/www/before updating. The archives and indexes are updated (opam-admin), version-migrated mirrors are put in place (opam-admin.2.0), the documentation is regenerated, as well as the website, including blog and statistics (opam2web). Thenwww-newis swapped forwwwif successful.
What is updated only manually
-
Update of these scripts:
cd git/scripts && git pull -
Update the server config:
cp nginx.conf /etc/nginx/sites-available/default kill -HUP $(cat /var/run/nginx.pid) -
Update the crontab:
crontab crontab
Pre-requirements and initialisation
Additionally to the above:
-
An initialised opam 1.2.2 root with a working switch suitable for compilation of opam 1.3 and 2.0, and the tools is required (
ocaml.4.04.0 cmdliner.0.9.8 cudf.0.7 dose3.5.0.1 jsonm.1.0.1 ocamlgraph.1.8.7 re.1.7.1for opam, addopam-file-formatfor opam2,heveafor the manual, `js_of_ocaml.2.8.4 cow.2.2.0 for opamfu/opam2web), -
The folders below
~opam/git/need an initial clone for the update script to operate ; run theupdate-from-git.shscript for each of them (see crontab) at least once before runningupdate-opam-repo.sh. Note that opamfu and opam2web use the forks at github.com/AltGr/ -
A clone of the opam-repository git at
~opam/wwwis required forupdate-opam-repo.shto bootstrap. Includearchives/,urls.txt,index.tar.gzto keep incremental archive rebuilds. -
Ensure
~opam/var/logand~/local/{bin,share}exist. -
The computation of the statistics in
update-opam-repo.shassumes log files at~opam/var/log/access-YEAR-MONTH.logand~/var/log/access.log(as configured by the included nginx.conf). This takes a long time, soopam2webuses a cache at~/.cache/opam2web/stats_cache.