File tree 3 files changed +69
-1
lines changed
3 files changed +69
-1
lines changed Original file line number Diff line number Diff line change
1
+ FROM python:3.8-slim-buster
2
+
3
+ RUN ["mkdir" , "-p" , "/checkweb" ]
4
+ WORKDIR /src
5
+
6
+ RUN groupadd -r checkweb && useradd --no-log-init -r -g checkweb checkweb
7
+
8
+ COPY ./src/ /src/
9
+ COPY requirements.txt.freeze /src/
10
+
11
+ RUN true \
12
+ && pip install --upgrade pip \
13
+ && pip install --no-cache-dir -r requirements.txt.freeze
14
+
15
+ USER checkweb
16
+
17
+ # start by default as producer
18
+ ENTRYPOINT ["python3" , "-m" , "checkweb" ]
19
+ CMD ["producer" ]
Original file line number Diff line number Diff line change @@ -58,3 +58,29 @@ run-%-aiven: aiven.env
58
58
59
59
integration-tests-aiven : start-infra-aiven
60
60
CHECKWEB_ENV_PATH=aiven.env .venv/bin/python3 ./integration_tests.py
61
+
62
+ build-docker :
63
+ docker build -t checkweb:latest -f ./Dockerfile .
64
+
65
+ run-docker-aiven :
66
+ make -j run-docker-aiven-producer run-docker-aiven-consumer
67
+ make show-docker-logs
68
+
69
+ run-docker-aiven-% :
70
+ docker run -itd --rm --name checkweb-$* --env-file=aiven.env --env KAFKA_CERT_PATH=/ \
71
+ -v " $( CURDIR) " /service.cert:/service.cert \
72
+ -v " $( CURDIR) " /service.key:/service.key \
73
+ -v " $( CURDIR) " /ca.pem:/ca.pem \
74
+ checkweb:latest $*
75
+
76
+ show-docker-logs :
77
+ make -j show-docker-logs-producer show-docker-logs-consumer
78
+
79
+ show-docker-logs-% :
80
+ docker logs -f checkweb-$*
81
+
82
+ stop-docker :
83
+ make -j stop-docker-producer stop-docker-consumer
84
+
85
+ stop-docker-% :
86
+ docker stop checkweb-$*
Original file line number Diff line number Diff line change @@ -72,6 +72,29 @@ make stop-infra-aiven
72
72
73
73
Destroying the Infrastructure is only possible in the [ Aiven UI] ( https://console.aiven.io/ ) .
74
74
75
+ ## Run locally in docker against aiven infrastructure
76
+
77
+ Build the Image:
78
+
79
+ ``` bash
80
+ make build-docker
81
+ ```
82
+
83
+ Run the docker container in detached mode and then follow the logs of both containers. This expects a
84
+ configured ` aiven.env ` file.
85
+
86
+ ``` bash
87
+ make run-docker-aiven
88
+ ```
89
+
90
+ ` ctrl+c ` will stop following the log but not the containers!
91
+
92
+ To shutdown both container:
93
+
94
+ ``` bash
95
+ make stop-docker
96
+ ```
97
+
75
98
## Maintainance
76
99
77
100
### Updating or installing new python packages
@@ -108,7 +131,7 @@ Afterwards commit `requirements.txt` and `requirements.txt.freeze`.
108
131
* [x] Implement an integration test which spins up new local infra, runs a few loops and then checks that the expected
109
132
data is in the DB + the same check with failing websites
110
133
* [x] Polish the code
111
- * [ ] Proper Packaging: dockerfile? setup.py?
134
+ * [x ] Proper Packaging: dockerfile? setup.py? -> just a Dockerfile for now
112
135
113
136
### Step 4: Connect to Aiven infra and document
114
137
* [x] Figure out how to spin up the infra via ` avn ` and document it
You can’t perform that action at this time.
0 commit comments