Add docker setup for local testing
This commit is contained in:
parent
2e71447150
commit
d4de6e0b2d
3 changed files with 71 additions and 0 deletions
14
Dockerfile
Normal file
14
Dockerfile
Normal file
|
@ -0,0 +1,14 @@
|
|||
FROM python:3.8-slim
|
||||
|
||||
USER root
|
||||
|
||||
RUN mkdir /tmp/build
|
||||
WORKDIR /tmp/build
|
||||
COPY . .
|
||||
RUN SETUPTOOLS_SCM_PRETEND_VERSION=0 pip install .
|
||||
|
||||
WORKDIR /tmp
|
||||
RUN rm -rf /tmp/build
|
||||
|
||||
RUN useradd --system checker
|
||||
USER checker
|
15
README.rst
15
README.rst
|
@ -30,6 +30,21 @@ console scripts via the command line::
|
|||
chweb_collect -c config.yaml &
|
||||
chweb_consume -c config.yaml &
|
||||
|
||||
Using docker-compose
|
||||
--------------------
|
||||
|
||||
The services can be run with docker-compose. You'd need to change the values of
|
||||
``KAFKA_SERVERS``, ``POSTGRES_HOST`` and ``POSTGRES_PASS`` in order for
|
||||
the configuration to be properly applied. Also, you'd need to download the
|
||||
kafka certificates and put them in the folder you're running docker-composer
|
||||
from and create the PostgreSQL cert by copying it from aivens console and
|
||||
saving it to ``pgcert.pem``. After all this is done, simply run::
|
||||
|
||||
docker-compose up
|
||||
|
||||
Config file
|
||||
===========
|
||||
|
||||
Sites
|
||||
-----
|
||||
|
||||
|
|
42
docker-compose.yaml
Normal file
42
docker-compose.yaml
Normal file
|
@ -0,0 +1,42 @@
|
|||
version: "3"
|
||||
services:
|
||||
collector:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
environment:
|
||||
KAFKA_SERVERS: "AIVEN_KAFKA_SERVER"
|
||||
KAFKA_TOPIC: "sitestats"
|
||||
KAFKA_CA_FILE: "/etc/kafka_ca.pem"
|
||||
KAFKA_CERT: "/etc/kafka_service.cert"
|
||||
KAFKA_KEY: "/etc/kafka_service.key"
|
||||
volumes:
|
||||
- ./config.yaml:/etc/checker.yaml
|
||||
- ./ca.pem:/etc/kafka_ca.pem
|
||||
- ./service.cert:/etc/kafka_service.cert
|
||||
- ./service.key:/etc/kafka_service.key
|
||||
command: chweb_collect
|
||||
|
||||
consumer:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
environment:
|
||||
KAFKA_SERVERS: "AIVEN_KAFKA_SERVER"
|
||||
KAFKA_TOPIC: "sitestats"
|
||||
KAFKA_CA_FILE: "/etc/kafka_ca.pem"
|
||||
KAFKA_CERT: "/etc/kafka_service.cert"
|
||||
KAFKA_KEY: "/etc/kafka_service.key"
|
||||
POSTGRES_DB: "defaultdb"
|
||||
POSTGRES_HOST: "AIVEN_PG_SERVER"
|
||||
POSTGRES_PORT: 23700
|
||||
POSTGRES_USER: "avnadmin"
|
||||
POSTGRES_PASS: ""
|
||||
POSTGRES_CERT: "/etc/pgcert.pem"
|
||||
volumes:
|
||||
- ./config.yaml:/etc/checker.yaml
|
||||
- ./ca.pem:/etc/kafka_ca.pem
|
||||
- ./service.cert:/etc/kafka_service.cert
|
||||
- ./service.key:/etc/kafka_service.key
|
||||
- ./pgcert.pem:/etc/pgcert.pem
|
||||
command: chweb_consume
|
Loading…
Add table
Reference in a new issue