Upgrading On RedHat (CentOS) - RPM

Last updated: 5 minutes read.

The following guide explains how to upgrade Tyk Self-Managed running on RHL

Upgrade guide video

Please refer to our upgrade guide video below for visual guidance of upgrading Tyk Self-Managed (RPM).


Preparations

After reviewing guidelines for preparing for upgrade, follow the instructions below to upgrade your Tyk components and plugins.

Upgrade order: Please note that upgrade order is as explained in the upgrade overview

Distro versions

Tyk supports the following Centos and Rhel distributions:

Distribution Version
Centos 7
Rhel 9
Rhel 8
Rhel 7

Our repositories will be updated at https://packagecloud.io/tyk when new versions are released.

During the initial deployment of Tyk, your team may have utilized YUM repositories or directly downloaded the .rpm files. To verify the presence of YUM repositories on the server, inspect the following locations:

  • Dashboard: /etc/yum.repos.d/tyk_tyk-dashboard.repo
  • Gateway: /etc/yum.repos.d/tyk_tyk-gateway.repo
  • Pump: /etc/yum.repos.d/tyk_tyk-pump.repo

If the above files are not present, it is worthwhile checking internally that the initial deployment was done by manually downloading and installing the .rpm files. This is common in airtight environments without internet access.

Verify Target Package Availability

Depending on the Linux distribution that you are using, ensure that you are pulling the correct version and distribution from the packagecloud.io/tyk repository.

The package name contains the version number and the distro/version column displays the specific distribution release.

Package names

Backups

Before upgrading, ensure that the configuration files and databases are backed up.

Configuration files

Please take a backup of the following configuration files for each Tyk component. This will be useful in case you need to cross reference configuration changes or need to rollback your deployment.

  • Dashboard Configuration File: /opt/tyk-dashboard/tyk_analytics.conf
  • Gateway Configuration File: /opt/tyk-gateway/tyk.conf
  • Pump Configuration File: /opt/tyk-pump/pump.conf

Databases

Note Redis and MongoDB are not Tyk products and what we provide here are basic backup and restore instructions. It is advisable to consult the official documentation for Redis and MongoDB on backups.

Redis

For more detailed instructions on managing Redis backups, please refer to the official Redis documentation: https://redis.io/docs/management/persistence/

The Redis SAVE command is used to create a backup of the current Redis database. The SAVE command performs a synchronous save of the dataset producing a point in time snapshot of all the data inside the Redis instance, in the form of an RDB file.

# Using SAVE, if the previous dump.rdb file exists in the working directory, it will be overwritten with the new snapshot

SAVE
Example

Redis SAVE example

To restore Redis data, follow these steps:

  • Move the Redis backup file (dump.rdb) to your Redis directory.
  • Start the Redis server

To locate your Redis directory, you can use the CONFIG command. Specifically, the CONFIG GET command allows you to read the configuration parameters of a running Redis server. Example:

Redis CONFIG example

MongoDB

For detailed instructions on performing backups in MongoDB, please refer to the official MongoDB documentation: https://www.mongodb.com/docs/manual/core/backups/

To capture a snapshot of a MongoDB database from a remote machine and store it locally, utilize the mongodump command on the primary node. Specify the host and port number (default is 27017) of the remote server, along with additional parameters such as the database name, user credentials and password. Lastly, designate the directory where the snapshot should be created.

mongodump --db tyk_analytics --out /path/to/dump/directory
Example

Mongo DUMP example

To restore a database using a previously saved snapshot, simply employ the mongorestore command.

mongorestore --host <hostname> --port <port> --username <username> --password <password> /path/to/dump/directory

Upgrade Tyk Packages

Before executing the upgrade, ensure that you have consulted and performed all the necessary steps in the pre upgrade checklist.

1. Update Tyk Repositories

Fetch and update information about the available packages from the specified repositories.

sudo yum -q makecache -y --disablerepo='*' --enablerepo='tyk_tyk-dashboard'
sudo yum -q makecache -y --disablerepo='*' --enablerepo='tyk_tyk-gateway'
sudo yum -q makecache -y --disablerepo='*' --enablerepo='tyk_tyk-pump'

Or
# To update ALL repositories in your system instead

sudo yum -q makecache -y

2. Verify availability of target upgrade packages

List current versions of Tyk using the command below:

rpm -qa | grep -i tyk

Example

List RPM packages example

List available versions of upgradable packages of Tyk components and ensure that the version you are planning to upgrade to is listed in the output of the above command.

yum --showduplicates list tyk*

Example:

List version example

List version example

3. Upgrade Tyk Components

Note: Please specify the exact version you are upgrading into.

yum update tyk-dashboard-<desired-version>
yum update tyk-gateway-<desired-version>
yum update tyk-pump-<desired-version>

Example

Update example

4. Restart Tyk Components

After upgrading Tyk, restart the services

# Restart Services
systemctl restart tyk-dashboard
systemctl restart tyk-gateway
systemctl restart tyk-pump

# Check status of Tyk Components
systemctl status tyk-dashboard
systemctl status tyk-gateway
systemctl status tyk-pump

5. Health check on upgraded Tyk components

Perform a health check on all 3 Tyk Components. The host and port number varies on your setup.

Tyk Dashboard

curl http://localhost:3000/hello

Tyk Gateway

curl http://localhost:8080/hello

Tyk Pump

curl http://localhost:8083/health

Revert upgrade

If the upgrade fails you can revert to the old version by following the steps below.

1. Inspect package logs

Use the command below to fetch information for all updates, noting the ID for the specific “update” action to revert to allow verifiying the packages:

yum history

2. Verify update

Display details of the specific “update” transaction, replacing ID noted in the previous step

yum history info <ID>

Example

Update example

3. Revert

If you encounter difficulties after an upgrade and wish to revert the changes, you can use the following commands as a guide.

If you’re experiencing issues specifically related to the upgrade and want to undo those changes only, you can use the yum history undo command. This will undo the changes for a specific update transaction only.

yum history undo <ID>

If you encounter issues after the upgrade and wish to revert your system to its previous state entirely, you can use the yum history rollback command. This command will rollback the system to a specific point in time, undoing all transactions that occurred after that point.

yum history rollback <ID>
Note
These commands are provided as general guidelines and should be used with caution. It’s advisable to consult with your system administrator or seek assistance from a qualified professional before executing any system-level commands