Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bettering Docker management #92

Merged
merged 4 commits into from
Sep 13, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.github/*
.gitignore
.travis.yml
CHANGELOG.md
logo.gif
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a changelog](https://github.com/olivierlacan/keep-a-changelog).

## [Unreleased](https://github.com/idealista/prom2teams/tree/develop)

## [2.2.0](https://github.com/idealista/prom2teams/tree/2.2.0)
[Full Changelog](https://github.com/idealista/prom2teams/compare/2.1.2...2.2.0)
## Added
- *[#80](https://github.com/idealista/prom2teams/pull/79) Add the possibility of group alarms by alertname* @manuhortet
- *[#84](https://github.com/idealista/prom2teams/issues/84) View received message when debugging* @jnogol
- *Update Flask version to v1.0.2* @manuhortet @jnogol

## Changed
- *Docker image now install from sources* @jnogol

## [2.1.2](https://github.com/idealista/prom2teams/tree/2.1.2)
[Full Changelog](https://github.com/idealista/prom2teams/compare/2.1.1...2.1.2)
### Fixed
Expand Down
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM python:3.5-slim-stretch

LABEL maintainer="labs@idealista.com"

EXPOSE 8089

RUN apt-get update && apt-get install -y build-essential

ADD LICENSE /opt/prom2teams/LICENSE
ADD MANIFEST.in /opt/prom2teams/MANIFEST.in
ADD README.md /opt/prom2teams/README.md
ADD requirements.txt /opt/prom2teams/requirements.txt
ADD setup.py /opt/prom2teams/setup.py

ADD ./bin /opt/prom2teams/bin
ADD ./prom2teams /opt/prom2teams/prom2teams

ADD ./docker/config.ini /opt/prom2teams/config.ini
ADD ./docker/replace_config.py /opt/prom2teams/replace_config.py
ADD ./docker/prom2teams_start.sh /opt/prom2teams/prom2teams_start.sh

WORKDIR /opt/prom2teams
RUN python setup.py install

ENV PROM2TEAMS_PORT="8089"
ENV PROM2TEAMS_HOST="0.0.0.0"
ENV PROM2TEAMS_LOGLEVEL="INFO"
ENV PROM2TEAMS_CONNECTOR=""
ENV PROM2TEAMS_GROUP_ALERTS_BY=""

ENTRYPOINT ["bash", "/opt/prom2teams/prom2teams_start.sh"]
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ Every new Prom2teams release, a new Docker image is built in our [Dockerhub](htt
There are two things you need to bear in mind when creating a Prom2teams container:

- The connector URL must be passed as the environment variable `PROM2TEAMS_CONNECTOR`
- In case you want to group alerts, you need to pass the field as the environment variable `PROM2TEAMS_GROUP_ALERTS_BY`
- You need to map container's Prom2teams port to one on your host.

So a sample Docker run command would be:
```bash
$ docker run -it -d -e PROM2TEAMS_CONNECTOR="CONNECTOR_URL" -p 8089:8089 idealista/prom2teams:VERSION
$ docker run -it -d -e PROM2TEAMS_GROUP_ALERTS_BY=FIELD_YOU_WANT_TO_GROUP_BY -e PROM2TEAMS_CONNECTOR="CONNECTOR_URL" -p 8089:8089 idealista/prom2teams:VERSION
```

### Production
Expand Down
3 changes: 3 additions & 0 deletions dockerhub/config.ini → docker/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ Port: prom2teamsport

[Microsoft Teams]
Connector: prom2teamsconnector

[Group Alerts]
Field: prom2teamsgroupalertsby
File renamed without changes.
1 change: 1 addition & 0 deletions dockerhub/replace_config.py → docker/replace_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
filedata = filedata.replace("prom2teamsport", os.environ.get("PROM2TEAMS_PORT"))
filedata = filedata.replace("prom2teamshost", os.environ.get("PROM2TEAMS_HOST"))
filedata = filedata.replace("prom2teamsconnector", os.environ.get("PROM2TEAMS_CONNECTOR"))
filedata = filedata.replace("prom2teamsgroupalertsby", os.environ.get("PROM2TEAMS_GROUP_ALERTS_BY"))

with open('/opt/prom2teams/config.ini', 'w') as file:
file.write(filedata)
18 changes: 0 additions & 18 deletions dockerhub/Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
data_files=[
('/usr/local/etc/prom2teams', ['bin/wsgi.py'])
],
url='http://github.com/idealista/prom2teams',
url='https://github.com/idealista/prom2teams',
author='Idealista, S.A.U',
author_email='labs@idealista.com',
license=license,
Expand Down