Skip to content

Commit 6305492

Browse files
authored
Merge pull request #316 from Archetype-Dynamics/development
Development
2 parents 52e834d + 6838d9a commit 6305492

File tree

3 files changed

+99
-75
lines changed

3 files changed

+99
-75
lines changed

Dockerfile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
FROM golang:1.23.1 as builder
2+
3+
RUN apt-get update && apt-get install -y \
4+
build-essential \
5+
clang \
6+
llvm-14 \
7+
llvm-14-dev \
8+
git \
9+
curl \
10+
libssl-dev \
11+
libffi-dev \
12+
libtool \
13+
automake \
14+
libxml2-dev \
15+
&& rm -rf /var/lib/apt/lists/*
16+
17+
RUN git clone https://github.com/odin-lang/Odin.git /Odin \
18+
&& cd /Odin \
19+
&& git checkout dev-2024-11 \
20+
&& git reset --hard 764c32fd3 \
21+
&& make release-native
22+
23+
ENV PATH="/Odin:$PATH"
24+
25+
RUN git clone https://github.com/Archetype-Dynamics/OstrichDB-CLI.git /OstrichDB \
26+
&& cd /OstrichDB \
27+
&& chmod +x scripts/local_build_run.sh \
28+
&& ./scripts/local_build_run.sh
29+
30+
FROM golang:1.23.1
31+
WORKDIR /data
32+
COPY --from=builder /OstrichDB/bin/main.bin /app/main.bin
33+
COPY --from=builder /OstrichDB/bin/nlp.so /OstrichDB/src/core/nlp/nlp.so

README.md

Lines changed: 54 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
# **OstrichDB**
1+
# **OstrichDB CLI**
22

3-
OstrichDB is a lightweight document-based NoSQL/NoJSON database management system written in Odin. It features an intuitive command structure with hierarchical data organization and built-in security, making it ideal for developers seeking a easy-to-use, flexible, high-performance database solution.
3+
Built from scratch, the OstrichDB engine powers the OstrichDB CLI—a lightweight yet powerful database management tool for your terminal. Written in [Odin](https://odin-lang.org/), it features an intuitive query structure, hierarchical data organization, and built-in security systems, making it ideal for anyone seeking an easy-to-use, flexible, high-performance database solution.
44

55

66
---
77

88
## **Key Features**
99

10-
- Three Modes of Operation:
11-
- Serverless Command-line Interface
12-
- Server Mode with HTTP API
13-
- Server Mode with the built-in natural language processor
10+
- Three Ways To Interact:
11+
- Manually enter queries via the Command-line Interface
12+
- Enable the built-in HTTP server and interact via a client in your favorite language
13+
- (Experimental) Use natural language queries to quickly interact with your data!(Requries a bit of setup)
1414
- User Authentication
1515
- User Role-Based Access
1616
- Database permissions
1717
- Database encryption & decryption
18-
- Custom JSON-like Hierarchical Data Structure
18+
- Custom Hierarchical Data Structure
1919
- .CSV & .JSON file importing
2020
- Dot Notation Syntax when using the serverless CLI
21-
- Command Chaining
22-
- Built-in benchmarking, configurations, and user command history
23-
- Exclusive macOS Support
21+
- Query Chaining
22+
- Built-in benchmarking, configurations, and user query history
23+
- macOS & Linux Support
2424

2525
## **Installation**
2626

@@ -30,18 +30,16 @@ OstrichDB is a lightweight document-based NoSQL/NoJSON database management syste
3030
- The [Odin](https://odin-lang.org/) programming language installed, built, and properly set in the system's PATH. Ideal Odin Version: `dev-2024-11:764c32fd3`
3131
*Note: You can achieve the previous step by following the [Odin Installation Guide](https://odin-lang.org/docs/install/)*
3232

33-
#### **Special Cases:**
34-
- If you are an "End User" and plan install OstrichDB on your machine you will need [curl](https://curl.se/) installed
3533

36-
### Installation For Contributors:
34+
### Building and Running The OstrichDB CLI Locally:
3735
#### **Steps:**
3836

3937
1. **Clone the Repository**:
4038
```bash
4139
git clone https://github.com/Solitude-Software-Solutions/OstrichDB.git
4240
```
4341

44-
2. **Navigate to the OstrichDB Directory**:
42+
2. **Navigate to the root directory of the OstrichDB CLI project**:
4543
```bash
4644
cd path/to/OstrichDB
4745
```
@@ -57,51 +55,33 @@ OstrichDB is a lightweight document-based NoSQL/NoJSON database management syste
5755
```
5856

5957

60-
### Installation For End Users:
58+
### Building and Running The OstrichDB CLI in a Docker Container:
6159
#### **Steps:**
62-
1. Use curl to download the latest release:
60+
1. **Ensure that you have Docker installed**: https://docs.docker.com/engine/install/
61+
62+
2. **Navigate to the root directory of the OstrichDB CLI project**:
6363
```bash
64-
curl -o install.sh https://raw.githubusercontent.com/Solitude-Software-Solutions/OstrichDB/27b7074f9a4b33fa15254e0e93996d67afc5f84c/scripts/install.sh
64+
cd /path/to/OstrichDB
6565
```
6666

67-
2. Make the script executable:
68-
```bash
69-
chmod +x install.sh
70-
```
71-
3. Run the script:
67+
3. **Build the Docker container**:
7268
```bash
73-
./install.sh
69+
docker compose build
7470
```
75-
4. Find and run the OstrichDB executable:
76-
*Note: This will be located in a directory called `.ostrichdb` in the same directory as the install script.*
77-
You can run the executable by double clicking it or running it from the terminal with the following command:
71+
Alternatively, build and run the container in detached mode
7872
```bash
79-
./path/to/.ostrichdb/ostrichdb
73+
docker compose up -d
8074
```
81-
82-
83-
### Installing From Source:
84-
1. **Clone the Repository**:
85-
```bash
86-
git clone https://github.com/Solitude-Software-Solutions/OstrichDB.git
87-
```
88-
89-
2. **Navigate to the OstrichDB Directory**:
90-
```bash
91-
cd path/to/OstrichDB
92-
```
93-
3. Open the `local_install.sh` script and follow the directions at the top of the file.
94-
4. Run the script:
95-
```bash
96-
./local_install.sh
97-
```
98-
5. Find you installed OstirchDB executable in the `.ostrichdb` directory in the same directory you chose to install OstrichDB in via the `local_install.sh` script.
99-
6. Run the executable by double clicking it or running it from the terminal with the following command:
75+
4. **Run the OstrichDB CLI**
10076
```bash
101-
./path/to/.ostrichdb/ostrichdb
77+
docker exec -it ostrichdb /app/main.bin
10278
```
103-
104-
79+
*Note: You can find data for OstrichDB in `.ostrichdb/data` in the project's directory, which is mapped to `/data` inside the container.
80+
You can also change the port mapping to the host machine by updating the `docker-compose.yml` file in case port 8080 is already in use, i.e.
81+
```
82+
ports:
83+
- "8089:8080"
84+
```
10585
10686
---
10787
@@ -116,38 +96,37 @@ OstrichDB organizes data into three levels:
11696
11797
---
11898
119-
## **Command Structure (CLPs)**
120-
121-
In OstrichDB, commands are typically broken into **three types of tokens**, called **CLPs**, to improve readability and ensure clear instructions.
99+
## **Query Structure (CLPs)**
122100
123-
**Note:** Not all commands require all 3 tokens.
101+
From the OstrichDB CLI, queries are typically broken into **three types of tokens**, called **CLPs**, to improve readability and ensure clear instructions.
124102
103+
**Note:** Not all queries require all 3 tokens.
125104
126105
1. **(C)ommand Token**: Specifies the operation to perform (e.g., `NEW`, `ERASE`, `RENAME`).
127-
2. **(L)ocation Token**: The dot notation path that the command will be performed on (e.g., `foo.bar.baz`).
128-
3. **(P)arameter Token(s)**: Additional parameters that change the behavior of the command (e.g., `TO`, `OF_TYPE`).
106+
2. **(L)ocation Token**: The path using dot notation that the query will be performed on (e.g., `foo.bar.baz`).
107+
3. **(P)arameter Token(s)**: Additional parameters that change the behavior of the query (e.g., `TO`, `OF_TYPE`).
129108
130109
---
131110
132-
### **Command Walkthrough**
111+
### **Query Walkthrough**
133112
134113
```bash
135114
NEW foo.bar.baz OF_TYPE []STRING
136115
```
137116
Explanation:
138-
- **`NEW`**: Create a new object (Command token).
139-
- **`foo`**: The fisrt object always points to a collection. (Location token). Note: If there is only 1 object given, its a collection.
140-
- **`bar`**: The second object always to a cluster within the collection. (Location token).
141-
- **`baz`**: The third object is always a record within the cluster. (Location token).
117+
- **`NEW`**: Create a new data structure (Command token).
118+
- **`foo`**: The first data structure always points to a collection. (Location token).
119+
- **`bar`**: The second data structure always to a cluster within the collection. (Location token).
120+
- **`baz`**: The third data structure is always a record within the cluster. (Location token).
142121
- **`OF_TYPE`**: Specifies the data type of the record (Parameter token). Note: Only records are given data types.
143-
- **`[]STRING`**: The record will be an array of strings (Parameter token).
122+
- **`[]STRING`**: Token mapped to the Parameter token that precedes it. The record will be an array of strings.
144123
145124
---
146125
147-
## **Supported Commands**
126+
## **Supported Command Tokens**
148127
149128
### **Single-Token Operations**
150-
These operations perform a task without any additional arguments.
129+
These tokens perform a task without any additional arguments.
151130
152131
- **`AGENT`**: Starts the OstrichDB natural language processor. Requires the server to be running in another terminal.
153132
- **`VERSION`**: Displays the current version of OstrichDB.
@@ -160,27 +139,27 @@ These operations perform a task without any additional arguments.
160139
- **`TREE`**: Displays the entire data structure in a tree format.
161140
- **`CLEAR`**: Clears the console screen.
162141
- **`HISTORY`**: Shows the current users command history.
163-
- **`DESTROY`**: Completley destorys the entire DBMS. Including all databases, users, configs, and logs.
142+
- **`DESTROY`**: Completeley destorys the entire DBMS. Including all databases, users, configs, and logs.
164143
- **`BENCHMARK`**: Runs a benchmark test on the DBMS to test performance. Can be run with or without parameters.
165144
166145
---
167146
168-
### **Multi-Token Operations**
169-
These operations allow you to perform more complex operations.
147+
### **Multi-Token Tokens**
148+
These tokens are used to construct queries and require one or more additional tokens.
170149
171150
- **`NEW`**: Create a new collection, cluster, record, or user.
172151
- **`ERASE`**: Delete a collection, cluster, or record.
173152
- **`RENAME`**: Rename an existing object.
174153
- **`FETCH`**: Retrieve data from a collection, cluster, or record.
175154
- **`SET`**: Assign a value to a record or configuration.
176155
- **`BACKUP`**: Create a backup of a specific collection.
177-
- **`PURGE`**: Removes all data from an object while maintining the object structure.
156+
- **`PURGE`**: Removes all data from an object while maintaining the object structure.
178157
- **`COUNT`**: Returns the number of objects within a scope. Paired with the plural form of the object type (e.g., `RECORDS`, `CLUSTERS`).
179158
- **`SIZE_OF`**: Returns the size in bytes of an object.
180159
- **`TYPE_OF`**: Returns the type of a record.
181160
- **`CHANGE_TYPE`**: Allows you to change the type of a record.
182161
- **`HELP`**: Displays help information for a specific token.
183-
- **`ISOLATE`**: Quarentines a collection file. Preventing any further changes to the file
162+
- **`ISOLATE`**: Quarantines a collection file. Preventing any further changes to the file
184163
- **`WHERE`**: Searches for the location of a single or several record(s) or cluster(s). DOES NOT WORK WITH COLLECTIONS.
185164
- **`VALIDATE`**: Validates a collection file for any errors or corruption.
186165
- **`BENCHMARK`**: Runs a benchmark test on the DBMS to test performance. Can be run with or without parameters.
@@ -192,14 +171,14 @@ These operations allow you to perform more complex operations.
192171
---
193172
194173
### **Parameters**
195-
Modifiers adjust the behavior of commands. The current supported modifiers are:
174+
Modifiers adjust the behavior of queries. The current supported modifiers are:
196175
197176
- **`OF_TYPE`**: Specifies the type of a new record (e.g., INT, STR, []BOOL)
198177
- **`WITH`**: Used to assign a value to a record in the same command you are creating it(e.g `NEW {collection_name}.{cluster_name}.{record_name} OF_TYPE {record_type} WITH {record_value}`)
199178
- **`TO`**: Used to assign a new value or name to a data structure or config(e.g `RENAME {old_collection_name} to {new_collection_name}`)
200179
201-
### **Command Chaining**
202-
OstrichDB supports command chaining, allowing you to execute multiple commands in sequence with a single input. Commands are separated by the `&&` operator, and they will be executed in the order they appear.
180+
### **Query Chaining**
181+
OstrichDB supports query chaining, allowing you to execute multiple queries in sequence with a single input. To chain queries together add the `&&` operator at the end of each valid query, and they will be executed in the order they appear.
203182
204183
Example:
205184
```bash
@@ -272,11 +251,11 @@ OstrichDB has a configuration file that allows the user to customize certain asp
272251
273252
- **`HELP_IS_VERBOSE`**: Decide whether help information is simple or verbose. Default is `false`
274253
- **`SUPPRESS_ERRORS`**: Show or hide error messages. Default is `false`
275-
- **`LIMIT_HISTORY`**: Ensure whether a users command history does or does not exceed the built in limit(100) Default is `true`
254+
- **`LIMIT_HISTORY`**: Ensure whether a users query history does or does not exceed the built in limit(100) Default is `true`
276255
- **`AUTO_SERVE`**: Determines if the built-in OstrichDB server automatically starts the moment the user logs in. Default is `true`
277256
- **`LIMIT_SESSION_TIME`**: Determines if the CLI session timer is enabled or disabled. If enabled a user can only be logged in for 24hrs. Default is `true`
278257
279-
**Note: ALL configs must be set using the following command:**
258+
**Note: ALL configs must be set using the following query:**
280259
Config values can only be `true` or `false`
281260
282261
```
@@ -286,13 +265,13 @@ SET CONFIG {CONFIG_NAME} TO {VALUE}
286265
---
287266
## **Future Plans**
288267
268+
- A new and improved engine!
289269
- More configuration options
290-
- Several new command tokens:
270+
- Several new Command tokens:
291271
- `EXPORT`: Export data to various formats
292272
- `RESTORE`: Restores a collection backup in the place of the original collection
293273
- `MERGE`: Combine multiple collections or clusters into one
294274
- OstrichDB web application
295-
- Linux support
296275
- Windows support
297276
- External API support for even more programming languages!
298277
- Integration with the planned Feather query language!

docker-compose.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: '3.8'
2+
3+
services:
4+
ostrichdb:
5+
build: .
6+
container_name: ostrichdb
7+
stdin_open: true
8+
tty: true
9+
ports:
10+
- "8080:8080"
11+
volumes:
12+
- ./.ostrichdb/data:/data

0 commit comments

Comments
 (0)