Sign inSign up

amirsamary/developing-with-containers

By amirsamary

•Updated over 6 years ago

Image
0

242

amirsamary/developing-with-containers repository overview

⁠Best Practices with InterSystems IRIS REST Services and Container Examples

This repository holds the source code used on two of my presentations:

The first presentation was inspired on a presentation of a similar name, given by Michael Smart. Although this repository containes everything you need, Michael's original source code can be found here⁠. Thank you Michael!

The second presentation was inspired on a presentation of the same name, given by Joe Carrol. Thank you Joe! I have updated just a little bit and added some new stuff.

⁠REST API design - REST at Ease

Follow the instructions bellow to start the IRIS container with the source code.

⁠How to run this demo

To run this demo, you need Docker installed on your PC. Then you can just run:

docker run -it --name iris --init --rm -p 52773:52773 amirsamary/developing-with-containers:irisdb-version-1.8.0

⁠How to build this demo on my PC?

Ideally, you should run the ./build.sh script which will build the image locally on your PC using the current version number inside the file ./VERSION to tag it.

But you can also build it directly with the docker build command and tag it with a name of your preference:

docker build -t amirsamary/developing-with-containers:irisdb-version-1.8.0 ./image-iris

⁠How to look at the source code and change it?

The source code for the image is on folder ./image-iris. You can use Visual Studio Code to edit it. What I recommend is to:

  • Install Visual Studio Code
  • Install ObjectScript plugin
  • Start the container using the ./run.sh script or the docker run command above.
  • Open folder ./image-iris on VSCode. This folder has a subfolder called .vscode that has a settings.json file with configurations for the ObjectScript plugin to connect to the IRIS container.
  • Now you can edit the files under the src folder and save them. They will be automatically compiled into the image.

⁠Examples of REST Calls

Once the container is up and running, you will be able to use a REST Client such as Postman to test the end points bellow.

Before trying to call them:

  • Configure basic authentication with username SuperUser and password sys.
  • Make sure your Content-Type header is set to application/json
⁠Getting a list of destinations
⁠Getting a list of reservations
⁠Creating a reservation

Body:

{
    "customer": "John Smith",
    "startLocation": "South Africa",
    "destination": "Boston",
    "startDate": "2020-02-01",
    "endDate": "2020-02-10"
}

The new resource name is returned at the Location header:

Location: /csp/myapp/rest/reservations/v3/7

⁠Partial Update of a Reservation

Body:

{
    "destination": "Brazil"
}

The body can mention one or all of the propeties. Only the mentioned properties will be updated. The others, will be left with the previous value.

⁠Full Update of a Reservation

Body:

{
    "customer": "Angelo",
    "startLocation": "Rome",
    "destination": "France",
    "startDate": "2019-02-01",
    "endDate": "2019-02-10"
}

All properties of the document will be updated. Properties that are not present will be set to null. If the property is required, the transaction will return a 400 Bad Request error.

⁠Deleting a resource

⁠The Value Of Developing With Containers

This repository also contains some of the examples I used on this presentation:

  • durablerun.sh - Starts IRIS Community with Durable %SYS
  • durablerun2.sh - Starts IRIS Community with Durable %SYS and merge CPF file for configuring global buffers and routine buffers
  • durablerun3.sh - Starts IRIS Community with Durable %SYS, merge CPF and a predefined system password
  • durablerun4.sh - Starts IRIS with Durable %SYS, merge CPF, a predefined system password and a license key
  • durablerun5.sh - Starts IRIS Community with our REST application on a Durable %SYS, configured with a merge CPF and a predefined system password!

Tag summary

Content type

Image

Digest

Size

559.8 MB

Last updated

over 6 years ago

docker pull amirsamary/developing-with-containers:irisdb-version-1.8.0