Skip to content

Commit

Permalink
Bump docs for 0.7.3
Browse files Browse the repository at this point in the history
  • Loading branch information
ohsayan committed Feb 15, 2022
1 parent d008af0 commit 4cd96d9
Show file tree
Hide file tree
Showing 49 changed files with 2,645 additions and 0 deletions.
25 changes: 25 additions & 0 deletions versioned_docs/version-0.7.3/1.index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
id: index
title: Introduction
sidebar_label: Home
slug: /
---

Welcome to Skytable's docs! You will find information about how you can get started with Skytable, installation options, configuration and clients.

## Users

We have an easy-to-follow guide for [Getting Started](getting-started). Once you've got everything up and running, you can take a look at the available actions [here](all-actions) and [configuration](config).
Once you've learned the basics, start using a [client driver](clients)!

## Developers

You can find information on how to build your own clients [here](protocol/skyhash). The primary idea is to implement the Skyhash Protocol.

## Contributing

If you find any typos, mistakes or any other scope of improvement - please don't hesitate to bring it up [here](https://github.com/skytable/docs/issues). Thank you ❤️!

## License

The documentation is licensed under the [CC-BY-SA-4.0 License](https://github.com/skytable/docs/tree/master/LICENSE)
56 changes: 56 additions & 0 deletions versioned_docs/version-0.7.3/10.snapshots.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
id: snapshots
title: Snapshots
---

Skytable supports automated snapshots that can be used for periodic backups.
Skytable's snapshotting system is dead simple and works in a similar way to [BGSAVE](persistence).

## Enabling snapshots

Snapshots aren't enabled by default — you have to enable them by using the configuration file or [command line arguments](config-cmd). To your existing configuration file, just add the following block:

```toml
[snapshot]
every = 3600
atmost = 4
failsafe = true # optional
```

Here's what these values mean:

- `every` - Number of seconds to wait before creating another snapshot
- `atmost` - The maximum number of snapshots to keep
- `failsafe` - This indicates whether the database should stop accepting write operations if
snapshotting fails

## Storage of snapshots

All the created snapshots are stored in a `data/snaps` folder in the current directory.
The snapshot folders are named in the format: `YYYYMMDD-HHMMSS`. On the other hand,
[remote snapshots](#remote-snapshots) are stored in the `data/rsnap` folder.

## How snapshots work

As mentioned earlier, snapshots work just like `BGSAVE`. A task is spawned that starts encoding
(and writing data) to a folder (which appears to be a copy of the ks folder); once all the data is successfully flushed to disk, the task exits.

## Methods of creating snapshots

Snapshots can be created automatically by using the configuration file. However, if you want to create snapshots remotely, you can use the [ `MKSNAP` ](actions/mksnap) action. This will only
create snapshots if it is enabled on the server-side, unless you use
[truly remote snapshots](#remote-snapshots).

## Remote snapshots

Irrespective of whether snapshots are enabled on the server side, you can use _truly remote snapshots_.
Such snapshots can be created by using the [`MKSNAP`](actions/mksnap) action. To do this,
pass a second argument to `MKSNAP` with the desired name of your snapshot. This will create
a snapshot in the `data/rsnap` directory.

:::tip
Since snapshots are intended for data backups — you can do a little _trick_ to make these
backups offsite-backups: mount a network file system or a different drive and create a folder
for storing your snapshots in it. Now, symlink the `data/snaps` directory to your
_remotely mounted directory_. You now have offsite backups!
:::
57 changes: 57 additions & 0 deletions versioned_docs/version-0.7.3/11.ssl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
id: ssl
title: TLS configuration
---

Skytable lets you secure connections with TLS. This feature is built into Sky with OpenSSL and doesn't require you to have OpenSSL installed. You can enable TLS by using your [preferred mode of configuration](config).

### Step 1: Create a self-signed certificate and private key

This is outside the scope of this document, but you can read [this guide on Stackoverflow](https://stackoverflow.com/a/10176685) to get a brief idea of creating one.

### Step 2: Add it to your configuration and launch

#### With config files

Add the following block:

```toml
[ssl]
key = "/path/to/keyfile.pem"
chain = "/path/to/chain.pem"
port = 2004
only = true
```

The above block is self-explanatory; you just have to add the paths to the private key and certificate files and add the port (if required).

By setting `only` to `true`, the server will only accept accept secure connections. In other cases,
the server listens to two ports: `2003` and `2004`, a non-TLS port and a TLS port (similar to port
80 and port 443 in HTTP/HTTPS). As expected, you can configure this port number to suit your needs.

:::note
We use the terms `SSL` and `TLS` interchangeably, when what we really mean is TLS.
:::

#### With command-line arguments

Simply start `skyd` with:

```shell
skyd -z cert.pem -k key.pem
```

:::tip Tip
You can pass the `--sslonly` flag to force the server to only accept secure connections, disabling the non-SSL interface. When this flag is not passed, and other SSL options are given — the server listens to both SSL and non-SSL requests
:::

:::info Note
To use TLS with the Skytable shell (`skysh`) just run:

```
skysh -C /path/to/cert.pem --port [SSLPORT]
```

and you'll be on a secure connection. Don't forget the SSL port! The skytable daemon binds the secure
listener on a different port when in multi-socket mode.
:::
19 changes: 19 additions & 0 deletions versioned_docs/version-0.7.3/12.clients.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
id: clients
title: Client drivers
---

We officially maintain the following drivers:

- [Rust driver](https://github.com/skytable/client-rust) [Apache-2.0] - Always up to date and is used by the core project itself

Community powered drivers:

- [C# driver](https://www.nuget.org/packages/Skytable.Client/) [Apache-2.0] - Source code can be found [here on GitHub](https://github.com/martinmolin/skytable-dotnet)
- [JavaScript/TypeScript driver (node)](https://www.npmjs.com/package/skytable.js) [MIT-License] - Source code can be found [here on GitHub](https://github.com/zhangyuannie/skytable.js)

:::info More lanugages
The team is always looking to support more languages and we wish we could ship more drivers. But due to limited
resources we haven't been able to. If you're willing to write a driver (it's super easy to), jump into the
[Skytable discord server](https://discord.gg/QptWFdx) and a maintainer/moderator will help you out!
:::
25 changes: 25 additions & 0 deletions versioned_docs/version-0.7.3/13.perf-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
id: perf-guide
title: Performance Guide
---

We have put in our best efforts to make Skytable really fast — but usage patterns can greatly
affect how well Skytable performs for you, and how well you are able to exploit the _on metal_
performance that Skytable can provide. Here are some quick pointers to get maximum performance:

- **Try to have a lesser number of tables**

The number of tables you can create is virtually
unlimited, but however, creating a huge number of tables (say over 60,000) _can_ hurt performance.

- **Try to use default connection level containers**

Although you are free to run actions by
specifying the table to use, it has a runtime cost because the table has to be looked up and errors
need to be handled. Instead, try using default containers wherever possible. For example, if you
have a table `cakes` in a keyspace `birthday` and your application will be using this table for
the most part, it's a good idea to run `use birthday:cakes` after connecting and then using the
actions without specifying a table (or keyspace). This avoids the lookup and error handling cost.

- If you know your data in keymap tables has valid unicode, try using the `binstr` type instead.
This is because unicode validation adds a _very small_ runtime cost
23 changes: 23 additions & 0 deletions versioned_docs/version-0.7.3/14.benchmarking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
id: benchmarking
title: Benchmarking
---

Who doesn't like speed and as a consequence, benchmarks? So here's a guide on benchmarking Skytable with our tool `sky-bench` .

## Step 0: Getting the benchmarking tool

You'll need to download a bundle from the [releases page](https://github.com/skytable/skytable/releases/v0.6.3) and unzip it. In the following steps we'll assume that you have unzipped the archive and you're in that directory.

## Step 1: Starting the database server

Open a terminal in the current directory and [set executable permissions](getting-started#step-2-make-the-files-runnable). Now start the server by running `./skyd` (or just `skyd` on Windows).

## Step 2: Run the benchmark tool

Open another terminal in the current directory and then run `sky-bench` with no arguments if you want to use the default options, or run `sky-bench --help` to see available configuration options. Hold tight, you'll know when it happens 🚀.

:::tip Tip
**JSON Output**
If you're a bit nerdy, we know it — you'll like some structured data. Well, all you need to do is: run `sky-bench --json` for JSON output!
:::
20 changes: 20 additions & 0 deletions versioned_docs/version-0.7.3/15.deployment-notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
id: deployment-notes
title: Deployment notes
---

Here are some _good to know_ things about deploying Skytable:

- Skytable is under active development. If you do find any rough edges, [please open an issue](https://github.com/skytable/skytable/issues)
- The daemon will create a `.sky_pid` file in its working directory which functions as a PID file
and indicates other processes to not use the data directory. If the daemon is somehow forcefully
stopped, the file may not be removed. In that case, you should manually remove the file
- Skytable currently has a default limit of 50000 connections on a single daemon instance. This limit
can be modified [in your configuration](config).
:::note
Make sure you change the maximum number of connections according to the available system resources to avoid DoS
like attacks that may cause your system to crash
:::
- Skytable is inherently multithreaded. As of now, there is no way to stop Skytable from using
multiple threads
- The best way to deploy Skytable is as a service (and disabling terminal artwork)
53 changes: 53 additions & 0 deletions versioned_docs/version-0.7.3/16.building-from-source.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
id: building-from-source
title: Building from source
---

Of course you can build it from source — but with quite a bit of hassle. The database server is a bit fussy with its builds, so you'll need quite a few tools before you can actually start using it.

### Step 1: Install pre-requisites

As Skytable is written in Rust, you'll have to install the Rust toolchain to build it (a little messy, but not too messy). Go to [this page](https://rustup.rs/) to set up Rust on your local machine.

Besides, the TLS/SSL components are written in C (OpenSSL) — so you'll need to install:

- A C compiler for your platform
- GNU Make (`make`)
- Perl

### Step 2: Clone the tag

Run this from your terminal:

```
git clone --branch v0.7.3 https://github.com/skytable/skytable.git
```

:::tip Bonus tip
If you want to avoid downloading all the version history, run this instead:

```
git clone --depth 1 --branch v0.7.3 https://github.com/skytable/skytable.git
```

:::

### Step 3: Build it!

Expecting that you're still in the same directory, run:

```
cd skybase && cargo build --release
```

:::note
This will take **crazy long** at times, so hold on until Cargo finishes building things
:::

### Step 4: Get the binaries

You'll need to copy `skyd` and `skysh` (or `skyd.exe` and `skysh.exe` if on Windows) from the `skybase/target/release` folder. Be sure to copy these **exact files** and not something else!

### Step 5: Run it!

Now start the database server by running `./skyd` and then start the interactive shell by running `./skysh`. You're ready to use the [actions](actions-overview)!
71 changes: 71 additions & 0 deletions versioned_docs/version-0.7.3/2.getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
id: getting-started
title: Getting Started
---

Getting started with Skytable is easy 😊 (and fun!). You can get started with [native binaries (recommended)](#get-started-with-bundles) or by using the [docker image](#get-started-with-docker).

## Get started with bundles

### Step 1: Download a bundle

Head over to this [page](https://github.com/skytable/skytable/releases/v0.7.3) and download a version for your platform.

:::tip Tip
If you're on Debian, consider downloading an appropriate `.deb` (Debian Package) file for your machine.
The package will install `skyd`, `skysh`, `sky-bench` and `sky-migrate` on your system while also
configuring a `systemd` service unit.
:::

### Step 2: Make the files runnable

Unzip the `zip` file that you just downloaded. If you're on a \*nix system, run `chmod +x skyd skysh` to make the files executable. If you're on Windows, right-click the files and then check the `UNBLOCK` checkbox and click on the `APPLY` button.

### Step 3: Start the database server

In the directory where you extracted the files, run `./skyd` on \*nix systems or simply `skyd` on Windows systems. That's all there is to starting the database server!

### Step 4: Run the shell `skysh`

`skysh` is the shell that is shipped with the bundle. Run it, just like you did with the database server. Now enter commands in the shell, and have fun! First run `HEYA` to check if everything is fine - the server should reply with _HEY!_.

You're done with setting up `skyd` 🎉!

## Get started with Docker

First of all, you need to have Docker installed and available on your `PATH` ; you can read the official guide [here](https://docs.docker.com/get-docker/). Once you've got Docker up and running, follow the steps!

:::note
You may need superuser privileges for installation and running the commands below
:::

### Step 0: Create and start the container

We'll create a container where:

1. We'll call our container `mysky`
2. We'll expose port 2003 of the container
3. We'll save all our data on the host in a folder called `skytable` relative to the current directory. To achieve this, we'll make use of Docker volumes.

Open up a terminal and run:

```sh
docker run --name mysky \
-v ./skytable:/var/lib/skytable \
-p 2003:2003 \
skytable/sdb:v0.7.3
```

### Step 1: Download and setup the bundle

Follow the [instructions above](#get-started-with-bundles) so that you're ready to run `skysh`

### Step 2: Connect to the instance

Simply run:

```sh
skysh -h 127.0.0.1 -p 2003
```

Now, you're all set!
Loading

0 comments on commit 4cd96d9

Please sign in to comment.