Giter Site home page Giter Site logo

icebreak-samples's Introduction

IceBreak-Samples

RPG samples using noxDB, Microservices, ExtJs and Watson

IceBreak is a powerful Web application server that provides a highly reliable, manageable, and scalable Web application infrastructure for the IBM i™. IceBreak runs natively on IBM i™ in the ILE environment - NOT using Apache, WebSphere, node.js or any other moving parts.

Install IceBreak

First you need the IceBreak server for RPG / ILE. You can download the latest stable community edition from the official site:

http://www.system-method.com/en/page/download-icebreakce

Or you can find the bleeding edge versions here:

http://download.icebreak.org/webfiles/download/icebreak/

You need FTP open on your IBM and the install script runs only from Windows.

Install the samples

Before you can clone this git repo - you first need to have git on your IBMi:

  1. Open ACS and click on "Tools"
  2. Click on "Open Source Package Management"
  3. Open the "Available packages" tab
  4. Click "git" and "Install"

You need to ensure that the ssh deamon is running on your IBM i. So from a IBM i menu prompt start the SSH deamon:

===> STRTCPSVR *SSHD

Now back to your ACS:

  1. Click SSH Terminal in ACS ( or use your default terminal like putty)

(or you can use call qp2term – but I suggest that you get use to ssh)

  1. From the terminal. You can also install git with yum from the commandline if you don't like the above:
ssh myibmi
PATH=/QOpenSys/pkgs/bin:$PATH
yum install git

And now in the same ssh session - clone the samples repo

cd /www
git -c http.sslVerify=false clone https://github.com/NielsLiisberg/IceBreak-Samples.git

As you can see - you have to ajust your path to use yum, git and other opens source tooling

Go back to a 5250 prompt

GO ICEBREAK 
CALL QCMD
ADDICESVR SVRID(SAMPLES) TEXT('IceBreak samples') 
    SVRPORT(60060) HTTPPATH('/www/icebreak-samples') 
    WWWDFTDOC('default.html')          
STRICESVR SAMPLES
WRKICESBS 

You will see the samples server running in the IceBreak subsystem. Now we need to compile some of the samples ( still in the 5250 with ICEBREAK on the library list):

CRTICEPGM STMF('/www/IceBreak-Samples/router.rpgle') SVRID(samples)
CRTICEPGM STMF('/www/IceBreak-Samples/msProduct.rpgle') SVRID(samples)

Run the first sample

Now it is time to test the sample:

  1. Open your browser
  2. In the URL type http://MyIbmi:60060 ( Where myibmi is the TCP/IP address or name of your IBiMi)

Now you have a RPG services running with an MVVM application in ExtJS as you frontend.

Using vsCode as you IDE

The Sitemule team has made a cool plugin for vsCode so you can edit and compile RPG code.

In your browser open, download and install both vsCode and node.js

https://code.visualstudio.com/download

https://nodejs.org/en/

When you open vsCode then:

Open "Extensions" and search for "RPG". Click on "RPG for IBMi" and you have installed what you need.

If you now map a networkdrive to the /www/IceBreak-samples folder and "drag" that into the vsCode editor - it will open it as workspace (a project) and now the Icebreak compiler is available.

When you click and open a file with RPGLE or SQLRPGLE extension then you can press "Shift-Cmd-B" for build of find the build task in the menu.

Microservices

In the samples above is as close as you can get with RPG to the Microservice architecture. It is build around a "router" program and a "JSON in/JSON out" service program. This design pattern hides the HTTP protocol so it can be used in stored procedures, data queues and even called directly from other RPG programs. This allows you to make unit test and let your RPG applications work better in a DevOps environment.

The "router" program is always called if the URL begins with "router". It is a regex set in the webconfig.xml. The router parses the URL, parse the input JSON and call the required service. Finally the router serializes the object graph into JSON for the HTTP client.

Take a look at "router.rpgle" and "msProduct.rpgle" - they carry the whole secret!

Consuming Services

Take a look at msXlate.rpgle .This service is sending the request to Watson. Under the covers it uses cUrl so you have to installe that first:

From the ssh / shell prompt:

PATH=/QOpenSys/pkgs/bin:$PATH
yum install curl

Before you run the Watson example you have to set up two things:

  1. Get a application key from IBM / Watson:

https://cloud.ibm.com/docs/iam?topic=iam-manapikey

  1. Set the PATH environment for you job to include the opensource tooling - like:

System wide once:

ADDENVVAR 
    ENVVAR(PATH) 
    VALUE('/QOpenSys/pkgs/bin:/QOpenSys/usr/bin:/usr/ccs/bin:/QOpenSys/usr/bin/X11:/usr/sbin:.:/usr/bin')
    LEVEL(*SYS)                                                   

Or within the job PATH=/QOpenSys/pkgs/bin:$PATH

Have fun - and keep me posted :)

icebreak-samples's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.