Tuesday, December 12, 2017

Derby Network Server & supervisord integration

Download & Install Derby

download Derby For Java 8 and Higher, such as derby-10.14.1.0 untar derby distribution under /opt/derby [https://db.apache.org/derby/derby_downloads.html]

Integrate with supervisord

cat >> /etc/supervisord.d/derby.ini << EOF
[program:derby]
command=/opt/derby/bin/startNetworkServer -h 0.0.0.0 ; the program (relative uses PATH, can take args)
process_name=%(program_name)s  ; process_name expr (default %(program_name)s)
numprocs=1                     ; number of processes copies to start (def 1)
directory=/opt/derby           ; directory to cwd to before exec (def no cwd)
priority=1                     ; the relative start priority (default 999)
startsecs=10                    ; number of secs prog must stay running (def. 1)
user=spark                     ; setuid to this UNIX account to run the program
redirect_stderr=true          ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/%(program_name)s-stdout.log        ; stdout log path, NONE for none; default AUTO
EOF
supervisorctl reread
supervisorctl update

Friday, December 8, 2017

Konga Installation

Konga

Installation

Install npm and node.js.

sudo yum install nodejs npm

Install bowergulp and sails packages.

npm install bower gulp sails -g
npm run bower-deps
mkdir -p /opt/konga
cd /opt
git clone https://github.com/pantsel/konga.git
cd konga
npm install
cd config
cp -p local_example.js local.js

if Kong is running on a remote server and/or different default port, the following needs to be changed in local.js

kong_admin_url : process.env.KONG_ADMIN_URL || 'http://127.0.0.1:8001'
To test Kong admin URL is up running and accessible: curl http://127.0.0.1:8001

Running Konga

Development

cd /opt/konga
nohup npm start &
Konga GUI will be available at http://hostname:1338

Production

cd /opt/konga
nohup npm run production &
Konga GUI will be available at http://hostname:1338

Kong Installation

The following instruction is for CentOS7 only

Install Kong

rpm -ivh https://bintray.com/kong/kong-community-edition-rpm/download_file?file_path=dists/kong-community-edition-0.11.1.el7.noarch.rpm
yum install epel-release
yum install kong-community-edition

Install & prepare Database

Kong needs a database and supports both PostgreSQL 9.4+ and Cassandra 3.x.x as its datastore. In our POC we have tested it with Postgres 9.6
yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm
yum install postgresql96-server.x86_64
yum install postgresql96
/usr/pgsql-9.6/bin/postgresql96-setup initdb
systemctl enable postgresql-9.6
systemctl start postgresql-9.6

su - postgres
psql
CREATE USER kong; CREATE DATABASE kong OWNER kong;
Now, run the Kong migrations:
sudo kong migrations up [-c /path/to/kong.conf]

Run Kong on port 80 for HTTP

Edit /etc/kong/kong.conf Change: proxy_listen = 0.0.0.0:8000 To: proxy_listen = 0.0.0.0:80
sed -i "s/proxy_listen = 0.0.0.0:8000/proxy_listen = 0.0.0.0:80/" /etc/kong/kong.conf

Start Kong

kong start

Increase nofile

Default file descriptor in CentOS7 is set to 1024, to increase this value for more connections to Kong:
cat >>  etc/security/limits.conf < EOF
*       soft    nofile  32767
*       hard    nofile  32767
EOF