-
Register at LinuxOne Community Cloud here for a trial account and get a RHEL VM.
-
Click on Try Virtual Machines on the LinuxONE™ Community Cloud
-
Install docker:
sudo su
cd ~
yum -y install wget
wget ftp://ftp.unicamp.br/pub/linuxpatch/s390x/redhat/rhel7.3/docker-17.05.0-ce-rhel7.3-20170523.tar.gz
tar -xzvf docker-17.05.0-ce-rhel7.3-20170523.tar.gz
cp docker-17.05.0-ce-rhel7.3-20170523/docker* /usr/bin/
docker daemon -g /local/docker/lib &
git clone https://github.com/codesenju/imdb_lite.git
cd imdb_lite
- Download data.tar.gz file here which has the records for the movie database.
- Copy the data.tar.gz into your folder /imdb_lite.
- Run the command
ls -alh
to view directory contents and if your directory looks similar to the image bellow you can move on to the next step to build your db2 image.
rm -rf images/ #first lets remove unnecessary files
docker build -t codesenju/imdb_lite .
- After successful build, run the command
docker images
to see your image loaded into docker. On completion, you should see the following output on console:
- Create a container network that will be used by your two micro services.
docker network create mynet
docker run -itd --net mynet --name micro_db2 --privileged=true -p 50000:50000 -e LICENSE=accept -e DB2INST1_PASSWORD=db2admin -e DBNAME= -v /usr/src/app:/database codesenju/imdb_lite
- After successfully executing the last command you can check if you have a container instance of db2 running by executing the following command:
docker ps
- You should see the following output on console:
docker exec -ti <CONTAINER-ID> bash -c "su - db2inst1"
cd /var/custom
./createschema.sh
- When you're done exit the container with
exit
.
cd ~
git clone https://github.com/codesenju/nodejs_api4db2.git
cd nodejs_api4db2
docker build -t codesenju/nodejs_api4db2 .
docker run --net mynet -p 49160:8081 -d codesenju/nodejs_api4db2
- Test within the LinuxOne machine using cURL:
curl localhost:49160
curl localhost:49160/api/all
- Test from any browser by entering the following url:
<vm-ip>:49160/ # replace <vm-ip> with your LinuxOne machine IP address.
<vm-ip>:49160/api/all
- Test with Postman:
<vm-ip>:49160/ # replace <vm-ip> with your LinuxOne machine IP address.
<vm-ip>:49160/api/all