Skip to content

Commit

Permalink
version: freeze 0.8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ohsayan committed Jan 1, 2025
1 parent ccb1ed3 commit 230ddcb
Show file tree
Hide file tree
Showing 31 changed files with 2,014 additions and 7 deletions.
7 changes: 0 additions & 7 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,6 @@ module.exports = {
"@docusaurus/preset-classic",
{
docs: {
lastVersion: 'current',
versions: {
current: {
label: '0.8.4',
path: '/',
}
},
routeBasePath: "/",
sidebarPath: require.resolve("./sidebars.ts"),
},
Expand Down
101 changes: 101 additions & 0 deletions versioned_docs/version-0.8.4/a.installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
---
id: installation
title: Installation
---

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:

- [**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
- [**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.
- [**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!
> **Note:** You might experience slightly degraded performance from the storage engine due to Docker engine's abstractions.
:::tip
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.

However, we strongly recommend **not** using it outside testing environments.
:::

## Native binaries

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.

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).
2. **Unzip the ZIP file**. You'll find the following binaries in the extracted archive:
- `skyd`: This is the database server binary which when started runs as a daemon, serving requests
- `skysh`: This is the Skytable shell and it provides a very helpful interactive REPL database client
- `sky-bench`: This is the benchmarking tool that you can use to load test Skytable
3. **Start up the server**. You need to choose a `root` password for the `root` account which will have complete control over the database.

```bash
./skyd --auth-root-password=<your root password>
```

**Replace with your own secure password!**

Explanation:
- `--auth-root-password`: sets the root password

The server starts up at `localhost:2003` and is ready to run queries.

:::info
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`.
And on Windows systems you might need to right-click on the binaries and click on "unblock"
:::
## Debian package
Find the correct `*.deb` file [from the releases page](https://github.com/skytable/skytable/releases). Now simply run:
```sh
sudo dpkg -i <file name>.deb
```
The package will:
- **Generate a root password:** Watch the terminal output!
- **Create a `systemd` unit**: So you can start and stop the process using `systemd` like `systemd start skyd`
- **Generate a configuration**: Your configuration is stored in `/var/lib/skytable/config.yaml`. Go ahead and modify it if you need to!
## Docker image
:::info You must have docker set up!
- Use [this great guide from Docker](https://docs.docker.com/engine/install/) to install and get started
- To be able to run `docker run` and related commands, you may need administrative privileges
:::
### Simple setup
1. **Download the bundle**: To be able to run queries you need to download the bundle as described above
2. **Start the container**:
```shell
docker run -d --name skydb -p 2003:2003 skytable/skytable:v0.8.4
```
:::tip
The password for the Skytable instance on the Docker container is auto-generated. Run `docker logs -f skydb` and you'll see a log
message with the generated password.
:::

### With persistence

1. **Download the bundle**: To be able to run queries you need to download the bundle as described above
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.
> **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.
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.
4. **Start the container**:

```shell
docker run -d --name skydb \
-v $HOME/docker-containers/skytable:/var/lib/skytable \
-p 2003:2003 \
skytable/skytable:v0.8.4
```

Explanation:
- This starts a container with name `skydb`
- 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)
- 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
102 changes: 102 additions & 0 deletions versioned_docs/version-0.8.4/b.using-repl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---
id: using-the-repl
title: Using the REPL
---

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.

## Starting the repl

Run this to start the command-line REPL:

```sh
./skysh
```

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.

:::tip
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
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).

You can read more in the [configuration](system/configuration) page.
:::

## Using the REPL

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:

```sh
> sysctl report status
(Okay)
```

You can also run queries like: `inspect global` to see available global system information.

:::info Quick notes

- The REPL stores all command history in a file located at `$HOME/.sky_history` (here `$HOME` represents your home directory)
- If you wish to change where the REPL stores the history file, set the `SKYSH_HISTORY_FILE` environment variable to your preferred path
- The REPL will automatically parameterize queries. Don't worry about what this means; you'll learn about it ahead.
- The REPL applies custom formatting to `DDL` queries. For example, even though `inspect global` returns a JSON as a string,
the REPL formats it and outputs it without quotes, to improve readability
- To connect using different settings (the REPL will attempt to authenticate as `root` by default), see the options using `skysh --help`
:::

## First steps

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
database, you would be used to the idea of a `database` &mdash; just like this, Skytable has `space`s. A `space` is a collection
of `models` (which are like SQL's `table`s with slightly different functionality) and other containers.

### Create a space

Let us create a `space`:

```sql
CREATE SPACE myspace
```

### Create a model

Let us create a `model`. We want to store something that resembles the structure:

```json
{"username": "string username", "password": "string password", "notes": []}
```

To do this, we create the following Skytable model:

```sql
CREATE MODEL myspace.mymodel(username: string, password: string, notes: list { type: string })
```

### Add, update and remove some data

- **Insert some data**:

```sql
INSERT INTO myspace.mymodel('sayan', 'password123', [])
```

- **Update some data**:

```sql
UPDATE myspace.mymodel SET notes += "mynewnote" WHERE username = 'sayan'
```

- **Select some data**:

```sql
SELECT notes, password FROM myspace.mymodel WHERE username = 'sayan'
```

## Use in your own apps

While we would recommend you to learn BlueQL and more about Skytable's architecture by using the REPL, you can always start using Skytable
in your own apps. [Find a client driver for your language or framework here](libraries).
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
documentation to see how the client driver should be used.
Good luck!
Loading

0 comments on commit 230ddcb

Please sign in to comment.