Migration routine

Surroundings

If you use Luna Platform Docker deployment, skip this step (all the required dependencies are already installed in the Events service image). Otherwise you need to:

  • replace all the Events project files with the files of the current version

  • install python dependencies:

Warning

It is strongly recommended to create virtual surroundings for python dependencies installation.

pip install -r requirements.txt

Service settings migration

If you don’t use Configurator service, all you need is to set up your Events configuration file luna_events/configs/config.conf. Otherwise, you need to execute settings migration.

If your previous Luna Platform version was used with non-default service settings, backup the service settings dump-file. To create a dump-file, use the following options (may be executed from anywhere on your server):

wget -O settings_dump_backup.json 127.0.0.1:5070/1/dump

To perform the migration, set up your migration configuration file in the following format:

[LUNA_CONFIGURATOR_DB]

#: [string] database type - "postgres" or "oracle"
DB_TYPE = postgres
#: [string] database host
DB_HOST = 127.0.0.1
#: [integer] database port; 5432 - default for "postgres" type, 1521 - default for "oracle" type
DB_PORT = 5432
#: [string] database username
DB_USER = luna
#: [string] database password
DB_PASSWORD = luna
#: [string] database name for "postgres" type, SID name for "oracle" type
DB_NAME = luna_configurator

and execute the command:

(cd luna_events/configs/configs && python -m configs.migrate head --config=<YOUR_CONFIG_PATH>)

If you use Luna Platform Docker deployment, use the following options:

docker run \
    -v /etc/localtime:/etc/localtime:ro \
    -v <YOUR_CONFIG_PATH>:/srv/luna_events/configs/configs/migration/config.conf \
    --rm \
    --network=host \
    --entrypoint=/bin/bash \
    dockerhub.visionlabs.ru/luna/luna-events:<Events_tag> \
    -c "cd /srv/luna_events/configs/configs; python3.9 -m configs.migrate --profile platform head;"

Make sure your non-default service settings are up-to-date with your backup settings dump-file.

Database migration

You need to execute migration scripts to update your Events database structure.

Warning

It is highly recommended to create a backup of your database before applying any changes.

If you don’t use the Configurator service, you need to set up your Events configuration file and run migration with the following options:

alembic -x config=luna_events/configs/config.conf upgrade head

If you use the Configurator service, use the luna-config option with Configurator service origin:

alembic -x luna-config=http://127.0.0.1:5070/1 upgrade head

If you use Luna Platform Docker deployment, use the following options:

docker run \
-v /etc/localtime:/etc/localtime:ro \
--rm \
--network=host \
--entrypoint=/bin/bash \
dockerhub.visionlabs.ru/luna/luna-events:<Events_tag> \
-c "alembic -x luna-config=http://127.0.0.1:5070/1 upgrade head"

Compatibility

Before starting the Events service, make sure other services are migrated to compatible versions (i.e. belong to the current release).