Add some docs

This commit is contained in:
Christoph Wiechert
2017-05-11 23:46:52 +02:00
parent cb6832c428
commit d2ff07392b
5 changed files with 129 additions and 0 deletions

View File

@@ -24,6 +24,9 @@ It's an alternative to paid services like Dropbox, WeTransfer.
* Requires Node >=7.4 or use `--harmony-async-await` flag
* Password protected download list ([AES](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard))
**See the blog posts about PsiTransfer: https://psi.cx/tags/PsiTransfer/ and checkout the
[Documentation](https://github.com/psi-4ward/psitransfer/tree/master/docs)**
![Screenshot](https://raw.githubusercontent.com/psi-4ward/psitransfer/master/docs/psitransfer.gif)
**Demo**: https://transfer.psi.cx

40
docs/configuration.md Normal file
View File

@@ -0,0 +1,40 @@
# Configuration
First of all, I'll give an overview about the configuration options. See the
[config.js](https://github.com/psi-4ward/psitransfer/blob/master/config.js#L5) for
possible values. I do **not** recommend changing this file directly, better use one
of the following options.
## Config file: NODE_ENV related
PsiTransfer searches for an config file with the name `config.<NODE_ENV>.js` in the
root folder where `<NODE_ENV>` stands for the value of the environment parameter `NODE_ENV`.
If you start PsiTransfer using `npm start` it's `production` so you can create a
`config.production.js` with your settings. For example take a look at
[config.dev.js](https://github.com/psi-4ward/psitransfer/blob/master/config.dev.js).
This file is used when starting the application with `npm run dev`.
You are completely free to introduce own configs like `config.custom.js` and start
the app with `NODE_ENV=custom node app.js`.
## Environment variables
Some Linux distributions have `/etc/default/<daemon>` or `/etc/sysconfig/<daemon>`
files with environment configurations. Moreover, it's common to
configure the behaviour of Docker containers using environment parameters.
PsiTransfer supports overwriting every config value by environment parameters prefixed
with `PSITRANSFER_`.
```bash
export NODE_ENV=dev
export PSITRANSFER_RETENTIONS='{"one-time":"one time","3600":"1 Hour"}'
export PSITRANSFER_PORT=8080
node app.js
```
* The above example sets the `NODE_ENV` to `dev`.
If `config.dev.js` exists, it is loaded and overwrites the corresponding values from `config.js`.
* Then it will overwrite `retentions` and `port` with the values of the environment parameters.
> Environment parameters always have the highest priority.

29
docs/deployment-docker.md Normal file
View File

@@ -0,0 +1,29 @@
# Deployment using Docker
Using Docker is the most easy and recommended way to run PsiTransfer. There is an
[official Container](https://hub.docker.com/r/psitrax/psitransfer/) which is
updated whenever a GitHub push occurs.
```bash
docker run -d -v $PWD/data:/data -p 3000:3000 psitrax/psitransfer
```
The above command starts the PsiTransfer Docker container and
* `-d` puts the process into background (daemon mode)
* `-v` mounts the data volume into the container
* `-p` forwards the traffic from port 3000 into the container
**Protipp**: There are several [container tags](https://hub.docker.com/r/psitrax/psitransfer/tags/)
if you want to use a specific version. E.g. `1` is always the latest stable `1.x.x` and `1.1`
correlates with `1.1.x`.
If you want to customize some PsiTransfer configurations use environment parameters
by adding `-e` flags to the `docker run` command.
```bash
docker run -v $PWD/data:/data -p 3000:8080 \
-e PSITRANSFER_PORT=8080 \
-e PSITRANSFER_DEFAULTRETENTION=3600 \
psitrax/psitransfer
```
**Protipp**: By adding `--restart always` Docker will autostart the container after reboots.

View File

@@ -0,0 +1,43 @@
# Deployment as Systemd service
You can also install PsiTransfer as (Linux) system service. Most distributions
use Systemd as main init system. You should **not** run PsiTransfer with root privileges!
**Preparation**
```bash
# Create a target folder for PsiTransfer
mkdir -p /opt/psitransfer
cd /opt/psitransfer
# Download and extract a prebuild
curl -sL https://github.com/psi-4ward/psitransfer/releases/download/1.1.0-beta/psitransfer-1.1.0-beta.tar.gz | tar xz --strip 1
# Install dependencies
npm install --production
# Add a user psitransfer
sudo useradd --system psitransfer
# Make psitransfer owner of /opt/psitransfer
sudo chown -R psitransfer:psitransfer /opt/psitransfer
```
**Systemd unit file**
Grab the [psitransfer.service](https://github.com/psi-4ward/psitransfer/blob/master/docs/psitransfer.service)
sample file, put it in `/etc/systemd/system/` and adjust to your needs.
```bash
cd /etc/systemd/system
sudo wget https://raw.githubusercontent.com/psi-4ward/psitransfer/master/docs/psitransfer.service
# Start the service
sudo systemctl start psitransfer
# Show the status
sudo systemctl status psitransfer
# Enable autostart on boot
sudo systemctl enable psitransfer
```

View File

@@ -0,0 +1,14 @@
# Layout customization
It is easy to customize the look of PsiTransfer. Almost all functional components are encapsulated
in the upload- and download-app and they only need a root element where they can be mounted.
This elements must have the attribute `id="upload"` and `id="download"`, respectively.
PsiTransfer uses [Bootstrap 3](http://getbootstrap.com/) as CSS-Framework and custom styles can
be found in [public/assets/styles.css](https://github.com/psi-4ward/psitransfer/blob/master/public/assets/styles.css).
If you want to give PsiTransfer your own custom look and feel just edit the files in `public/html` and/or
the `styles.css`. If you need to deliver assets like a custom logo put it into the `assets` folder.
But consider: You have to adopt further changes on PsiTransfer updates. This sould not happen very often.