Skip to content

Commit 230ddcb

Browse files
committed
version: freeze 0.8.4
1 parent ccb1ed3 commit 230ddcb

31 files changed

+2014
-7
lines changed

docusaurus.config.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,6 @@ module.exports = {
122122
"@docusaurus/preset-classic",
123123
{
124124
docs: {
125-
lastVersion: 'current',
126-
versions: {
127-
current: {
128-
label: '0.8.4',
129-
path: '/',
130-
}
131-
},
132125
routeBasePath: "/",
133126
sidebarPath: require.resolve("./sidebars.ts"),
134127
},
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
id: installation
3+
title: Installation
4+
---
5+
6+
Getting started with Skytable involves choosing a mode of installation, downloading any required files and then starting up the database. You can choose to either use:
7+
8+
- [**Native binaries (recommended)**](#native-binaries): This is what is generally recommended for the best performance. You will need to download a bundle and then start the server binary; no expert knowledge required
9+
- [**Using a Debian package (recommended)**](#debian-package): If you're deploying on Ubuntu or any other Debian based Linux distribution, then consider using this method. Configuration files, users and passwords are autogenerated.
10+
- [**A Docker image**](#docker-image): We generally recommend using a Docker image for experimenting with Skytable on your local system during development and you want to keep your local system *clean*. If you want to use a Docker image for deployment, you're always free to do so!
11+
> **Note:** You might experience slightly degraded performance from the storage engine due to Docker engine's abstractions.
12+
13+
:::tip
14+
All client tools (such as `skysh` and `sky-bench`) *can* use the `SKYDB_PASSWORD` variable for authentication. If you're using Skytable in a testing environment and frequently need to use `skysh`, you may consider setting this variable to your password to avoid having to pass the `--password` argument every time.
15+
16+
However, we strongly recommend **not** using it outside testing environments.
17+
:::
18+
19+
## Native binaries
20+
21+
To use native binaries you need to download a bundle which is simply a ZIP file with all the necessary binaries that you'll ever need to develop on and deploy Skytable.
22+
23+
1. **First download the latest bundle** for your platform. You can find [download links on the releases page](https://github.com/skytable/skytable/releases/v0.8.4).
24+
2. **Unzip the ZIP file**. You'll find the following binaries in the extracted archive:
25+
- `skyd`: This is the database server binary which when started runs as a daemon, serving requests
26+
- `skysh`: This is the Skytable shell and it provides a very helpful interactive REPL database client
27+
- `sky-bench`: This is the benchmarking tool that you can use to load test Skytable
28+
3. **Start up the server**. You need to choose a `root` password for the `root` account which will have complete control over the database.
29+
30+
```bash
31+
./skyd --auth-root-password=<your root password>
32+
```
33+
34+
**Replace with your own secure password!**
35+
36+
Explanation:
37+
- `--auth-root-password`: sets the root password
38+
39+
The server starts up at `localhost:2003` and is ready to run queries.
40+
41+
:::info
42+
Your operating system might sometimes not let you run binaries directly. On Unix based systems, you'll need to run: `chmod +x skyd skysh sky-bench`.
43+
44+
And on Windows systems you might need to right-click on the binaries and click on "unblock"
45+
:::
46+
47+
## Debian package
48+
49+
Find the correct `*.deb` file [from the releases page](https://github.com/skytable/skytable/releases). Now simply run:
50+
51+
```sh
52+
sudo dpkg -i <file name>.deb
53+
```
54+
55+
The package will:
56+
57+
- **Generate a root password:** Watch the terminal output!
58+
- **Create a `systemd` unit**: So you can start and stop the process using `systemd` like `systemd start skyd`
59+
- **Generate a configuration**: Your configuration is stored in `/var/lib/skytable/config.yaml`. Go ahead and modify it if you need to!
60+
61+
## Docker image
62+
63+
:::info You must have docker set up!
64+
65+
- Use [this great guide from Docker](https://docs.docker.com/engine/install/) to install and get started
66+
- To be able to run `docker run` and related commands, you may need administrative privileges
67+
:::
68+
69+
### Simple setup
70+
71+
1. **Download the bundle**: To be able to run queries you need to download the bundle as described above
72+
2. **Start the container**:
73+
74+
```shell
75+
docker run -d --name skydb -p 2003:2003 skytable/skytable:v0.8.4
76+
```
77+
78+
:::tip
79+
The password for the Skytable instance on the Docker container is auto-generated. Run `docker logs -f skydb` and you'll see a log
80+
message with the generated password.
81+
:::
82+
83+
### With persistence
84+
85+
1. **Download the bundle**: To be able to run queries you need to download the bundle as described above
86+
2. **Create the data directory**: To ensure that our database is persistent and all our data doesn't vanish as soon as the container is terminated, we'll map the data directory to an actual directory on our local system.
87+
> **Note:** Create a folder called `skytable` in a convenient location. We recommend having a directory in `$HOME/docker-containers` where you can store the Skytable container's data and any other containers that you might use. It's a great way to keep things organized.
88+
3. **Create your configuration**: [Download this template file](https://raw.githubusercontent.com/skytable/skytable/v0.8.4/examples/config-files/template.yaml) and place it into the directory you created. Update the password with your `root` password of choice.
89+
4. **Start the container**:
90+
91+
```shell
92+
docker run -d --name skydb \
93+
-v $HOME/docker-containers/skytable:/var/lib/skytable \
94+
-p 2003:2003 \
95+
skytable/skytable:v0.8.4
96+
```
97+
98+
Explanation:
99+
- This starts a container with name `skydb`
100+
- It maps the folder (as discussed earlier) `$HOME/docker-containers/skytable` from your local file system to `/var/skytable` (in the container's file system)
101+
- Maps port `2003` on the host to the containers port `2003` so that you can use the command-line client `skysh` without having to inspect the container's IP address
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
---
2+
id: using-the-repl
3+
title: Using the REPL
4+
---
5+
6+
Once you've set up Skytable [following our guide](installation), you can now get started using the REPL. Note that you must have downloaded the bundle. If not, go back to the installation guide and do it now.
7+
8+
## Starting the repl
9+
10+
Run this to start the command-line REPL:
11+
12+
```sh
13+
./skysh
14+
```
15+
16+
The REPL will then ask you for a password which you need to type in. This is the root password that you would have set during your installation, so if you don't remember it go ahead and check what you set during the installation step.
17+
18+
:::tip
19+
Keep the root password safe! It's the admin access to your database and without it you won't be able to create or drop or alter
20+
or ... do anything administrative. But if you do happen to lose it, there's an easy way to reset the password (this however requires you to stop the database, which is also the case with many other databases, and that's primarily for security).
21+
22+
You can read more in the [configuration](system/configuration) page.
23+
:::
24+
25+
## Using the REPL
26+
27+
You will now see a welcome message and the REPL will prompt you to run something. Now is a good time to run `sysctl report status` which should just print out `(Okay)` in a cyan shade:
28+
29+
```sh
30+
> sysctl report status
31+
(Okay)
32+
```
33+
34+
You can also run queries like: `inspect global` to see available global system information.
35+
36+
:::info Quick notes
37+
38+
- The REPL stores all command history in a file located at `$HOME/.sky_history` (here `$HOME` represents your home directory)
39+
- If you wish to change where the REPL stores the history file, set the `SKYSH_HISTORY_FILE` environment variable to your preferred path
40+
- The REPL will automatically parameterize queries. Don't worry about what this means; you'll learn about it ahead.
41+
- The REPL applies custom formatting to `DDL` queries. For example, even though `inspect global` returns a JSON as a string,
42+
the REPL formats it and outputs it without quotes, to improve readability
43+
- To connect using different settings (the REPL will attempt to authenticate as `root` by default), see the options using `skysh --help`
44+
:::
45+
46+
## First steps
47+
48+
Skytable's data model is discussed in depth on [this page](architecture#data-model), but let us understand some basics. If you've used a SQL
49+
database, you would be used to the idea of a `database` &mdash; just like this, Skytable has `space`s. A `space` is a collection
50+
of `models` (which are like SQL's `table`s with slightly different functionality) and other containers.
51+
52+
### Create a space
53+
54+
Let us create a `space`:
55+
56+
```sql
57+
CREATE SPACE myspace
58+
```
59+
60+
### Create a model
61+
62+
Let us create a `model`. We want to store something that resembles the structure:
63+
64+
```json
65+
{"username": "string username", "password": "string password", "notes": []}
66+
```
67+
68+
To do this, we create the following Skytable model:
69+
70+
```sql
71+
CREATE MODEL myspace.mymodel(username: string, password: string, notes: list { type: string })
72+
```
73+
74+
### Add, update and remove some data
75+
76+
- **Insert some data**:
77+
78+
```sql
79+
INSERT INTO myspace.mymodel('sayan', 'password123', [])
80+
```
81+
82+
- **Update some data**:
83+
84+
```sql
85+
UPDATE myspace.mymodel SET notes += "mynewnote" WHERE username = 'sayan'
86+
```
87+
88+
- **Select some data**:
89+
90+
```sql
91+
SELECT notes, password FROM myspace.mymodel WHERE username = 'sayan'
92+
```
93+
94+
## Use in your own apps
95+
96+
While we would recommend you to learn BlueQL and more about Skytable's architecture by using the REPL, you can always start using Skytable
97+
in your own apps. [Find a client driver for your language or framework here](libraries).
98+
99+
Once you've found the driver for your framework, you can come back here and follow on with the guide. Be sure to check the driver's
100+
documentation to see how the client driver should be used.
101+
102+
Good luck!

0 commit comments

Comments
 (0)