Deploying a Gotify App
Gotify is an open-source self-hosted notification server written in Go, designed for sending and receiving push notifications. It is lightweight, easy to deploy, and provides a simple API for integrating notifications into your applications and services.
This guide explains how to deploy a Gotify application to Klutch.sh, both with and without a Dockerfile. It also covers installation and provides sample code to get started.
Prerequisites
- Go 1.20+ (if building from source)
- Git and GitHub account
- Klutch.sh account
Getting Started: Install Gotify
- Download the latest Gotify binary from Gotify Releases or build from source:
Terminal window git clone https://github.com/gotify/server.gitcd servergo build -o gotify - Run Gotify locally:
Visit http://localhost:8080 to see Gotify running.
Terminal window ./gotify
Sample Command
./gotify --port $PORT
Deploying Without a Dockerfile
- Push your Gotify binary or wrapper script to a GitHub repository.
- Log in to Klutch.sh.
- Create a new project and give it a name.
- Create a new app:
- Select your Gotify GitHub repository and branch
- Set the port to route traffic (usually 8080 for Gotify)
- Choose region, compute, number of instances, and add any environment variables
- Add a start command in your app settings:
(Klutch.sh will provide the
Terminal window ./gotify --port $PORTPORT
environment variable.) - Click “Create” to deploy. Klutch.sh will build and deploy your app automatically.
Deploying With a Dockerfile
- Add a
Dockerfile
to your project root. Example:# Use official Gotify imageFROM gotify/server:latest# Expose port (match your Gotify app)EXPOSE 8080# Start the appCMD ["gotify", "--port", "$PORT"] - Push your code (with Dockerfile) to GitHub.
- In Klutch.sh, follow the same steps to create a project and app, but select the Dockerfile option when prompted.
- Set the service details and environment variables as needed.
- Click “Create” to deploy. Klutch.sh will build your Docker image and deploy your app.
Note: Your Gotify app should always listen on the PORT
environment variable as shown above.
Resources
Deploying to Klutch.sh is simple and flexible. Choose the method that best fits your workflow and project requirements.