Question on upgrading


#1

Hello there.

I need your guidance on how to upgrade Kong from v0.10.1 to latest version (currently it is on v0.14.1). I need to do the steps on testing server before deploying it to production server. I can’t install v0.10.1, v0.10.4, v0.11.1, v0.11.2, v0.12.0, v0.12.1, v0.12.2 and v0.12.3. I settle down on version v0.13.0.

What I have done to the testing server is installing Kong v0.13.0 and add some data to Cassandra. I am now stuck on how to upgrade it. Here is the steps that I have done:

  1. Create a Docker network.
    docker network create kong-net
  2. Start database using Cassandra container.
    docker run -d --name kong-database --network=kong-net -p 9042:9042 cassandra:latest
  3. Prepare database.
    docker run --rm --network=kong-net -e "KONG_DATABASE=cassandra" -e "KONG_PG_HOST=kong-database" -e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" -e "KONG_DB_UPDATE_PROPAGATION=5" kong:0.13.0 kong migrations up
  4. Start Kong.
    docker run -d --name kong --network=kong-net -e "KONG_DATABASE=cassandra" -e "KONG_PG_HOST=kong-database" -e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" -e "KONG_PROXY_ACCESS_LOG=/dev/stdout" -e "KONG_ADMIN_ACCESS_LOG=/dev/stdout" -e "KONG_PROXY_ERROR_LOG=/dev/stderr" -e "KONG_ADMIN_ERROR_LOG=/dev/stderr" -e "KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl" -p 8000:8000 -p 8443:8443 -p 8001:8001 -p 8444:8444 kong:0.13.0
  5. Use Kong.
    curl -i http://localhost:8001/
  6. Log in kong-database
    docker exec -it kong-database cqlsh
  7. Create a keyspace.
    create keyspace testkeyspace with replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
  8. Use keyspace.
    use testkeyspace;
  9. Create table.
    create table testtable (id varchar primary key);
  10. Insert data.
    insert into testtable (id) values ('testdata');
  11. Show data.
    select * from testtable;
  12. Quit cqlsh and log in to Kong.
    docker exec -it kong sh
  13. Run migration.
    kong migrations up [-c /etc/kong/kong.conf.default]
  14. Reload Kong.
    kong reload [-c /etc/kong/kong.conf.default]
  15. Check Kong version.
    kong version

End result: Kong still in v0.13.0. I have no idea how to proceed.

Question:

  1. For some reason I cannot use Bash, and I could only use sh. Can anyone explain that to me?
  2. How to upgrade from v0.13.0 to v0.14.1?
  3. Can I upgrade directly from v0.10.1 to latest version, or do I need to upgrade from one version to another until it reaches v0.14.1?
  4. Do the steps of upgrade similar for v0.13.0 to v0.14.1 versus v0.10.1 to v0.14.1?
  5. Production server’s version of Cassandra is 2.2.9. Does Kong upgrade path upgrades Cassandra version too? If not, what do I need to do to upgrade it?
  6. Would there of be anything that I should take note when running the upgrade?

Thank you and have a nice day.


#2

Can’t spend a lot of time going into tons of detail because you are a good many versions behind but I will do my best.

First and foremost read over this update path doc. It outlines every change from major version to major version you you understand the logic and behavior that has changed, it also gives great detail and insight to the changes you may have to make to your custom templates or plugins if you have any:

Now onto the questions I can answer.

  1. https://github.com/Kong/kong/blob/master/UPGRADE.md#upgrade-to-014x

  2. I would not recommend attempting that. I would upgrade version to version personally.

  3. My answer to 4 is yes, generally the upgrade steps at a mile high level are this for me:
    a. Existing Kong should be running with cache “warm” so it already has all vital resources stored in case the
    db does not play nice with the running
    b. Run kong migrations command on existing DB with newer version of Kong on your DB
    c. Swap out the running older version of Kong for newer version of Kong on your environment. Depending
    on how you deploy Kong(we use OpenShift Cloud platform which makes it crazy easy (dockerized) your
    results and ability to do this smoothly may vary.

  4. Kong will not upgrade your C* for you, luckily 2.2 is still considered a supported version :slight_smile: . To upgrade C* I have not done so personally buy a quick google yeilds a pretty good result: https://stackoverflow.com/questions/44024170/upgrading-cassandra-without-losing-the-current-data

  5. Yes, changes to the template files if you use custom templates. Like I mentioned at the beginning read the upgrade path documentation a few times before attempting to tackle an upgrade, worst thing you could do is rush through it and manage to break a Kong cluster in production without a good backout plan because I was not prepared haha, that would be my worst nightmare :smiley: .


#3

My friend, I have followed the instructions from the link before I posted the question here. But still, I could not figured it out.


#4

The reason you can’t run bash in the Kong docker container is because our docker images are based on alpine which doesn’t include bash

You’re running the kong:0.13.0 docker container. If you wish to run the 0.14.1 you need to run a new docker container.