Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation #62

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.log
site/
VENV/
4 changes: 4 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
all: html

html:
mkdocs build -v
4 changes: 4 additions & 0 deletions docs/docs/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# About SaltyRTC

For more information about the project, please visit
[saltyrtc.org](http://saltyrtc.org).
4 changes: 4 additions & 0 deletions docs/docs/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/* Workaround for duplicate headings: https://github.com/mkdocs/mkdocs/issues/318 */
li.toctree-l3:first-child {
display: none;
}
Binary file added docs/docs/img/favicon.ico
Binary file not shown.
9 changes: 9 additions & 0 deletions docs/docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# SaltyRTC Server

This is a SaltyRTC server implementation written in Python 3 with asyncio.

**Contents**

* [Installing](installing.md)
* [Usage](usage.md)
* [About](about.md)
36 changes: 36 additions & 0 deletions docs/docs/installing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Installing

**Note:** On machines where Python 3 is not the default Python runtime, you
should use `pip3` instead of `pip`.

## Prerequisites

You need the following packages installed to be able to run the SaltyRTC
server:

- python3
- python3-pip
- libsodium-dev

## Option A: Installing System-Wide

Now install `saltyrtc.server` from [PyPI](https://pypi.python.org/):

$ sudo pip install saltyrtc.server

## Option B: Installing in a Venv

If you don't want to install saltyrtc-server-python system-wide, we
recommend using [venv](https://docs.python.org/3/library/venv.html) to create
an isolated Python environment.

$ python3 -m venv venv
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you're at it, can you patch this in the readme, too?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^


You can switch into the created virtual environment venv by running this command:

$ source venv/bin/activate

While the virtual environment is active, all packages installed using `pip`
will be installed into this environment.

$ pip install saltyrtc.server
46 changes: 46 additions & 0 deletions docs/docs/testcerts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Test Certificates

To be able to start the SaltyRTC server, you need to specify a TLS key and
certificate. In production you will want to use a certificate signed by a
trusted CA, but for testing purposes, the easiest way is to create a
self-signed certificate.

## Generating a Test Certificate

Use the following command to create such a certificate, valid for `localhost`
during the next 90 days:

$ openssl req \
-newkey rsa:3072 \
-x509 \
-nodes \
-keyout saltyrtc.key \
-new \
-out saltyrtc.crt \
-subj /CN=localhost \
-reqexts SAN \
-extensions SAN \
-config <(cat /etc/ssl/openssl.cnf \
<(printf '[SAN]\nsubjectAltName=DNS:localhost')) \
-sha256 \
-days 90

## Importing

### Chrome / Chromium

The best way to import this certificate into Chrome is via the command line:

$ certutil -d sql:$HOME/.pki/nssdb \
-A -t "P,," -n saltyrtc-test-ca \
-i saltyrtc.crt

Then make sure to restart your browser (or simply visit `chrome://restart`).

### Firefox

In Firefox the easiest way to add your certificate to the browser is to start
the SaltyRTC server (e.g. on `localhost` port 8765), then to visit the
corresponding URL via https (e.g. `https://localhost:8765`). Then, in the
certificate warning dialog that pops up, choose "Advanced" and add a permanent
exception.
7 changes: 7 additions & 0 deletions docs/docs/usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Usage

The script `saltyrtc-server` will be automatically installed and provides a
command line interface for the server. Run the following command to see usage
information:

$ saltyrtc-server --help
21 changes: 21 additions & 0 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
site_name: SaltyRTC Server
site_description: Documentation for saltyrtc-server-python.
site_author: Lennart Grahl, Danilo Bargen
copyright: © 2016-2017 saltyrtc-server-python contributors
theme: readthedocs
repo_url: https://github.com/saltyrtc/saltyrtc-server-python
edit_uri: edit/master/docs/docs/
markdown_extensions:
- smarty
- toc:
permalink: False
pages:
- Home: index.md
- Guide:
- Installing: installing.md
- Usage: usage.md
- Test Certificates: testcerts.md
- About: about.md
theme_dir: theme_overrides
extra_css:
- custom.css
2 changes: 2 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mkdocs==0.16.3
Pygments==2.1.3
6 changes: 6 additions & 0 deletions docs/theme_overrides/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% extends "base.html" %}

{% block site_name %}
<img src="https://saltyrtc.org/static/img/shaker.svg" alt="Logo">
<a href="{{ nav.homepage.url }}" class="icon icon-home"> {{ config.site_name }}</a>
{% endblock %}