Go to file
Jannis Mattheis 193dd67f2c Hide 'failed to find config..' 2018-12-09 11:31:05 +01:00
api Add summary for updateApp and uploadImg api 2018-11-24 11:31:32 +01:00
auth Add UploadApplicationImage API 2018-03-31 18:44:49 +02:00
config Hide 'failed to find config..' 2018-12-09 11:31:05 +01:00
database [#69] add end-point for update application name and description 2018-11-23 21:39:07 +01:00
docker Add docker & build on tags 2018-02-23 19:01:06 +01:00
docs Add summary for updateApp and uploadImg api 2018-11-24 11:31:32 +01:00
error [#34] Add error messages for min and max 2018-04-13 18:56:11 +02:00
mode Use gofmt -s 2018-03-25 19:33:29 +02:00
model [#71] Make title in message not necessary field 2018-11-14 20:05:24 +01:00
router [#23] add headers to configuration 2018-12-04 19:58:01 +01:00
runner Remove unnecessary println 2018-03-31 18:44:49 +02:00
test [#71] Make title in message not necessary field 2018-11-14 20:05:24 +01:00
ui Move react-script-ts to devDependencies 2018-11-30 18:29:37 +01:00
.gitignore Change default folder & db path to data/* 2018-05-10 12:34:35 +02:00
.travis.yml Update to go1.11 2018-11-22 20:59:29 +01:00
ADD_MESSAGE_EXAMPLES.md Extract message examples to own file 2018-11-09 17:12:53 +01:00
CODE_OF_CONDUCT.md Add code of conduct 2018-03-02 21:04:51 +01:00
Gopkg.lock Hide 'failed to find config..' 2018-12-09 11:31:05 +01:00
Gopkg.toml Hide 'failed to find config..' 2018-12-09 11:31:05 +01:00
LICENSE Add license 2018-02-08 19:52:58 +01:00
Makefile Update golint path 2018-11-11 21:03:42 +01:00
README.md Add FOSSA badge 2018-12-04 20:30:36 +01:00
app.go Create image folder with right permission 2018-03-31 18:44:49 +02:00
docker-push.sh Add docker & build on tags 2018-02-23 19:01:06 +01:00
logo.png Add logo 2018-03-18 19:22:27 +01:00
ui.png Add app to README & Adjust stuff 2018-07-01 21:45:14 +02:00

README.md

Gotify Server

Build Status codecov Go Report Card Swagger Valid FOSSA Status Api Docs latest release version

Motivation

We wanted a simple server for sending and receiving messages (in real time per web socket). For this, not many open source projects existed and most of the existing ones were abandoned. Also, a requirement was that it can be self-hosted. We know there are many free and commercial push services out there.

Features

Gotify UI screenshot
  • send messages via REST-API
  • receive messages via web socket
  • manage users, clients and applications
  • API Docs (also available at /docs)
  • Web-UI -> ./ui
  • CLI for sending messages -> gotify/cli
  • Android-App -> gotify/android

Get it on Google Play Get it on F-Droid

Google Play and the Google Play logo are trademarks of Google LLC.

Installation

Docker

The docker image is available on docker hub at gotify/server.

$ docker run -p 80:80 -v /etc/gotify/data:/app/data gotify/server 

Also there is a specific docker image for arm-7 processors (raspberry pi), named gotify/server-arm7.

$ docker run -p 80:80 -v /etc/gotify/data:/app/data gotify/server-arm7

/app/data contains the database file (if sqlite is used), images for applications and cert-files (if lets encrypt is enabled).

Binary

Visit the releases page and download the zip for your OS.

Configuration

File

When strings contain reserved characters then they need to be escaped. List of reserved characters and how to escape them.

server:
  port: 80 # the port for the http server
  ssl:
    enabled: false # if https should be enabled
    redirecttohttps: true # redirect to https if site is accessed by http
    port: 443 # the https port
    certfile: # the cert file (leave empty when using letsencrypt)
    certkey: # the cert key (leave empty when using letsencrypt)
    letsencrypt:
      enabled: false # if the certificate should be requested from letsencrypt
      accepttos: false # if you accept the tos from letsencrypt
      cache: data/certs # the directory of the cache from letsencrypt
      hosts: # the hosts for which letsencrypt should request certificates
      - mydomain.tld
      - myotherdomain.tld
  responseheaders: # response headers are added to every response (default: none)
    Access-Control-Allow-Origin: "*"
    Access-Control-Allow-Methods: "GET,POST"
database: # for database see (configure database section)
  dialect: sqlite3
  connection: data/gotify.db
defaultuser: # on database creation, gotify creates an admin user
  name: admin # the username of the default user
  pass: admin # the password of the default user
passstrength: 10 # the bcrypt password strength (higher = better but also slower)
uploadedimagesdir: data/images # the directory for storing uploaded images

Environment

Escaped characters in list or map environment settings (GOTIFY_SERVER_RESPONSEHEADERS and GOTIFY_SERVER_SSL_LETSENCRYPT_HOSTS) need to be escaped as well. List of reserved characters and how to escape them.

GOTIFY_SERVER_PORT=80
GOTIFY_SERVER_SSL_ENABLED=false
GOTIFY_SERVER_SSL_REDIRECTTOHTTPS=true
GOTIFY_SERVER_SSL_PORT=443
GOTIFY_SERVER_SSL_CERTFILE=
GOTIFY_SERVER_SSL_CERTKEY=
GOTIFY_SERVER_SSL_LETSENCRYPT_ENABLED=false
GOTIFY_SERVER_SSL_LETSENCRYPT_ACCEPTTOS=false
GOTIFY_SERVER_SSL_LETSENCRYPT_CACHE=certs
# lists are a little weird but do-able (:
GOTIFY_SERVER_SSL_LETSENCRYPT_HOSTS=- mydomain.tld\n- myotherdomain.tld
GOTIFY_SERVER_RESPONSEHEADERS="Access-Control-Allow-Origin: \"*\"\nAccess-Control-Allow-Methods: \"GET,POST\""
GOTIFY_DATABASE_DIALECT=sqlite3
GOTIFY_DATABASE_CONNECTION=gotify.db
GOTIFY_DEFAULTUSER_NAME=admin
GOTIFY_DEFAULTUSER_PASS=admin
GOTIFY_PASSSTRENGTH=10
GOTIFY_UPLOADEDIMAGESDIR=images

Database

Dialect Connection
sqlite3 path/to/database.db
mysql gotify:secret@/gotifydb?charset=utf8&parseTime=True&loc=Local
postgres host=localhost port=3306 user=gotify dbname=gotify password=secret

When using postgres without SSL then sslmode=disable must be added to the connection string. See #90.

Push Message Examples

You can simply use curl, HTTPie or any other http-client to push messages.

An application-token can be obtained from the apps tab inside the UI or using the REST-API (/application).

$ curl -X POST "https://push.example.de/message?token=<apptoken>" -F "title=my title" -F "message=my message"
$ http -f POST "https://push.example.de/message?token=<apptoken>" title="my title" message="my message"

More examples can be found here

Also you can use gotify/cli to push messages. The CLI stores url and token in a config file.

$ gotify push -t "my title" -p 10 "my message"
$ echo my message | gotify push

Setup Dev Environment

Setup Server

Download go dependencies with golang/dep.

$ dep ensure

Run golang server.

$ go run app.go

Setup UI

Commands must be executed inside the ui directory.

Download dependencies with npm.

$ npm install

Star the UI development server.

$ npm start

Open http://localhost:3000 inside your favorite browser.

The UI requires a Gotify server running on localhost:80 this can be adjusted inside the ui/src/index.tsx.

Building

Build Server

$ go build app.go

Build UI

$ npm run build

Cross-Platform

The project has a CGO reference (because of sqlite3), therefore a GCO cross compiler is needed for compiling for other platforms. See .travis.yml on how we do that.

Tests

The tests can be executed with:

$ make test
# or
$ go test ./...

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the MIT License - see the LICENSE file for details