https://github.com/kludex/serverping
FastAPI Application to ping a server and send its status via Slack! :tada:
https://github.com/kludex/serverping
Last synced: 6 months ago
JSON representation
FastAPI Application to ping a server and send its status via Slack! :tada:
- Host: GitHub
- URL: https://github.com/kludex/serverping
- Owner: Kludex
- License: mit
- Created: 2020-11-27T00:32:37.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-27T00:32:54.000Z (almost 5 years ago)
- Last Synced: 2024-11-28T23:23:09.063Z (10 months ago)
- Language: Python
- Homepage:
- Size: 15.6 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Server Ping
A FastAPI application that pings a server from time to time to know its status.
## Installation
We're using [poetry](https://python-poetry.org/) as package manager, so in case you don't have it:
``` bash
pip install poetry
```As for the dependencies, you just need to:
``` bash
poetry install
```## Usage
The usage is pretty simple. But I'll give the complete information you need to do it.
First of all, you'll need an `.env` file, so I recommend you to copy the `env.example` and change its name.
### Variables
The variables you need are:
* `SLACK_API_TOKEN` : The slack API token that you can get from your [slack app environment](https://api.slack.com/apps/).
* `CHANNEL_ID` : You can get it from web slack, as the channels always have the same format: `app.slack.com/client//` .
* `HOST` : Server host.
* `PORT` : Server port.
* `SERVER_NAME` : The server name, doesn't need to be the real one.
* `PING_TIME` : Time interval on which you'll ping the server.### Run the server
Uvicorn is all we need.
``` bash
uvicorn serverping:app
```You can pass [additional parameters](https://www.uvicorn.org/settings/) to `uvicorn` if you want, but the above command should be enough.
## License
This project is licensed under the terms of the MIT license.