Build an update package
Create your signing key once, then build a signed update package from a copy of the code with bin/make-update.php.
On this page
An update package is a .zip holding the application's code, a list of every file with its checksum, and a signature made with your private key. You build it on the computer that holds the new version of the code, then install it on each site. See Install a software update.
Before you start
- A copy of the new version's code on your own computer, not on the live server.
- PHP on that computer with the
sodiumandzipextensions.
Run every command below from the project folder.
Create the signing key (once)
php bin/make-update.php --keygen
This creates a key pair and prints the Public key and its Key ID.
- The private key is written outside the project, to
~/.chatilo/update-signing.keyby default. To keep it elsewhere, add--key /path/to/fileor set theCHATILO_UPDATE_KEYenvironment variable. The tool refuses a location inside the project folder. - Keep the private key secret and backed up. Whoever has it can sign updates your sites will install. It never goes into a package or onto a server.
- If a key already exists at that location it is left alone. Sites that trust it would refuse packages signed with a new one.
Install the public key once on every site with php bin/update.php --set-key PUBLIC_KEY. To print it again later:
php bin/make-update.php --public-key
Build a package
php bin/make-update.php 1.0.1 --notes release-notes.txt
The version must look like 1.0.1 or 1.2.0-beta.1, and must not be older than the version in this folder's VERSION file.
The package is written to dist/chatilo-update-1.0.1.zip, and the VERSION file in your folder is set to the new version. The tool then reads the finished package back, checks the signature and every checksum, and prints a summary: files, size, database migrations inside, the delete list and the key it was signed with.
Options
| Option | What it does |
|---|---|
--notes FILE | A text file with the release notes shown to the admin before installing |
--out PATH | Where to write the package: a folder, or a path ending in .zip. Default dist/. Inside the project only dist/ is allowed |
--key FILE | Use the private key at this path |
--previous OLD.zip | The last package you released. Files it had that are gone now go on the delete list |
--no-previous | Build without a delete list |
--min-php 8.1.0 | The lowest PHP version the package may be installed on. Default 8.1.0 |
--no-bump | Leave this folder's VERSION file alone |
--list | Print every file that would go in and every path left out, and build nothing. Works without a version |
The delete list
When a file existed in your last release and is gone now, the update should delete it on the sites. The builder works this out by comparing with the previous package. Without --previous, it uses the newest older package it finds in the output folder, so keep your released packages in dist/. The previous package must be signed with your key.
What goes into a package
Code only. These are always left out, and the updater rejects a package that contains them:
config/andstorage/public/uploads/, and top-leveluploads/andbackups/foldersdist/and anynode_modules/folder- anything whose name starts with a dot, and symbolic links
- databases (
.sqlite,.db),.sqlfiles, logs, archives (.zip,.tar,.gz), key files (.key,.pem,.p12,.pfx), backup and temporary files - local test-account files
File and folder names may use letters, digits, dot, dash and underscore only. A package can hold up to 20,000 files and 500 MB unpacked, and the .zip itself up to 200 MB.
Check what will be packaged before you build:
php bin/make-update.php --list
What happens next
Install the package from Software update in the admin panel, or copy it to the server and run php bin/update.php chatilo-update-1.0.1.zip.
Common problems
"No signing key at …"
Create one with php bin/make-update.php --keygen, or point at yours with --key.
"A signing key already exists at … and was left alone."
You ran --keygen twice. Use --public-key to see the existing key. To start over, move the old file away first; every site then needs the new public key.
"The private key must live outside the project folder…"
Choose a path outside the project with --key.
"This folder is already at version …"
You asked for a version older than the VERSION file. Use a higher number.
"These files have names the updater doesn’t accept…"
Rename or remove the listed files, then build again.
"The previous package … wasn’t signed with your key…"
Pass the right package with --previous, or use --no-previous.
"This PHP has no sodium extension…"
Enable sodium in the PHP you run the builder with.