forked from nalbion/node-oracledb-lambda-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2a_build_and_deploy_to_lambda-remote-script
executable file
·66 lines (57 loc) · 2.17 KB
/
2a_build_and_deploy_to_lambda-remote-script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
# Lambda runs Node v10.16.3 - use the same to build our app and dependencies
NODE_VERSION=$(node --version)
if [[ "${NODE_VERSION}" != "v10.16.3" ]]; then
sudo yum -y install gcc44 gcc-c++ libgcc44 cmake git
wget https://nodejs.org/dist/v10.16.3/node-v10.16.3.tar.gz
tar -zxvf node-v10.16.3.tar.gz
cd node-v10.16.3 && ./configure && make
sudo make install
cd ..
rm -rf node-v10.16.3*
fi
git clone https://github.com/romanbalayan/node-oracledb-lambda-test.git
cd node-oracledb-lambda-test
# Install Oracle Instant Client "Basic" and "SDK"
sudo mkdir /opt/oracle
sudo unzip oracle-instant-client/instantclient-basic-linux.x64-12.1.0.2.0.zip -d /opt/oracle
sudo unzip oracle-instant-client/instantclient-basiclite-linux.x64-12.1.0.2.0.zip -d /opt/oracle
sudo unzip oracle-instant-client/instantclient-sdk-linux.x64-12.1.0.2.0.zip -d /opt/oracle
export OCI_LIB_DIR=/opt/oracle/instantclient_12_1
export OCI_INC_DIR=/opt/oracle/instantclient_12_1/sdk/include
export LD_LIBRARY_PATH=/opt/oracle/instantclient_12_1:$LD_LIBRARY_PATH
export PATH=/opt/oracle/instantclient_12_1:$PATH
pushd $OCI_LIB_DIR
sudo ln -s libclntsh.so.12.1 libclntsh.so
popd
npm install
cp $OCI_LIB_DIR/*.so* lib/
cp /lib64/libaio.so.1 lib/
zip app.zip index.js package.json \
node_modules/oracledb/package.json \
node_modules/oracledb/index.js \
node_modules/oracledb/lib/* \
node_modules/oracledb/build/Release/oracledb.node \
lib/libclntshcore.so.12.1 \
lib/libclntsh.so.12.1 \
lib/libmql1.so \
lib/libipc1.so \
lib/libnnz12.so \
lib/libons.so \
lib/libociicus.so \
lib/libaio.so.1 \
lib/libociei.so
# 104 MB - contains error messages in many languages
# lib/libociei.so \
# C++ call interface - doesn't seem to be required
# lib/libocci.so.12.1 \
# need to run `aws configure` to configure credentials - ...or just do it locally where that's already done
#LAMBDA_ROLE_ARN=(updated by 2_build_and_deploy_to_lambda-remote-script)
#
#aws lambda create-function \
# --region ap-southeast-2 \
# --function-name node-oracledb-test \
# --runtime nodejs4.3 \
# --role ${LAMBDA_ROLE_ARN} \
# --handler index.handler \
# --zip-file fileb://app.zip