getdriftlaget
getdriftlaget is a small Docker container built on top of Python3, Flata and Ubuntu that polls the API for the Church of Sweden current IT operation status Driftlaget. Result is then posted in a Webex Temas Space from a Webex Teams Bot. Only new result will get posted, by default the API will be polled every 30 seconds.
Getting Started
This Docker container can be run localy or in any of the cloud providers that has Docker and/or Kubernetes.
Prerequisites
- A Webex Teams account
- A Webex Teams Bot, including the access token
- A Webex Teams Space, including the room id
- The bot needs to added to the space that should get notifications
More info about Webex Teams and the API See Webex developer documentation - https://developer.webex.com/
Installing
A step by step series of examples that describes how to install the container on Docker.
How to, pull from docker hub(recomended). This instruction will run the bot every 30 seconds and post new updates to the Webex Teams Space specified in the parameter “roomid”
1. docker pull davidberndtsson/getdriftlaget:latest
2. docker run davidberndtsson/getdriftlaget:latest --bottoken <secret bot access token> --roomid <secret room id>
How to, download code and build image This instruction will clone the project to your local machine and start the bot. The bot will run every 30 second and post new updates to the Webex Teams Space specified in the parameter “roomid”
1. Install docker - https://docs.docker.com/v17.12/install/
2. Install Git - https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
3. Open bash, terminal or powershell
4. mkdir gitprojects
5. cd gitprojects
6. git clone https://github.com/naitmare01/getdriftlaget
7. docker build -t get-driftlaget:latest .
8. docker run get-driftlaget:latest --bottoken <secret bot access token> --roomid <secret room id>
Mandatory parameters when running image
--bottoken
Access token for your bot. See Webex developer documentation - https://developer.webex.com/
--roomid
The room ID of the Webex Space. See Webex developer documentation - https://developer.webex.com/
Optional parameters when running image
--pollinginterval
The polling intervall in seconds. If left untouched default is 30.
I.e. how often the bot should poll the API.
--url
API URL to for the Church of Sweden current IT operation status(goo.gl/XXKFxQ). If left untouched default is https://webapp.svenskakyrkan.se/driftlaget/v2/api/news
--logthreshold
Number of entries to be keep in the log database before the databse is purged. If left untouched default is 100 logs.
--database
Full path to database file. Make sure to include file.json after the full path. If left untouched default is mydb.json.
E.g. --database /usr/share/db/mydb.json
Example of output in a Webex Space
Built With
- Python3 - The coding language
- Flata - The database enginge
- Request - The module to handle the api calls
- service - Custom module for this application
Contributing
Open a new issue with the label contributing and we’ll get in touch!
Versioning
For the versions available, see the tags on this repository.
Authors
- David Berndtsson - Initial work - naitmare01
- Erik Ohlsson - Reviewing and modified the code to the better. - nimok
See also the list of contributors who participated in this project.
License
This project is licensed under the GNU General Public License v3.0 - see the LICENSE.md file for details