How to update Kong when it was installed from AWS Marketplace?


#1

What is the best way to update Kong instance when I’ve used the AWS Marketplace ClickOnce flow?

in the Suggested Upgrade Path specifies that I should:

…acquire the latest version from any of the available installation methods and proceed to install it…

and that made me wonder … :slight_smile:

Can we simply install git, add a remote and checkout the tag, will that work ?
if yes, what directory should we do this?
if no… how to do it?


#2

Yes, you can install from source, please follow the guide here

or you can install from RPM repo https://bintray.com/kong/kong-community-edition-aws


#3

tl;dr;

to upgrade Kong to a newer version in an AWS AMI Marketplace instalation:

ssh -i your_access.pem ec2-user@ec2-XXX-XXX-XXX-XXX.area.compute.amazonaws.com
cd /usr/local
sudo bin/luarocks install kong <kong-version-to-install>
kong migrations up -v

to check kong package availability in luarocks

luarocks search kong

or see this page


original reply

I’m not a linux user, in fact, I never liked to “learn” all command lines, and the issue that a misspell comma can bring a server down makes me shake every time I load bash :frowning: soplease bear with me

I’ve found that the instalation directory is /usr/local/kong

[ec2-user@ip-172-31-3-235 kong]$ ls -l
total 44
drwx------ 2 ec2-user ec2-user 4096 Mar 12 13:15 client_body_temp
drwx------ 2 ec2-user ec2-user 4096 Mar 12 13:15 fastcgi_temp
drwxr-xr-x 2 ec2-user ec2-user 4096 Mar 12 13:15 logs
-rw-r--r-- 1 ec2-user ec2-user  221 Mar 13 09:26 nginx.conf
-rw-r--r-- 1 ec2-user ec2-user 4642 Mar 13 09:26 nginx-kong.conf
drwxr-xr-x 2 ec2-user ec2-user 4096 Mar 12 13:15 pids
drwx------ 2 ec2-user ec2-user 4096 Mar 12 13:15 proxy_temp
drwx------ 2 ec2-user ec2-user 4096 Mar 12 13:15 scgi_temp
drwxr-xr-x 2 ec2-user ec2-user 4096 Mar 12 13:15 ssl
drwx------ 2 ec2-user ec2-user 4096 Mar 12 13:15 uwsgi_temp

but it must be a compiled kong right?

I also tried to see if any new package was available as you suggest but

[ec2-user@ip-172-31-3-235 kong]$ sudo yum list kong-community*
Loaded plugins: priorities, update-motd, upgrade-helper
Installed Packages
kong-community-edition.noarch                                       0.12.2-1                                           @bintray--kong-kong-community-edition-aws
Available Packages
kong-community-edition.noarch                                       0.13.0rc2-1                                        bintray--kong-kong-community-edition-aws

[ec2-user@ip-172-31-3-235 kong]$ sudo yum install kong-community-edition-0.12.3.aws.rpm --nogpgcheck
Loaded plugins: priorities, update-motd, upgrade-helper
No package kong-community-edition-0.12.3.aws.rpm available.
Error: Nothing to do

from this, I’m assuming the only package available is the 0.13.0rc2-1 and I can’t upgrade to 0.12.3 using this method

so I would love to give the git suggestion a try, but I just need to know somethings first prior to “screw things up” :smile:

from this

[ec2-user@ip-172-31-3-235 local]$ pwd
/usr/local

[ec2-user@ip-172-31-3-235 local]$ ls -l
total 48
drwxr-xr-x  2 root     root 4096 Feb 28 22:29 bin
drwxr-xr-x  3 root     root 4096 Feb 28 22:29 etc
drwxr-xr-x  2 root     root 4096 Jan  6  2012 games
drwxr-xr-x  2 root     root 4096 Jan  6  2012 include
drwxr-xr-x 10 ec2-user root 4096 Mar 13 10:26 kong
drwxr-xr-x  5 root     root 4096 Feb 28 22:29 lib
drwxr-xr-x  4 root     root 4096 Jun 23  2017 lib64
drwxr-xr-x  2 root     root 4096 Jan  6  2012 libexec
drwxr-xr-x  8 root     root 4096 Feb 28 22:29 openresty
drwxr-xr-x  2 root     root 4096 Jan  6  2012 sbin
drwxr-xr-x  7 root     root 4096 Feb 28 22:29 share
drwxr-xr-x  2 root     root 4096 Jan  6  2012 src

I thought in to create a directory and clone the git tag into it… then follow up the steps to compile, configure but I was struggling where should I do this…

Then I realize, that I already had everything pre-installed so why not just update from luarocks?

but another wall:

[ec2-user@ip-172-31-3-235 local]$ luarocks install kong 0.12.3-0

Error: Your user does not have write permissions in /usr/local/lib/luarocks/rocks
-- you may want to run as a privileged user or use your local tree with --local.

[ec2-user@ip-172-31-3-235 local]$ sudo luarocks install kong 0.12.3-0
sudo: luarocks: command not found

should I do this in /usr/local or /usr/local/kong ? or no matter where it will install/update the correct path?

but I didn’t give up… and screw up the entire system :hushed:

nahh, just kidding… so I tried to see where luarocks command come from with

[ec2-user@ip-172-31-3-235 local]$ which luarocks
/usr/local/bin/luarocks

and run the command:

[ec2-user@ip-172-31-3-235 local]$ sudo /usr/local/bin/luarocks install kong 0.12.3-0
Installing https://luarocks.org/kong-0.12.3-0.rockspec

Error: 'git' program not found. Make sure Git is installed and is available in your PATH (or you may want to edit the 'variables.GIT' value in file '/usr/local/etc/luarocks/config-5.1.lua')

err… forgot all about it … fixed with sudo yum install git

and tried again

[ec2-user@ip-172-31-3-235 k-tmp]$ sudo /usr/local/bin/luarocks install kong 0.12.3-0
Installing https://luarocks.org/kong-0.12.3-0.rockspec
Cloning into 'kong'...
remote: Counting objects: 496, done.
remote: Compressing objects: 100% (461/461), done.
remote: Total 496 (delta 76), reused 174 (delta 19), pack-reused 0
Receiving objects: 100% (496/496), 513.24 KiB | 4.71 MiB/s, done.
Resolving deltas: 100% (76/76), done.
Note: checking out 'cf910ab571010b9af58337a9566e5535e7dd7ecc'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

kong 0.12.3-0 is now installed in /usr/local (license: MIT)

Checking stability of dependencies in the absence of
kong 0.12.2-0...

Removing kong 0.12.2-0...
Removal successful.

a simple check:

[ec2-user@ip-172-31-3-235 k-tmp]$ kong version
0.12.3

and I was thrilled !

from the docks, migrations needed to run so I also did it, but kept saying couldn’t access postgress … err, I’m using casandra. Time to create a config file with sudo cp /etc/kong/kong.conf.default /etc/kong.config and simply changed in the DATASTORE area

#database = postgres

to

database = cassandra

then:

[ec2-user@ip-172-31-3-235 kong]$ kong migrations up  -v
2018/03/15 10:07:25 [verbose] Kong: 0.12.3
2018/03/15 10:07:25 [verbose] reading config file at kong.conf
2018/03/15 10:07:25 [warn] You are using Cassandra but your 'db_update_propagation' setting is set to '0' (default). Due to the distributed nature of Cassandra, you should increase this value.
2018/03/15 10:07:25 [verbose] prefix in use: /usr/local/kong
2018/03/15 10:07:25 [verbose] running datastore migrations
2018/03/15 10:07:25 [verbose] migrations up to date

serves this reply for anyone like me, struggling upgrading Kong on a Linux AMI.


Client's IP address in AWS Lambda