Skip to content

Commit 980ba08

Browse files
authored
Merge pull request #23 from oracle-samples/m3update
Add Apple Silicon Usage doc
2 parents 92a984e + 7d9d00c commit 980ba08

File tree

2 files changed

+187
-7
lines changed

2 files changed

+187
-7
lines changed

AppleARM.md

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
# Oracle Storage Adapter for Parse Server on Apple Silicon
2+
3+
This document describes how to build and run [Parse Server](https://parseplatform.org/) with the new Oracle storage adapter on [Apple Silicon](https://en.wikipedia.org/wiki/Apple_silicon). It will demonstrate running against the [Free Oracle Database 23ai Docker container](https://www.oracle.com/database/free) using the [Oracle NodeJS libraries](https://node-oracledb.readthedocs.io/en/latest).
4+
5+
## Prerequisites
6+
7+
The Oracle SQL client is a software application that allows users to connect to an Oracle database and execute queries and manage the database.
8+
9+
[SQL Client](https://www.oracle.com/database/sqldeveloper/technologies/sqlcl/download/)
10+
11+
The Oracle Instant Client is a set of software libraries that allow users to connect to an Oracle database without a full Oracle database installation.
12+
13+
[Instant Client Libraries](https://www.oracle.com/cis/database/technologies/instant-client/downloads.html)
14+
15+
## Installation
16+
17+
Clone [Parse Server Repository](https://github.com/parse-community/parse-server). Supported version 7.3.0 and above.
18+
19+
There were changes in this release that supported:
20+
21+
1. [Test Exclusion List](https://github.com/parse-community/parse-server/pull/8774)
22+
2. [Dynamic Database Adapter configuration](https://github.com/parse-community/parse-server/pull/8883)
23+
24+
```
25+
git clone --depth 1 --branch 7.3.0 https://github.com/parse-community/parse-server.git
26+
cd parse-server
27+
```
28+
2. Clone this Oracle Samples repo into src/Adapters/Storage/Oracle
29+
```
30+
cd src/Adapters/Storage
31+
git clone https://github.com/oracle-samples/oracleadapter-parse.git Oracle
32+
cd Oracle
33+
rm -rf .git # IMPORTANT or build will fail
34+
cd ../../../.. # Go back to Project Root
35+
```
36+
37+
## Getting Started
38+
### Building Parse with Oracle Storage Adapter
39+
1. Add the Oracle database dependency
40+
41+
```
42+
npm install [email protected]
43+
```
44+
45+
[Quick Start node-oracledb Installation](https://node-oracledb.readthedocs.io/en/latest/user_guide/installation.html#quick-start-node-oracledb-installation)
46+
47+
2. Add the Parse File Adapter dependency
48+
49+
```
50+
npm install --save @parse/fs-files-adapter
51+
```
52+
53+
This defaults to local storage.
54+
55+
[Parse Server File Storage Adapter Repository](https://github.com/parse-community/parse-server-fs-adapter)
56+
57+
3. Run
58+
```
59+
npm ci
60+
```
61+
to build the server
62+
63+
## How To Run
64+
### Configuring Free23ai Oracle database image
65+
1. Get and Start the image
66+
67+
```
68+
docker run --name free23ai -d -p 1521:1521 -e ORACLE_PASSWORD=Welcome12345 -e APP_USER=testuser -e APP_USER_PASSWORD=Welcome12345 gvenzl/oracle-free:23.5-slim-faststart
69+
```
70+
71+
It takes about a minute for the image to reach a healthy state on my MacBook
72+
73+
2. Connect to the image as sysdba
74+
75+
```
76+
sql sys/Welcome12345@localhost:1521 as sysdba
77+
```
78+
79+
and run the following commands to enable JSON support
80+
81+
```
82+
alter session set container=FREEPDB1;
83+
grant db_developer_role to testuser;
84+
grant soda_app to testuser;
85+
GRANT UNLIMITED TABLESPACE TO testuser;
86+
quit;
87+
```
88+
89+
or run the commands as a script. Create a file called `soda` that contains the above commands
90+
91+
```
92+
sql sys/Welcome12345@localhost:1521 as sysdba @./soda
93+
```
94+
95+
### Run Parse Server
96+
1. Create a config.json. This is a minimal set of [configuration parameters](https://parseplatform.org/parse-server/api/master/ParseServerOptions.html) for booting the server. The databaseURI is configured to attach to the local 23ai Oracle Database instance.
97+
98+
```
99+
{
100+
"appId": "APPLICATION_ID",
101+
"masterKey": "MASTER_KEY",
102+
"allowClientClassCreation": true,
103+
"port": 1338,
104+
"logLevel": "info",
105+
"verbose": false,
106+
"mountGraphQL": true,
107+
"mountPlayground": true,
108+
"graphQLPath": "/graphql",
109+
"filesAdapter": {
110+
"module": "@parse/fs-files-adapter"
111+
},
112+
"databaseAdapter": {
113+
"module": "./Storage/Oracle/OracleStorageAdapter",
114+
"options": {
115+
"databaseURI": "oracledb://testuser:Welcome12345@localhost:1521/freepdb1",
116+
"collectionPrefix": ""
117+
}
118+
}
119+
}
120+
```
121+
122+
2. Boot the Server using the Oracle Instant Client location
123+
124+
```
125+
ORACLE_CLIENT_LOCATION=/Users/myuser/instantclient_23_3 npm start -- ./config.json
126+
```
127+
128+
### Test the Local Stack
129+
1. Run a curl command
130+
131+
```
132+
curl -X POST -H "X-Parse-Application-Id: APPLICATION_ID" -H "Content-Type: application/json" -d '{"score":12,"playerName":"scooby","cheatmode":false}' http://localhost:1338/parse/classes/GameScore
133+
```
134+
135+
Upon success
136+
137+
```
138+
{"objectId":"CdmLJT6Duc","createdAt":"2023-10-16T19:33:27.382Z"}
139+
```
140+
141+
2. Connect to the database and verify
142+
143+
```
144+
sql testuser/Welcome12345@localhost:1521/FREEPDB1
145+
```
146+
147+
3. Run SODA commands
148+
149+
```
150+
SQL> soda list
151+
List of collections:
152+
153+
GameScore
154+
_Hooks
155+
_Idempotency
156+
_Role
157+
_SCHEMA
158+
_User
159+
160+
SQL> soda get GameScore
161+
KEY Created On
162+
163+
3A8CB47A41A74F59BFDD143A3F365F4A 2023-10-16T19:33:27.404374000Z
164+
165+
1 row selected.
166+
167+
SQL> soda get GameScore -k 3A8CB47A41A74F59BFDD143A3F365F4A
168+
169+
Key: 3A8CB47A41A74F59BFDD143A3F365F4A
170+
Content: {"score":12,"playerName":"scooby","cheatmode":false,"updatedAt":"2023-10-16T19:33:27.382Z","createdAt":"2023-10-16T19:33:27.382Z","_id":"CdmLJT6Duc"}
171+
172+
1 row selected.
173+
174+
175+
soda help – list all soda commands
176+
177+
```
178+

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,17 @@ The Oracle Instant Client is a set of software libraries that allow users to con
1313
[Instant Client Libraries](https://www.oracle.com/cis/database/technologies/instant-client/downloads.html)
1414

1515
## Installation
16-
Clone [Parse Server Repository](https://github.com/parse-community/parse-server). Supported version 7.3.0-alpha.7 and above.
16+
[Apple Silicon Installation](./AppleArm.md) otherwise continue below
17+
18+
Clone [Parse Server Repository](https://github.com/parse-community/parse-server). Supported version 7.3.0 and above.
1719

1820
There were changes in this release that supported:
1921

2022
1. [Test Exclusion List](https://github.com/parse-community/parse-server/pull/8774)
2123
2. [Dynamic Database Adapter configuration](https://github.com/parse-community/parse-server/pull/8883)
2224

2325
```
24-
git clone --depth 1 --branch 7.3.0-alpha.7 https://github.com/parse-community/parse-server.git
26+
git clone --depth 1 --branch 7.3.0 https://github.com/parse-community/parse-server.git
2527
cd parse-server
2628
```
2729
2. Clone this Oracle Samples repo into src/Adapters/Storage/Oracle
@@ -35,11 +37,11 @@ cd ../../../.. # Go back to Project Root
3537

3638

3739
## Getting Started
38-
### Building Parse with Oracle Storage Adpater
40+
### Building Parse with Oracle Storage Adapter
3941
1. Add the Oracle database dependency
4042

4143
```
42-
npm install oracledb@6.5.0
44+
npm install oracledb@6.6.0
4345
```
4446
4547
[Quick Start node-oracledb Installation](https://node-oracledb.readthedocs.io/en/latest/user_guide/installation.html#quick-start-node-oracledb-installation)
@@ -61,7 +63,7 @@ cd ../../../.. # Go back to Project Root
6163
to build the server
6264
6365
## How To Run
64-
### Configuring Free23c Oracle database image
66+
### Configuring Free23ai Oracle database image
6567
1. Get and Start the image
6668
6769
```
@@ -73,7 +75,7 @@ cd ../../../.. # Go back to Project Root
7375
2. Connect to the image as sysdba
7476
7577
```
76-
sql sys/Welcome12345@localhost:1521/freepdb1 as sysdba @./soda
78+
sql sys/Welcome12345@localhost:1521/freepdb1 as sysdba
7779
```
7880
7981
and run the following commands to enable JSON support
@@ -93,7 +95,7 @@ cd ../../../.. # Go back to Project Root
9395
```
9496
9597
### Run Parse Server
96-
1. Create a config.json. This is a minimal set of [configuration parameters](https://parseplatform.org/parse-server/api/master/ParseServerOptions.html) for booting the server. The databaseURI is configured to attach to the local 23c Oracle Database instance.
98+
1. Create a config.json. This is a minimal set of [configuration parameters](https://parseplatform.org/parse-server/api/master/ParseServerOptions.html) for booting the server. The databaseURI is configured to attach to the local 23ai Oracle Database instance.
9799
98100
```
99101
{

0 commit comments

Comments
 (0)