Deploy instant oracle on Pivotal CloudFoundry for cx_Oracle - cx-oracle

so im trying to push a python api with cx_oracle dependency which also need oracle instant client,but i couldnt found an tutorial to deploy instant client on pcf,is anybody ever do this before or have any example what should be done? appreciate it
Update:
This is the inside of my .profile
LD_LIBRARY_PATH=/home/vcap/app/oracle/instantclient:${LD_LIBRARY_PATH:-}
export OCI_LIB_DIR=/home/vcap/app/oracle/instantclient
export OCI_INC_DIR=/home/vcap/app/oracle/instantclient/sdk/include
export PYTHONPATH=/home/vcap/app/vendor:$PYTHONPATH
export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib

Use the zip installer of the Oracle Instant Client and not a package manager.
Extract the files to a subfolder under your application, like oracle/.
Install cx-Oracle like normal with pip.
Generate requirements.txt.
Add a file with the exact name of .profile to the root of your application, in it put export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/vcap/app/oracle/lib (where /home/vcap/app is the path to your application files and oracle/lib is the path to the lib directory beneath the folder where you extracted files in step #2).
Then push your app.
The .profile file will run before your actual application starts and it will adjust the library search path so that the Oracle client libraries can be found.
If you get the error:
cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "/home/vcap/app/oracle/instantclient/libclntsh.so: file too short"
Double check your .profile script and make sure that you have the correct LD_LIBRARY_PATH setting.

Related

How to install Nodejs on CentOS 7 without Internet connection with root permission?

I've recently migrated to Linux CentOS7 from windows and I need to install Nodejs to my target, but in target system there is no Internet connection. How can I install Nodejs with all dependencies in offline mode? Thanks in advance for your answers.
you can download node.js binary from its website and you can copy that file using ssh to your target machine.
extract it and add its path to your environment variables.
for more details you can visit here
here is my procedure
To install NodeJS we need an online server to download requirements.
You can download it from Node’s official website. Make sure you download Linux binary version of it.
Or you can use this link:
https://nodejs.org/dist/v16.14.0/node-v16.14.0-linux-x64.tar.xz
After downloading Linux Binary, copy it to your offline machine.
Then go to the directory you copied and unzip your downloaded file by using tar command.
Next step we are going to define the unzipped directory to our environment variables.to do this first go to /etc/profile.d and create a file. its name should be nodejs.sh
Copy commands below to nodejs.sh file and save it.
#!/bin/sh
EXPORT PATH=/home/node-v16.14.0-linux-x64/bin:$PATH
Note : /home/node-v16.14.0-linux-x64/bin (file address) may differ from yours
Restart your session and then enjoy NodeJS on your offline Linux machine.

How to get the directory of the .exe for a Node.js pkg executable?

I'm compiling/building a Node.js project into an .exe using Vercel's pkg but I'm trying to find where that executable file is during the program's runtime. To clarify, I want the Node.js program to know where the .exe file it is being run from is, to confirm it is correctly installed.
Context:
I cannot guarantee where the user has the .exe stored the first time they run it, but I want it to copy itself to the AppData folder so I can setup a Windows service from it, if it's not being run from there already. This in hopes of making a self-installing program, that doesn't require me to build an installed around it.
So on it's first run, I need the location of the .exe to be able to copy where I want. I might just have not picked it up, but I can't find an answer on either the pkg documentation or on another question here.
What I've Tried: I have tried process.cwd, process.pkg, __filename, __dirname and so on, but they all lead to the wrong thing, usually the snapshot folder of files.
When it comes to the main script it's as simple as finding it:
process.argv
From the Node.js documentation
Pkg from Vercel, is not an installer, its just a packager that will package node binaries and your code in a single exe.
You can follow this tutorial that shows how to make an installer it even enables you to set a path of where you want your exe to be installed

cx_Oracle on linux: ImportError: libclntsh.so.12.1: cannot open shared object file: No such file or directory

I'm having problems using cx_Oracle on a linux system. I get the error message: libclntsh.so.12.1: cannot open shared object file: No such file or directory.
What exactly do I need to install to make it work?
You need to install an Oracle client. The simplest is the Oracle Instant client which you can download from here:
http://www.oracle.com/technetwork/database/features/instant-client/index.html
Follow the instructions at the bottom of the page for the specific platform you are using. If you are using an RPM based distribution you can simply install the RPMs which do all of the dirty work for you!

Packing node webkit application

I'm new to node webkit and I'm confused about the packaging steps. I just compressed the whole files including the webkit files to make package.zip file. I just copied it to another machine and unzipped it. The nw executable file is not executable there. Its not doing anything when I clicked on it. My concern is
Will the user be able to use the package by just double clicking on the package provided. Or should he need to unzip the package and execute ?
What are the steps to be followed to package the app ?
It's explained here https://github.com/nwjs/nw.js/wiki/How-to-package-and-distribute-your-apps
There is special tool to make packages: https://github.com/mllrsohn/node-webkit-builder
And here how I do in my project https://github.com/Paxa/postbird/blob/master/Rakefile

Is it possible to add a library path to an init script?

We have an application that runs as a service daemon on a RedHat system.
For now, the RPM we have to install this package creates a soft link from our application's library folder into /usr/lib64, and the daemon recognises that.
I would like to be able to set the LD_LIBRARY_PATH in the init script (/etc/init.d/myscript) so that we don't need to create that soft link (therefore, if multiple applications that use different versions of the library are installed, they will use what is in their own installation folder, and also we won't mess with the standard lib folders).
Is this possible? I tried a simple LD_LIBRARY_PATH=/opt/myapp/lib:/$LD_LIBRARY_PATH but that did not seem to work...
Try next in your init script:
LD_LIBRARY_PATH=/opt/myapp/lib:/$LD_LIBRARY_PATH
export LD_LIBRARY_PATH

Resources