diff --git a/packages/server/Dockerfile b/packages/server/Dockerfile index b2e4efadb9..9edbd06def 100644 --- a/packages/server/Dockerfile +++ b/packages/server/Dockerfile @@ -1,4 +1,6 @@ -FROM node:12-alpine +FROM node:12-slim + +RUN apt-get update LABEL com.centurylinklabs.watchtower.lifecycle.pre-check="scripts/watchtower-hooks/pre-check.sh" LABEL com.centurylinklabs.watchtower.lifecycle.pre-update="scripts/watchtower-hooks/pre-update.sh" @@ -16,6 +18,10 @@ COPY . ./ RUN yarn RUN yarn build +# Install client for oracle datasource +RUN apt-get install unzip libaio1 +RUN /bin/bash -e scripts/integrations/oracle/instantclient/linux/x86-64/install.sh + EXPOSE 4001 # have to add node environment production after install diff --git a/packages/server/scripts/integrations/oracle-express/oracle.md b/packages/server/scripts/integrations/oracle-express/oracle.md deleted file mode 100644 index c412b358c2..0000000000 --- a/packages/server/scripts/integrations/oracle-express/oracle.md +++ /dev/null @@ -1,66 +0,0 @@ -### Installation & Management - -To install oracle express edition simply run `docker-compose up` - -- A single instance pluggable database (PDB) will be created named `xepdb` -- The default password is configured in the compose file as `oracle` - - The `system`, `sys` and `pdbadmin` users all share this password - -To connect to oracle sql command line: - -```bash -docker exec -it oracle-xe sqlplus -l system/oracle@localhost/xepdb1 -``` - -To create a new schema (user = schema in oracle) - -```sql -define USERNAME = rpowell - -create user &USERNAME; - -alter user &USERNAME - default tablespace users - temporary tablespace temp - quota unlimited on users; - -grant create session, - create view, - create sequence, - create procedure, - create table, - create trigger, - create type, - create materialized view - to &USERNAME; -``` - -To set the password - -```sql -define USERNAME = rpowell -define PASSWORD = rpowell - -alter user &USERNAME identified by &PASSWORD; -``` - -As before the database schema can now be connected to -```bash -docker exec -it oracle-xe sqlplus -l rpowell/rpowell@localhost:1521/xepdb1 -``` - -### Oracle Instant Client -Before oracle can be connected to from nodejs, the oracle client must be installed. - - - -### HR Schema - -The `HR` schema is populated with dummy data by default in oracle for testing purposes. -To connect to the HR schema first update the user password and unlock the account by performing -```sql -ALTER USER hr ACCOUNT UNLOCK; -ALTER USER hr IDENTIFIED BY hr -``` -You should now be able to connect to the hr schema using the credentials hr/hr - diff --git a/packages/server/scripts/integrations/oracle-express/docker-compose.yml b/packages/server/scripts/integrations/oracle/docker-compose.yml similarity index 100% rename from packages/server/scripts/integrations/oracle-express/docker-compose.yml rename to packages/server/scripts/integrations/oracle/docker-compose.yml diff --git a/packages/server/scripts/integrations/oracle/instantclient/linux/x86-64/basiclite-21.4.zip b/packages/server/scripts/integrations/oracle/instantclient/linux/x86-64/basiclite-21.4.zip new file mode 100644 index 0000000000..777bccbe0f Binary files /dev/null and b/packages/server/scripts/integrations/oracle/instantclient/linux/x86-64/basiclite-21.4.zip differ diff --git a/packages/server/scripts/integrations/oracle/instantclient/linux/x86-64/install.sh b/packages/server/scripts/integrations/oracle/instantclient/linux/x86-64/install.sh new file mode 100755 index 0000000000..1225860a1a --- /dev/null +++ b/packages/server/scripts/integrations/oracle/instantclient/linux/x86-64/install.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# Must be root to continue +if [[ $(id -u) -ne 0 ]] ; then echo "Please run as root" ; exit 1 ; fi + +# Allow for re-runs +rm -rf /opt/oracle + +echo "Installing oracle instant client" + +# copy and unzip package +mkdir -p /opt/oracle +cp scripts/integrations/oracle/instantclient/linux/x86-64/basiclite-21.4.zip /opt/oracle +cd /opt/oracle +unzip -qq basiclite-21.4.zip -d . +rm *.zip +mv instantclient* instantclient + +# update runtime link path +sh -c "echo /opt/oracle/instantclient > /etc/ld.so.conf.d/oracle-instantclient.conf" +ldconfig /etc/ld.so.conf.d + +echo "Installation complete" \ No newline at end of file diff --git a/packages/server/scripts/integrations/oracle/oracle.md b/packages/server/scripts/integrations/oracle/oracle.md new file mode 100644 index 0000000000..912de08b65 --- /dev/null +++ b/packages/server/scripts/integrations/oracle/oracle.md @@ -0,0 +1,90 @@ +# Installation + +## Database + +**Important** +- Oracle database is supported only on **x86-64 architecture** +- Oracle database is **not supported on Mac ARM architecture** (either via docker or linux virtualization) + +To install oracle express edition simply run `docker-compose up` + +- A single instance pluggable database (PDB) will be created named `xepdb` +- The default password is configured in the compose file as `oracle` + - The `system`, `sys` and `pdbadmin` users all share this password + +## Instant Client + +Before oracle can be connected to from nodejs, the oracle client must be installed. +For more information see https://www.oracle.com/database/technologies/instant-client/downloads.html + +**Important** +- Oracle client is supported only on **x86-64 architecture** +- Oracle client is **not supported on Mac ARM architecture** + +### Linux +Run the provided install script for linux from the `server` root path: + +```bash +sudo /bin/bash -e scripts/integrations/oracle/instantclient/linux/x86-64/install.sh +``` +For more information see: https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html#ic_x64_inst + +### Mac +**This has not yet been tested** + +See: https://www.oracle.com/database/technologies/instant-client/macos-intel-x86-downloads.html#ic_osx_inst + +# Management +To connect to oracle sql command line: + +```bash +docker exec -it oracle-xe sqlplus -l system/oracle@localhost/xepdb1 +``` + +To create a new schema (where a user is the same as a schema in oracle) named `sales`: + +```sql +define USERNAME = sales + +create user &USERNAME; + +alter user &USERNAME + default tablespace users + temporary tablespace temp + quota unlimited on users; + +grant create session, + create view, + create sequence, + create procedure, + create table, + create trigger, + create type, + create materialized view + to &USERNAME; +``` + +To set the password for the sales schema use: + +```sql +define USERNAME = sales +define PASSWORD = sales + +alter user &USERNAME identified by &PASSWORD; +``` + +As before the database schema can now be connected to using: +```bash +docker exec -it oracle-xe sqlplus -l sales/sales@localhost:1521/xepdb1 +``` + +## HR Schema + +The `HR` schema is populated with dummy data by default in oracle for testing purposes. +To connect to the HR schema first update the user password and unlock the account by performing +```sql +ALTER USER hr ACCOUNT UNLOCK; +ALTER USER hr IDENTIFIED BY hr +``` +You should now be able to connect to the hr schema using the credentials hr/hr +