Getting started with akera.io – Part two

In akera.io, node.js, Progress by Marian Edu

application server

akera.io server is a full blown application server for Progress OpenEdge specifically designed for web/mobile applications.

Because of the efficient non-blocking I/O provided by node.js together with the myriad of modules available in npm ecosystem writing an application server to easily expose business services (REST) for web/mobile applications in node.js makes a lot of sense.

The result is a modular and very lightweight solution that is both easy to start with and can also scale as needed.

Being an application server for Progress OpenEdge, akera.io does require the Progress runtime (AVM) to be available – either part of the RDBMS product if ran on the same computer as the database server or ‘Client Networking’ product if network connection is used.

4GL Development product is not required as 4GL components are delivered in xcode format, the optional ‘Development Studio’ component does require the option to compile code and therefore will have limited functionality without it.
akera.io is built on node.js therefore the first thing that need to be done is to install node.js on your system if not available already.

Head over to the node.js download page and select the installer for your platform.

Because of the Progress runtime dependency any platform supported by Progress can be used, for the rest the only option is to run it in a Docker environment (Linux).
After all prerequisites were installed we can proceed with the installation.

Since the de-facto package manager for node.js is npm all akera.io components are built as packages – the public ones available directly on npmjs.com while for the rest we have our own private repository.

// set the npm registry to our private repository
$ npm set registry http://repository.akera.io
// avoid installing dev dependencies
$ npm config set production
// install using global flag
$ npm install -g akera-server

This would take some time – about 30 seconds (depending on the internet speed) and make sure the system have enough space left before starting the installation as it does require nothing less than 9 MB to be available (if need be, please be prepared to drop 2-3 of your favourite mp3 songs to make room for it).

Test the installation by running the control script in a terminal.

$ akera-server help
Akera application server version: 1.2.13
Broker control script, usage:
akera-server <start|stop|status|trim|list> [-h ]
start – start all brokers set-up in home folder
stop – stop all brokers set-up in home folder
status – show status for all brokers set-up in home folder
trim – trim agents of all brokers set-up in home folder
list – list all brokers set-up in home folder
akera-server <start|stop|status|trim|new|config|delete> [-h ] [-i]
start – start the broker
stop – stop the broker
status – show status for the broker
trim – trim agents for the broker
new – create new configuration for the broker
config – edit configuration for the broker
delete – remove configuration for the broker
-i interactive if set the process remains in foreground, only valid for start
Now that you have everything installed you can set-up your first application server instance using the configuration option of the control script but first few things about akera.io configuration:

  • there is no single ‘unified’ broker configuration file, akera.io uses one configuration file per broker
  • configuration file uses a simple JSON format
  • is recommended to use a ‘configuration folder’ to group them in one central place
  • unless specified otherwise the control script will use the user’s configuration folder as default – $HOME/.akera

The easiest way to create a new application server configuration file – sports – is to use the control script with the new command:

$ akera-server -h /opt/apps/akera new sports
? Progress installation directory /usr/dlc
? Port that the server will listen on 8900
? Initial number of agents 5
? Minimum number of agents 2
? Maximum number of agents 10
? Agent PROPATH (comma separated). /opt/apps/sports
? Agent accessible path (PROPATH relative entries, comma separated) web,rest
? Agent working folder /tmp
? Agent session temporary folder /tmp
? Agent start-up parameter file
? Procedure to run at startup
? Enable development studio (not in production). No
? Expose database content as REST No
? Expose WEBPATH file-system content as REST No
? Keep persistent procedures between requests Yes
? Messages language en
? Log File akera-server.log
? Maximum log file size(kb) 50000
? Maximum log files 3
? Log level info
? Execution timeout 3000
? Require SSL connection from clients No
? Administrator password
? Message packet size 64


Most of those are pretty much self explanatory and somehow familiar to those experienced with Progress Application Server.

The only one thing that might look odd is the ‘accessible path‘ – although it’s possible to run any business logic procedure available on PROPATH we think it’s safer to just limit client access to only those ‘services’ that were meant to be exposed instead of just everything available in PROPATH. In this example we only allow execution of procedures from ‘web‘ and ‘rest‘ sub-folders – in any of the PROPATH entries.

Database connection(s) can be specified in the start-up parameter file (.pf) if so desired just we like more to have them set in a separate configuration section – the control script will ask for this at the end, you can add as many database connections as needed (shared memory or network connection).
? Databases New
? Database logical name sports
? Database physical name/path /opt/db/sports.db
? Network connection No
? Databases (Use arrow keys)
❯ New
Config
Delete
List
Done

When you’re done adding all database connections select ‘Done’ and you’ll be prompted to save the configuration.

? Databases Done
? Save changes Yes

To update the configuration later on you can either do that directly on the JSON file if you are a vi freak or start the control script with the ‘config‘ option and follow the same flow just with the current configuration values used as presets – if you don’t want to update a property just hit enter and previous value will be kept.

$ akera-server -h /opt/apps/akera config sports
Now you’ve passed the most boring part you can go ahead and start the application server instance you’ve just configured, again use the control script for that just with the start option (yeah we know, all too original).

akera-server -h /opt/apps/akera sports start
info> Starting broker: sports…
warn> Broker admin password not set.
info> AGT[9134] Agent started(34533) [201]
info> AGT[9135] Agent started(52577) [201]
info> AGT[9136] Agent started(35380) [201]
info> Broker listening on port 8900 [9125].

There is also an ‘interactive’ (-i) option for the start command, this will keep the process in the foreground and also display log messages on the console – can be used if you want to deploy it in a docker environment (more about this later on).

$ akera-server -h /opt/apps/akera sports start -i
Starting broker: sports…
Broker admin password not set.
AGT[9115] Agent started(52355) [201]
AGT[9116] Agent started(44206) [201]
AGT[9117] Agent started(37419) [201]
Broker listening on port 8900 [9106].

This can be used for debug purposes – setting a different log level for the console can be done right after the ‘-i’ switch.


$ akera-server -h /opt/apps/akera sports start -i debug
Starting broker: sports…
Broker admin password not set.
Create a non-secure server socket.
Create a secure server socket.
Secure server socket using PFX
Admin server listening on port 56647.
Starting agent.
Create a non-secure server socket.
Agent listening for Progress connection on [44560].
AGT[9162] Progress agent running: 9162.
AGT[9162] Progress agent connected.
Once we have our application server instance up and running you might well need to check-out what is doing or bring it back to order if needed.

status

$ akera-server -h /opt/apps/akera sports status
Running for : 14:01:42
Load : 0%
Free : 5
Busy : 0
Requests : 8247
Completed : 8247
Memory : 78289408

trim agents

$ akera-server -h /opt/apps/akera sports trim
Trim agents for broker: sports…
Trim agents successfully.

shutdown

$ akera-server -h /opt/apps/akera sports stop
Shutting down broker: sports…
Broker shutdown successfully.

Share this Post