1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

doc: update readme

This commit is contained in:
Ferdinand Mütsch 2020-04-26 15:40:46 +02:00
parent f399f3bf8d
commit 94e1de772c

View File

@ -6,34 +6,46 @@
[![Buy me a coffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://buymeacoff.ee/n1try) [![Buy me a coffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://buymeacoff.ee/n1try)
## Prerequisites ## Prerequisites
### Server **On the server side:**
* Go >= 1.13 (with `$GOPATH` properly set) * Go > 1.13 (with `$GOPATH` properly set)
* An SQL database (MySQL, Postgres, Sqlite) * _Optional_: A MySQL- or Postgres database
### Client **On your local machine:**
* [WakaTime plugin](https://wakatime.com/plugins) for your editor / IDE * [WakaTime plugin](https://wakatime.com/plugins) for your editor / IDE
## Usage ## Run from source
* Create an empty database 1. _Optional:_ Create an empty database, when using MySQL or Postgres
* Enable Go module support: `export GO111MODULE=on` 1. Enable Go module support: `export GO111MODULE=on`
* Get code: `go get github.com/muety/wakapi` 1. Get code: `go get github.com/muety/wakapi`
* Go to project root: `cd "$GOPATH/src/github.com/muety/wakapi"` 1. Go to project root: `cd "$GOPATH/src/github.com/muety/wakapi"`
* Copy `.env.example` to `.env` and set database credentials 1. Copy `.env.example` to `.env` and set database credentials
* Set target port in `config.ini` 1. Set target port in `config.ini`
* Build executable: `go build` 1. Build executable: `go build`
* Run server: `./wakapi` 1. Run server: `./wakapi`
* Edit your local `~/.wakatime.cfg` file
* `api_url = https://your.server:someport/api/heartbeat`
* `api_key = the_api_key_printed_to_the_console_after_starting_the_server`
* Open [http://localhost:3000](http://localhost:3000) in your browser
**As an alternative** to building from source or using `go get` you can also download one of the existing [pre-compiled binaries](https://github.com/muety/wakapi/releases). **As an alternative** to building from source or using `go get` you can also download one of the existing [pre-compiled binaries](https://github.com/muety/wakapi/releases).
### Run with Docker ## Run with Docker
* Edit `docker-compose.yml` file and change passwords for the DB ```
* Start the application `docker-compose up -d` docker run -d -p 3000:3000 --name wakapi n1try/wakapi
* To get the api key look in the logs `docker-compose logs | grep "API key"` ```
* The application should now be running on `localhost:3000`
To get your API key, take a look into the logs `docker logs wakapi | grep "API key"`
In addition, you can specify several environment variables for configuration:
* `-e WAKAPI_DEFAULT_USER_NAME=admin`
* `-e WAKAPI_DEFAULT_USER_PASSWORD=admin`
By default, SQLite is used as a database. To run Wakapi in Docker with MySQL or Postgres, see [Dockerfile](https://github.com/muety/wakapi/blob/master/Dockerfile) and [.env.example](https://github.com/muety/wakapi/blob/master/.env.example) for further options.
## Configure WakaTime
To make your local WakaTime client talk to Wakapi, edit your local `~/.wakatime.cfg` file.
```
api_url = https://your.server:someport/api/heartbeat`
api_key = the_api_key_printed_to_the_console_after_starting_the_server`
```
## Customization
### User Accounts ### User Accounts
* When starting wakapi for the first time, a default user _**admin**_ with password _**admin**_ is created. The corresponding API key is printed to the console. * When starting wakapi for the first time, a default user _**admin**_ with password _**admin**_ is created. The corresponding API key is printed to the console.