Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Deploy NodeJS and Python3 Applications on an Oracle Cloud Compute Instance

DZone's Guide to

Deploy NodeJS and Python3 Applications on an Oracle Cloud Compute Instance

Learn how to deploy DinoDate to an Oracle Cloud Compute instance. DinoDate has both Python and NodeJS mid-tier apps and is backed by an Oracle Database.

· Database Zone ·
Free Resource

Compliant Database DevOps and the role of DevSecOps DevOps is becoming the new normal in application development, and DevSecOps is now entering the picture. By balancing the desire to release code faster with the need for the same code to be secure, it addresses increasing demands for data privacy. But what about the database? How can databases be included in both DevOps and DevSecOps? What additional measures should be considered to achieve truly compliant database DevOps? This whitepaper provides a valuable insight. Get the whitepaper

DinoDate currently has both Python and NodeJS mid-tier applications and is backed by an Oracle Database.

The following instructions show how to deploy DinoDate to an Oracle Cloud Compute instance. However, if you just need to deploy a NodeJS or Python application, the same instructions should help you install Node and/or Python 3.

If you don’t have access to an Oracle Database, you can try the Oracle Cloud for free.

Database

Download/Clone DinoDate to get the database scripts you’ll need.

Connect to your database as sys with sysdba and run coreDatabase/dd_master_install.sql. (Use your password and connect string.)

Using SQLcl Shell:

sql sys/YourPassword@YourJdbcConnecString as sysdba @coreDatabase/dd_master_install.sql

Compute

Download and scp the following to your new compute instance. (Current versions as of the time of this post.)

Open an SSH connection to your compute instance. (Use your SSH key and the public IP address for your compute instance.)

ssh -i ~/.ssh/yourKey opc@publicIPforYourCompute
  • Switch tosu.
  • Update your instance.
  • Install some tools we’ll need.
sudo su
yum update -y
yum install -y gcc-c++ make git

Install both Oracle Instant Client files:

yum install -y oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm
yum install -y oracle-instantclient12.2-devel-12.2.0.1.0-1.x86_64.rpm

Install NodeJS 8:

curl -sL https://rpm.nodesource.com/setup_8.x | bash -
yum install -y nodejs
npm install -g pm2 bower
  • Install some tools we'll need.
  • Enable the config manager
  • Install Python 3.5
  • Enable Python 3.5
  • Upgrade pip.
  • Install the Python modules for DinoDate:
    • cx_Oracle
    • bottle
  • Exit scl bash:
yum install -y yum-utils
yum-config-manager --enable ol7_software_collections
yum install -y scl-utils rh-python35 --skip-broken
scl enable rh-python35 bash
pip install --upgrade pip
python -m pip install cx_Oracle bottle --upgrade
exit

Exit su:

exit

Add the following to your .bash_profile:

  • Create the environment variables for DinoDate (use the JDBC connect string for your database)
  • Enable Python 3.5.
echo "
export dd_connectString=YourJdbcConnecString
export dd_user=dd
export dd_password=dd
export dd_port=8888
export dd_python_port=8088
export dd_node_port=3000
export dd_clientAppCodeDir=jet
export dd_python_clientAppCodeDir=jet
export dd_node_clientAppCodeDir=jet
export LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client64/lib/:$LD_LIBRARY_PATH
scl enable rh-python35 bash" >> ~/.bash_profile

Re-run .bash_profile:

source ~/.bash_profile
  • Clone DinoDate to your Compute instance.
  • Extract the Oracle JET files.
  • Run bower install
git clone https://github.com/OsBlaineOra/dino-date.git
unzip ~/oraclejet.zip -d ~/dino-date/commonClient/jet/

cd ~/dino-date/commonClient/jet/
bower install
  • Install the NodeJS modules.
  • Use pm2 to start the NodeJS version of DinoDate. The --watch parameter will restart the application if the files change.
cd ~/dino-date/nodejs/
npm install
pm2 start server.js --watch
  • (We already installed the Python modules above.)
  • Use pm2 to start the NodeJS version of DinoDate. The --watch parameter will restart the application if the files change.
cd ~/dino-date/python
pm2 start app.py --watch

pm2 startup will generate the command needed to restart our applications on boot. The following will extract and execute the command from the generated text.

$(pm2 startup | grep sudo)

Try It Out

Open a browser and pull up DinoDate:

  • NodeJS
    • http://YourComputePublicIP:3000
  • Python
    • http://YourComputePublicIP:8088

You can log in with any of the existing users, such as:

  • Bobbob@example.com
  • Adminadmin@example.com

Use any value for the password, the application doesn’t check it.

Click on the Search tab and search for "eat" — it should return six of the pre-loaded dinosaurs.

If you run into any trouble, leave a comment and I’ll be happy to help.

Compliant Database DevOps and the role of DevSecOps DevOps is becoming the new normal in application development, and DevSecOps is now entering the picture. By balancing the desire to release code faster with the need for the same code to be secure, it addresses increasing demands for data privacy. But what about the database? How can databases be included in both DevOps and DevSecOps? What additional measures should be considered to achieve truly compliant database DevOps? This whitepaper provides a valuable insight. Get the whitepaper

Topics:
database ,tutorial ,python3 ,oracle cloud ,nodejs ,dinodate

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}