Docs Getting started
Upgrade BYOMailer
Update a Docker install or a manual install to a new version, and rotate the application key.
An upgrade replaces the code and runs the new database migrations. Back up the instance before each upgrade.
Read the changes first
CHANGELOG.md lists the changes of each version. BYOMailer uses semantic versioning, and each release has a Git tag vX.Y.Z.
To find the version that runs:
- In a Git install, run
git describe --tags. - With the published image, read the value of
BYOMAILER_VERSIONin.env.
Read CHANGELOG.md from your version to the new version before you upgrade. Look for changes to environment variables, to docker-compose.yml, and to the AWS permissions.
The release notes list the changes that users can see, by date. They have no version numbers.
Back up first
Back up these items before you start:
.env, withAPP_KEY.- The database. In Docker, this is the
mysqlvolume. - The uploaded files. In Docker, this is the
storagevolume.
Backups gives the commands.
Caution: Do not start an upgrade without a database backup. The migrations change the database, and a failed upgrade can leave it in a mixed state.
Upgrade a Docker install
-
Back up the instance.
-
Get the new code:
git pull -
Compare
.env.examplewith your.env. Add the new variables that you need. -
If you use the
ses-eventsworker, add--profile sesto the command of the next step. Without the profile, Compose does not rebuild that service. -
Rebuild the image and restart the stack:
docker compose up -d --build -
Wait until
docker compose psshows thewebservice as healthy. -
Read the log of the
webservice for errors:docker compose logs web
The web service runs the new migrations each time it starts, before NGINX serves requests. The horizon, scheduler, and ses-events services start only after the web service is healthy. Only the web service runs the migrations.
Upgrade with the published image
If you use docker-compose.image.yml, do these steps:
- Back up the instance.
- If you set an exact version, set the new
BYOMAILER_VERSIONin.env. - Run
docker compose -f docker-compose.image.yml pull. - Run
docker compose -f docker-compose.image.yml up -d. If you use theses-eventsworker, add--profile ses. - Wait until the
webservice showshealthy. Thewebservice runs the migrations.
With BYOMAILER_VERSION=latest, each pull can move to a new version. Set an exact version to control the time of the upgrade.
Upgrade a manual install
-
Back up the instance.
-
Optional: put the app in maintenance mode:
php artisan down -
Get the new code:
git pull -
Compare
.env.examplewith your.env. Add the new variables that you need. -
Install the PHP dependencies:
composer install --no-dev --optimize-autoloader -
Install the Node dependencies and build the frontend:
npm ci npm run build -
Run the migrations:
php artisan migrate --force -
If you cache the configuration, cache it again:
php artisan config:cache -
Stop Horizon, so that the process manager starts it again with the new code:
php artisan horizon:terminate -
Send the restart signal. The
ses-events:pollworker stops when it gets this signal:php artisan queue:restart -
Restart the scheduler process.
-
If OPcache is on, reload PHP-FPM.
-
If you used maintenance mode, end it:
php artisan up
Make sure that the process manager started php artisan horizon and php artisan ses-events:poll again. Install without Docker lists the processes.
Notes for older installs
The migration of 2026-11-17 adds the owner of the instance. It makes each user in ADMIN_EMAILS an owner. If ADMIN_EMAILS is empty, the instance has no owner after the upgrade. Then run this command:
php artisan byomailer:install --promote=person@example.com
In Docker, put docker compose exec web before the command.
An instance that started on version 0.1.0 or later does not need ses-events:migrate-to-sqs, ses:migrate-configuration-sets or ses:backfill-tenants. These commands convert data from development builds before the first release. The current AWS onboarding creates the SQS subscription, the tenant and one configuration set for each identity.
Before this release, the Update Credentials form in Settings > Email Credentials erased the SNS topic and the tenant of the account. If a user saved new keys with that form, the SES events of the account stopped. To correct this, the user runs the AWS onboarding again at /onboarding/aws.
Rotate the application key
APP_KEY encrypts the AWS access keys of each account, the storage keys, and the webhook secrets. config/app.php reads APP_PREVIOUS_KEYS, a comma-separated list of old keys. Laravel uses these old keys to decrypt values that it cannot decrypt with APP_KEY.
-
Back up
.envand the database. -
Generate a new key:
openssl rand -base64 32 -
In
.env, copy the current value ofAPP_KEYtoAPP_PREVIOUS_KEYS. -
In
.env, setAPP_KEY=base64:followed by the new key. -
Restart the stack. In Docker, run
docker compose up -d. In a manual install, cache the configuration again and restart the processes. -
Open Settings > Email Credentials and make sure that the credentials still show.
The values in the database stay encrypted with the old key. BYOMailer has no command that encrypts them again with the new key. Keep the old key in APP_PREVIOUS_KEYS until BYOMailer saved each encrypted value again.
Warning: Do not remove an old key from APP_PREVIOUS_KEYS while the database has values that it encrypted. If you remove it, BYOMailer cannot read these values, and each account must enter its AWS credentials again.
BYOMailer has no re-encryption command, and the project does not plan one. Keep each old key in APP_PREVIOUS_KEYS for the life of the instance. An old key in this list costs one more decryption attempt for each old value. Back up the old keys with .env.