Repository navigation
Upgrading
A new KeyAnyWhere version is a Git tag. Upgrading means backing up, switching the code to the new tag, installing its dependencies, running its migrations and clearing the cache. This page walks through it for an installation made with the production path.
Read the release notes of every version between yours and the new one on the Releases page. A version that needs a manual step says so there.
See which version you are on and which versions exist:
cd /var/www/keyanywheregit fetch --tags && git describe --tagsgit tag --sort=-v:refname | head -n 5Set the version you are upgrading to (the first line of the previous command):
KAW_VERSION=v2.4.0Take a database backup as in Backup and Restore. If the upgrade goes wrong, this backup and the previous tag bring you back.
git status must show no changes in the project: local changes belong in config/app_local.php and in local plugins, which Git ignores.
git status --shortgit checkout "$KAW_VERSION"composer install --no-dev --optimize-autoloader --no-interactionThe migrations of the new version update the tables; the cache may still hold the old table structure.
sudo -u www-data kaw-cake migrations migratesudo -u www-data kaw-cake cache clear_allNew files come with your user's default permissions. Run the steps of File Permissions again, then restart Apache so PHP drops the old code from its cache (OPcache):
sudo chown -R "$USER":www-data /var/www/keyanywhere && sudo chmod -R u=rwX,g=rX,o= /var/www/keyanywheresudo setfacl -R -m u:www-data:rwX -m u:"$USER":rwX /var/www/keyanywhere/tmp /var/www/keyanywhere/logs && sudo setfacl -R -d -m u:www-data:rwX -m u:"$USER":rwX /var/www/keyanywhere/tmp /var/www/keyanywhere/logssudo systemctl restart apache2git describe --tagssudo -u www-data kaw-cake migrations statusThe first command prints the new version, and every migration reads up. Then log in and open a few entries.
If something fails, go back to the previous tag and restore the backup taken in step 1. Restoring is needed when the new version had already changed the database.
git checkout PREVIOUS_TAG && composer install --no-dev --optimize-autoloader --no-interactionReplace PREVIOUS_TAG with the version printed by git describe --tags at the start, then follow Backup and Restore.
Since 2.4.1, the connection to PostgreSQL requires SSL (sslmode=require). Until 2.4.0 the setting was in a place CakePHP ignores, so a PostgreSQL without SSL was accepted, without encryption. Before upgrading, check that your database accepts SSL:
psql "host=127.0.0.1 dbname=keyanywhere user=kaw" -tAc 'SHOW ssl;'If the answer is off, turn SSL on or set ssl_mode in config/app_local.php first, as in Troubleshooting. Otherwise the site stops connecting to the database right after the upgrade.
Version 2.4.0 changed how the configuration is organized, so an installation on 2.3.x or older needs a few extra steps, on top of the ones above. This section lists them in the order to do them. There are no new migrations in 2.4.0.
The steps above use the environment file and the kaw-cake command from Environment Variables. If your installation keeps the variables elsewhere (for example SetEnv lines in the Apache site), create them first, following that page with your current values.
Warning
Don't let that page generate new keys for an existing installation: with a new KEY_CRIPTOGRAFIC, every stored secret becomes unreadable. Write the file by hand with the values you already use.
Up to 2.3.x, config/app.php was your own copy of config/app.example.php, ignored by Git. Since 2.4.0 it is part of the code, and git checkout replaces an ignored file without asking. Save your copy before step 2:
cd /var/www/keyanywherecp config/app.php ~/app.php.before-2.4.0After the upgrade, compare your old copy with the example it came from. Every difference is a change you made, and it now goes into config/app_local.php (Configuration Files) or into an environment variable:
git diff --no-index <(git show v2.3.0:config/app.example.php) ~/app.php.before-2.4.0| Before 2.4.0 | Since 2.4.0 |
|---|---|
DEBUG turned on debug
|
config/app.php keeps debug off; DEBUG is only read by a config/app_local.php made from the development example. |
DB_DEFAULT_SSLMODE |
Removed. It never had an effect (CakePHP didn't read it where it was set). Since 2.4.1 the connection requires SSL; see below. |
| — |
DB_DEFAULT_PORT (default 5432). |
EMAIL_TRANSPORT_DEFAULT_URL |
Replaced by EMAIL_TRANSPORT_DEFAULT_HOST, _PORT, _TLS, _USER, _PASSWORD and EMAIL_DEFAULT_FROM. The core doesn't send e-mail yet. |
LOG_DEBUG_URL, LOG_ERROR_URL
|
Removed: logs are one JSON file per level (Logs and Security Events). Change them in config/app_local.php. |
| — |
CONFIG_INICIAL_TOKEN: only needed while the system has no configured user, so an installation that is already configured is not affected. |
The full list is in the Environment Variables reference.
Since 2.4.0, KeyAnyWhere refuses to start when SECURITY_SALT is empty or shorter than 32 characters. Versions up to 2.3.x also shipped a fixed SECURITY_SALT in config/.env.example: an installation that copied it uses a value that anyone can read in the repository. This command looks for that value in the environment file and in the Apache configuration:
KAW_OLD_SALT=$(git show v2.3.0:config/.env.example | sed -n 's/^export SECURITY_SALT="\(.*\)"/\1/p')sudo grep -rlF "$KAW_OLD_SALT" /etc/keyanywhere /etc/apache2 2>/dev/null || echo "SECURITY_SALT: not the old example value"If it lists a file, generate a new salt (Generating Security Keys) and replace it there. Users are logged out; nothing is lost. KEY_CRIPTOGRAFIC was never shipped with a value, so it doesn't need this check (and must never be changed).
Source code · Issues · Releases · Packagist · Online demo · Hosted edition
1. Getting started
2. Installing in production
- Overview
- Preparing the Server
- Installing KeyAnyWhere
- File Permissions
- Generating Security Keys
- Environment Variables
- Configuration Files
- Database Setup
- Insecure Password Catalog
- Web Server and HTTPS
- First-Run Setup
3. Operating your installation
4. Using KeyAnyWhere
5. Security
6. Development
7. Extending