My goal with this small project was to gather and put together several pieces and build quickly a full ECP architecture where we could test our applications.
By default, once you install it, it'll launch:
- 1 ECP Data Server
- 3 ECP APP Servers connected to the ECP Data Server
- 1 Load Balancer (WebGateway configured as such) pointing at the ECP APP Servers.
As part of the installation, each ECP APP Server will start with the following functionalities already installed(*):
- ZPM
- WebTerminal
- Restforms2
- Restforms2-ui
- OPNEx-MModel
(*) Except for OPNEx-MModel, you can find these apps in Open Exchange
OPNEx-MModel could be your own app. It's just a small sample for this project, to demonstrate IRIS features related to Multi-Model. It contains the following classes:
Class | Description |
---|---|
OPNEx.MModel.Proveedor | %Persistent class with some methods to Register, Update records,... |
OPNEx.MModel.Direccion | %SerialObject class |
OPNEx.MModel.IOglobals | Utilities to access/record Proveedor data directly from/to the associated global. Massive data generator. |
OPNEx.MModel.Util | Implements Limpia() method to kill the extent |
OPNEx.MModel.RESTserver | REST Microservices to execute CRUD operations on Proveedor |
-
Clone or download this repository
-
IMPORTANT: Copy your own iris.key in ./build/ECP_iris.key. You will need a key that supports ECP. If you don't have it you can get if from Evaluation or Preview sections in WRC (Be aware that ECP it's not supported by IRIS Community Editions).
-
Build the server and client images (you will need access to containers.intersystems.com)
docker-compose build
-
Deploy the architecture
docker-compose up
-
Open your postman and import the collection:
MModelCollection.json
- If you don't want to use Postman, these are the URLs for the REST services:
Desc Method URL Search Proveedor by ID GET Sample Link Register new Proveedor (data in param) PUT Sample Link Register new Proveedor (data in body request) POST Sample Link Delete a Proveedor by ID DELETE Sample Link Update a Proveedor (data in body request) PATCH Sample Link Generates Records GET Sample Link Count Proveedores GET Sample Link Echo Test GET Sample Link
-
Connect to the Loadbalancer and test that all connections with ECP clients are working (see that loadbalancer is listening in port 20080)
http://localhost:20080/csp/bin/Systems/Module.cxw
- Enter with CSPsystem/SYS
- Check connections in Test Server Connection option
- Take a look at Application Access and see the call sequence to ECP client servers
-
Try to log to SMP through the LoadBalancer:
http://localhost:20080/csp/sys/UtilHome.csp
You should have currently entered in the SMP of one of the ECP clients servers, likely the first one in the round-robin queue configured in the load-balancer.
-
Check RestForms-UI:
http://localhost:20080/restforms2-ui/index.html
You should see the login page to your Restforms-ui app. Login as superuser you'll see all the Forms you have access to. There it's one for Proveedor class (included in this small sample) plus others that Restforms2 installs by default as an example.
-
Check Webterminal:
http:localhost:52773/terminal/
As you can see, I'm not using the load-balancer port 20080. WebTerminal needs to connect directly to the IRIS instance you want to work with, so you would need to put there the port randomly assigned by docker to your instance.
-
Check the REST services for OPNEx-MModel sample, with Postman or making use of URLs provided above
- For example, try to generate records of new Proveedores and then get one of them by ID.
- If you test Echo Test service, you will see that the request is served each time by a different APP server
If you want to add a new APP Server:
- Edit
docker-compose.yml
file and just Copy & Paste the declaration of one of the client services, for example "client3", and change service, host and container names appropiately. - Execute
docker-compose up -d client4
from your shell to launch the new ECP APP Client. - Go to LoadBalancer/WebGateway portal to add the new AppServer
- If you want to make this change permanent in your project, you should include that APP Server in
CSP.ini
file in .\webgatewayconfig\ folder (look at the content, the changes to do are pretty straightforward).
If you didn't find any issue following the checks above, Congratulations! Your environment is ready!
Now, you can use it to demo and to develop your APP or Sample over an ECP architecture, counting with latest versions of ZPM, WebTerminal, Restforms2, Restforms2-ui. And everything "out-of-the-box".
Happy Coding!
To get this project done I've made use of several other contributions from our Community/OpenExchange, so thanks to Nikita Savchenko for developing so great app like WebTerminal, Henry Hamon Pereira who develop Restforms2 framework and Anton Gnibeda who gave Restforms2 a beautiful face, Evgeny Shvarov for building ZPM that makes thinks so easy. Specially BIG THANKS to Robert Cemper from who I borrowed IRIS-easy-ECP-workbench as a starting point, and Pierre-Yves Duquesnoy who helped me contribuiting to this project with a simple LoadBalancer configuration based on our WebGateway