Update README.md

This commit is contained in:
Zlatko Čalušić
2016-12-30 22:40:11 +01:00
parent c228f57ddf
commit 130b202fdb

View File

@@ -6,37 +6,67 @@
[![License](https://img.shields.io/badge/license-BSD%20%282--Clause%29-003262.svg?maxAge=2592000)](https://github.com/restic/rest-server/blob/master/LICENSE)
[![Powered by](https://img.shields.io/badge/powered_by-Go-5272b4.svg?maxAge=2592000)](https://golang.org/)
Rest Server is a sample server that implements restic's REST backend API. It has been developed for demonstration
purpose and is not intended to be used in production.
Rest Server is a high performance HTTP server that implements restic's [REST backend
API](https://github.com/restic/restic/blob/master/doc/REST_backend.md). It provides secure and efficient way to backup
data remotely, using [restic](https://github.com/restic/restic) backup client.
## Installation
Rest server requires Go 1.7 or higher to build. The only tested compiler is the official Go compiler. Building server
with gccgo may work, but is not supported.
Run ```go run build.go```, afterwards you'll find the binary in the current directory. You can move it anywhere you
want. There's also an [example systemd service
file](https://github.com/restic/rest-server/blob/master/etc/rest-server.service) included, so you can get it up &
running as a proper service in no time. Of course, you can also test it from the command line.
```
% go run build.go
% ./rest-server --help
Run a REST server for use with restic
Usage:
rest-server [flags]
Flags:
--cpuprofile string write CPU profile to file
--debug output debug messages
--listen string listen address (default ":8000")
--path string data directory (default "/tmp/restic")
--tls turn on TLS support
```
Alternatively, you can compile and install it in your $GOBIN with a standard `go install`. But, beware, you won't have
version info built into binary, when compiled that way.
## Getting started
By default the server persists backup data in `/tmp/restic`. Build and start the server with a custom persistence
directory:
By default the server persists backup data in `/tmp/restic`. Start the server with a custom persistence directory:
```
go install
rest-server -path /user/home/backup
% rest-server -path /user/home/backup
```
The server uses an `.htpasswd` file to specify users. You can create such a file at the root of the persistence
directory by executing the following command. In order to append new user to the file, just omit the `-c` argument.
The server uses an `.htpasswd` file to specify users. You can create such a file at the root of the persistence
directory by executing the following command. In order to append new user to the file, just omit the `-c` argument.
```
htpasswd -s -c .htpasswd username
% htpasswd -s -c .htpasswd username
```
By default the server uses HTTP protocol. This is not very secure since with Basic Authentication, username and
passwords will be present in every request. In order to enable TLS support just add the `-tls` argument and add a
private and public key at the root of your persistence directory.
By default the server uses HTTP protocol. This is not very secure since with Basic Authentication, username and
passwords will travel in cleartext in every request. In order to enable TLS support just add the `-tls` argument and
add a private and public key at the root of your persistence directory.
Signed certificate is required by the restic backend, but if you just want to test the feature you can generate unsigned
keys with the following commands:
```
openssl genrsa -out private_key 2048
openssl req -new -x509 -key private_key -out public_key -days 365
% openssl genrsa -out private_key 2048
% openssl req -new -x509 -key private_key -out public_key -days 365
```
## Contributors
Contributors are welcome, just open a new issue / pull request.
@@ -47,7 +77,7 @@ Contributors are welcome, just open a new issue / pull request.
The BSD 2-Clause License
Copyright © 2015, Bertil Chapuis
Copyright © 2016, Zlatko Čalušić
Copyright © 2016, Zlatko Čalušić, Alexander Neumann
All rights reserved.
Redistribution and use in source and binary forms, with or without