Skip to content

codesenju/IMDB_lite

Repository files navigation

Diagram

Part 1 - Prerequisites

  • 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

try

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 &


Part 2 – IBM db2 Database Container

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.

imdb_lite_dir

  • 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:

docker_images

  • Create a container network that will be used by your two micro services.
docker network create mynet
  • Run your db2 image as a container.

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:

dockerps_imdblite

  • Now we going to login into the db2 container and configure the database schema.

docker exec -ti <CONTAINER-ID> bash -c "su - db2inst1"
cd /var/custom
./createschema.sh


  • When you're done exit the container with exit.

Part 3 – Node.js App Container

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


Part 4 - Test your environment

  • 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


<vm-ip>:49160/ # replace <vm-ip> with your LinuxOne machine IP address.
<vm-ip>:49160/api/all



About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published