Update service
- RAM requirements: under 100 MB
- CPU requirements: non-existing
- SSD requirements: non-existing; reads builds from the downloads server, which must be on the same host
Exposed to public as:
updates.vcmi.eu/autoupdate.json- update information for VCMI launchers (behind Cloudflare; nginx proxies HTTPS to the service's plain-HTTP listener on127.0.0.1:3040)updates.vcmi.eu/altstore.json- AltStore source for side-loaded iOS builds, also used by SideStore and similar apps
The code is in updates/ and is packaged as a .deb by the "Build VCMI Update Service" CI job.
- Start / stop / restart:
systemctl start|stop|restart vcmi-updates - Examine log:
journalctl -u vcmi-updates - Check all data and the build files that can be offered:
vcmi-updates-release check - Configuration:
/etc/vcmi-updates.conf - Request statistics:
/var/log/nginx/updates.access.logholds time, version, OS, architecture, distribution and channel of every request, without client addresses. Kept for 14 days by the default nginx logrotate configuration. Requests per day and version:awk '{print substr($1, 1, 10), $2}' /var/log/nginx/updates.access.log | sort | uniq -c
Data
The service reloads its data within 10 seconds of any change. If changed data is invalid, the service logs an error and keeps using the previous data. Run vcmi-updates-release check after every hand edit.
/var/lib/vcmi-updates/releases/<version>.json- release record, created byvcmi-updates-release add/var/lib/vcmi-updates/releases/<version>.md- changelog section shown for that release/var/lib/vcmi-updates/channels/<channel>.json- source of updates for thestable,betaanddevelopchannels/var/lib/vcmi-updates/altstore.json- template of the AltStore source/home/downloader/www/branch/<branch>/metadata/*.json- build manifests uploaded by CI, one per CI run, listing all builds of that run
Release record
version- release version,1.X.Y. Must match the file name and the build manifestcommit- 7-character commit of themasterbuild; selectsbranch/master/metadata/VCMI-branch-master-<commit>.jsondate- release date shown to players,YYYY-MM-DD. Set byvcmi-updates-release publishstatus-draftorpublished. Onlypublishedrecords are offeredpartial- optional,trueif only platforms listed inplatformsreceive this releasecommon- optional section that applies to all platformsplatforms- optional sections for an OS (windows) or a platform (windows-x64). Platform keys use theosandarchvalues sent by the launcher
Each section may have:
action- highest action allowed for these platforms:install,downloadorexternal. Default isinstallnotes- list of short messages shown to players above the changelog
Sections are applied in the order common, OS, platform. notes of all three are shown.
Channels
{ "source": "releases" }- offer the latest published release{ "source": "branch", "branch": "beta" }- offer the latest build of this branch
stable always uses releases. When a beta phase is over, copy stable.json over beta.json: beta builds are then offered the stable release. When a new beta phase starts, restore { "source": "branch", "branch": "beta" }.
AltStore source
/altstore.json is the template with an entry for every published release that applies to ios-arm64 and whose ios-arm64 package matches the build manifest. The entries of releases are placed before the entries of the template, highest version first:
version,date- from the release recordsize,downloadURL- of theios-arm64package in the build manifest of the release, on download.vcmi.euminOSVersion-min_os_versionin the[altstore]section of the configurationlocalizedDescription-notesof the release record forios-arm64, followed by the changelog section without its heading
The template holds everything else: the source and app metadata, screenshots, and entries of releases made before the update service, which download from GitHub releases. It must contain exactly one app. A version that has a release record must not be listed in the template. The service is the only source of /altstore.json, so screenshots and icons are referenced by URL from other servers.
setup.sh creates the template from scripts/updates/altstore.json if it does not exist yet. Later changes are made on the server.
Making a release
- Merge
betaintomasterand wait for the CI run to finish, including the job that uploads the build manifest - Make sure the release section in
ChangeLog.mdonmasteris final (no(in development)) vcmi-updates-release add 1.X.Y <commit> --notes "..."- checks the build manifest and its files, fetches the changelog section, and creates a draft record- Optionally, edit the draft by hand, then run
vcmi-updates-release check - Publish the GitHub release
vcmi-updates-release publish 1.X.Y- Verify:
curl 'https://updates.vcmi.eu/autoupdate.json?version=1.0.0&os=windows&arch=x64&dist=installer'andcurl https://updates.vcmi.eu/altstore.json
Fix for some platforms only: the same, with a new version number and --only <OS or platform>....
To withdraw a release, set its status back to draft and run vcmi-updates-release check. Clients are offered the previous published release instead.
Setup
All operational scripts live in scripts/updates/. Copy the directory to /root/updates/ on the host of the downloads server.
- Add DNS record
updates.vcmi.eufor the host in Cloudflare, proxied - Place certificates in
/root/certs/on the server (dot.vcmi.eu.pem,dot.vcmi.eu.key,cloudflare-client.crt) - Place the
.debpackage produced by the "Build VCMI Update Service" CI job at any reachable path, e.g./root/vcmi-updates.deb scp -r scripts/updates root@new-server:/root/- On the server:
setup.sh creates channel configurations and the AltStore template if they do not exist yet.
Upgrade
Data in /var/lib/vcmi-updates is not part of the package and is kept.
Migration
The service must move together with the downloads server, since it reads build files from disk.
- On the old server:
./export.sh- produces/root/updates-backup.tar.gz - Provision the new server and run the Setup steps above
- Transfer the backup:
ssh -A root@old-server "scp /root/updates-backup.tar.gz root@new-server:/root/" - On the new server:
./import.sh /root/updates-backup.tar.gz