Can anyone help me to connect oracle DB through Nodejs api deployed in Google App Engine . I referred this link to connect to DB .But it is not working.
Same code worked fine in local, where I refer oracle instant client from a local folder.
Below is the dockerfile I am using to install instantClient.But I can't map the path properly.
FROM node:12.9.1-buster-slim
WORKDIR /tmp
RUN apt-get update && apt-get -y upgrade && apt-get -y dist-upgrade && apt-get install -y alien libaio1
RUN wget https://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/x86_64/getPackage/oracle-instantclient19.3-basiclite-19.3.0.0.0-1.x86_64.rpm
RUN alien -i --scripts oracle-instantclient*.rpm
RUN rm -f oracle-instantclient19.3*.rpm && apt-get -y autoremove && apt-get -y clean
# Create and change to the app directory.
WORKDIR /usr/src/app
# Copy application dependency manifests to the container image.
# A wildcard is used to ensure both package.json AND package-lock.json are copied.
# Copying this separately prevents re-running npm install on every code change.
COPY package*.json ./
# Install production dependencies.
RUN npm install --only=production
# Copy local code to the container image.
COPY . .
# Run the web service on container startup.
CMD [ "npm", "start" ]
I hope my answer will help others who is looking for a solution .
I have used both dockerfile and app.yaml for deploying in App Engine .
I referred below link for OracleDB connection .It worked like a charm in local .But When I deployed to AppEngine I was not able to map the oracle instant client folder path.
So I installed the Oracle instantclient using Dockerfile.
# Use the official Node.js 12 image.
# https://hub.docker.com/_/node
FROM node:12-buster-slim
RUN apt-get update && apt-get install -y libaio1 wget unzip
WORKDIR /opt/oracle
RUN wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linuxx64.zip && \
unzip instantclient-basiclite-linuxx64.zip && rm -f instantclient-basiclite-linuxx64.zip && \
cd /opt/oracle/instantclient* && rm -f *jdbc* *occi* *mysql* *mql1* *ipc1* *jar uidrvci genezi adrci && \
echo /opt/oracle/instantclient* > /etc/ld.so.conf.d/oracle-instantclient.conf && ldconfig
# Create and change to the app directory.
WORKDIR /usr/src/app
# Copy application dependency manifests to the container image.
# A wildcard is used to ensure both package.json AND package-lock.json are copied.
# Copying this separately prevents re-running npm install on every code change.
COPY package*.json ./
# Install production dependencies.
RUN npm install --only=production
# Copy local code to the container image.
COPY . .
# Run the web service on container startup.
CMD [ "npm", "start" ]
App.yaml file
# [START appengine_websockets_yaml]
runtime: custom
env: flex
service: servicename
network:
name: path
env_variables:
# Use only a single instance, so that this local-memory-only chat app will work
# consistently with multiple users. To work across multiple instances, an
# extra-instance messaging system or data store would be needed.
manual_scaling:
instances: 1
# [END appengine_websockets_yaml]
To initialize the OracleClient use below code
const ORACLE_CLIENT_PATH = process.env.ldconfig
exports.initializeOracleClient = async () => {
oracledb.initOracleClient({ libDir: ORACLE_CLIENT_PATH });
}