Files
hetty/docs/src/guide/getting-started.md

85 lines
2.4 KiB
Markdown
Raw Normal View History

2020-11-09 20:28:10 +01:00
# Getting Started
## Installation
2022-01-21 11:45:54 +01:00
Hetty compiles to a static binary, with an embedded BadgerDB database and web
2020-11-09 20:28:10 +01:00
admin interface.
### Install pre-built release (recommended)
👉 Downloads for Linux, macOS and Windows are available on the [releases page](https://github.com/dstotijn/hetty/releases).
### Build from source
#### Prerequisites
2021-04-26 09:24:45 +02:00
- [Go 1.16](https://golang.org/)
2020-11-09 20:28:10 +01:00
- [Yarn](https://yarnpkg.com/)
2022-01-21 11:45:54 +01:00
When building from source, the static resources for the admin interface
2021-04-26 09:24:45 +02:00
(Next.js) need to be generated via [Yarn](https://yarnpkg.com/). The generated
2022-01-21 11:45:54 +01:00
files will be embedded (using the [embed](https://golang.org/pkg/embed/)
package) when you use the `build` Makefile target.
2020-11-09 20:28:10 +01:00
Clone the repository and use the `build` make target to create a binary:
```
$ git clone git@github.com:dstotijn/hetty.git
$ cd hetty
$ make build
```
### Docker
A Docker image is available on Docker Hub: [`dstotijn/hetty`](https://hub.docker.com/r/dstotijn/hetty).
For persistent storage of CA certificate and project databases, mount a volume:
```
$ mkdir -p $HOME/.hetty
$ docker run -v $HOME/.hetty:/root/.hetty -p 8080:8080 dstotijn/hetty
```
## Usage
When Hetty is started, by default it listens on `:8080` and is accessible via
[http://localhost:8080](http://localhost:8080). Depending on incoming HTTP
requests, it either acts as a MITM proxy, or it serves the API and web interface.
2022-01-21 11:45:54 +01:00
By default, the projects database files and CA certificates are stored in a `.hetty`
2020-11-09 20:28:10 +01:00
directory under the user's home directory (`$HOME` on Linux/macOS, `%USERPROFILE%`
on Windows).
To start, ensure `hetty` (downloaded from a release, or manually built) is in your
`$PATH` and run:
```
$ hetty
```
You should see:
```
2022-01-26 11:35:47 +01:00
2022/01/26 10:34:24 [INFO] Hetty (v0.3.2) is running on :8080 ...
2020-11-09 20:28:10 +01:00
```
Then, visit [http://localhost:8080](http://localhost:8080) to get started.
### Configuration
An overview of available configuration flags:
```
$ hetty -h
Usage of ./hetty:
-addr string
TCP address to listen on, in the form "host:port" (default ":8080")
-adminPath string
File path to admin build
-cert string
CA certificate filepath. Creates a new CA certificate if file doesn't exist (default "~/.hetty/hetty_cert.pem")
2020-11-09 20:28:10 +01:00
-key string
CA private key filepath. Creates a new CA private key if file doesn't exist (default "~/.hetty/hetty_key.pem")
2022-01-21 11:45:54 +01:00
-db string
Database directory path (default "~/.hetty/db")
2020-11-09 20:28:10 +01:00
```