Skip to content

Commit

Permalink
Setup a Docker-based dev environment
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Pracucci committed Dec 5, 2018
1 parent 0fb5d22 commit d62ffdf
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
8 changes: 8 additions & 0 deletions Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM python:3.6-alpine

# Install dependencies
COPY requirements.txt /prometheus-pgbouncer-exporter/
RUN apk add --update --no-cache postgresql-dev gcc musl-dev && \
pip install -r /prometheus-pgbouncer-exporter/requirements.txt

WORKDIR /prometheus-pgbouncer-exporter
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,27 @@ pgbouncers:
The configuration file supports environment variables replacement. If you use the syntax `$(NAME)` in any setting value, it gets replaced by the content of `NAME` environment variable or left untouched if the `NAME` environment variable does not exist.


## Contributions
## How to contribute

### Run locally
Run the **development environment**:

`python3 -m prometheus_pgbouncer_exporter.cli --config ./config.yml`
```
docker-compose build && docker-compose run dev
```

### Run tests
Then inside the container:

`python3 -m unittest`
```
# Run tests
python -m unittest
### Ensure the code is PEP 8 compliant
# Run exporter
python -m prometheus_pgbouncer_exporter.cli --config ./config.yml
# Run linter
pycodestyle --max-line-length=300 prometheus_pgbouncer_exporter/*.py
```

`pycodestyle --max-line-length=300 prometheus_pgbouncer_exporter/*.py`

### How to publish a new version

Expand Down
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: "3"

services:
dev:
build:
context: .
dockerfile: Dockerfile-dev
command: [ "sh" ]
volumes:
- .:/prometheus-pgbouncer-exporter:delegated

0 comments on commit d62ffdf

Please sign in to comment.