Skip to content

Commit

Permalink
Remove the report API from the wforce docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
neilcook committed Oct 18, 2023
1 parent 2f45f26 commit 444605c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 63 deletions.
14 changes: 0 additions & 14 deletions docker/wforce_image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ RUN apt-get update && \
wget \
docker \
docker-compose \
python3-pip \
python3-venv \
net-tools \
clang \
cmake
Expand Down Expand Up @@ -68,8 +66,6 @@ COPY --from=wforce_build /wforce/install/ /
# Remove the default wforce.conf and trackalert.conf files
RUN rm /etc/wforce/wforce.conf /etc/wforce/trackalert.conf

COPY --from=wforce_build /wforce/report_api /wforce/report_api

RUN apt-get update && \
apt-get dist-upgrade -y && \
apt-get -y -f install \
Expand All @@ -93,8 +89,6 @@ RUN apt-get update && \
uuid-dev \
gnupg \
python3 \
python3-pip \
python3-venv \
python3-jinja2 \
net-tools \
tini
Expand All @@ -112,14 +106,6 @@ COPY docker/wforce_image/trackalert.conf.j2 /etc/wforce
RUN chmod 0775 /usr/bin/docker-entrypoint.sh
RUN chmod 0775 /usr/bin/create_config.sh

ARG VENV_DIR=/usr/share/wforce-report-api
RUN python3 -m venv --symlinks $VENV_DIR
RUN cd report_api && $VENV_DIR/bin/python $VENV_DIR/bin/pip install .
RUN mkdir /etc/wforce-report-api
RUN cp report_api/helpers/wforce-report-api-webserver /usr/bin/wforce-report-api-webserver && chmod 755 /usr/bin/wforce-report-api-webserver
RUN cp report_api/instance/report.cfg /etc/wforce-report-api/wforce-report-api-instance.conf && chmod 644 /etc//wforce-report-api/wforce-report-api-instance.conf
RUN cp report_api/helpers/wforce-report-api-docker.conf /etc/wforce-report-api/wforce-report-api-web.conf && chmod 755 /etc/wforce-report-api/wforce-report-api-web.conf
RUN export python3_version=$(python3 -V | awk '{print $2}' | awk 'BEGIN{FS="."};{print $1"."$2}') && sed -i -e s:\<python_version\>:$python3_version: /etc/wforce-report-api/wforce-report-api-web.conf
RUN rm -rf /wforce/*

ARG build_date
Expand Down
50 changes: 1 addition & 49 deletions docs/docker/wforce_docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,52 +119,4 @@ Warning: this generates a lot of logs - you have been warned!

## Running the report_api webservice

The report_api webservice is used to access report events stored in an
Elasticsearch server. The REST API is documented using the OpenAPI
specification at
https://raw.githubusercontent.com/PowerDNS/weakforced/master/docs/swagger/report_api.7.yml

To start the report_api webservice, you'll need to specify a custom
command to the image, as follows:

```
% docker run -p 5000:5000 powerdns/wforce:2.4.0 /usr/bin/wforce-report-api-webserver
[INFO tini (1)] Spawned child process '/usr/bin/docker-entrypoint.sh' with pid '7'
[2020-06-29 16:50:55 +0000] [8] [INFO] Starting gunicorn 19.9.0
[2020-06-29 16:50:55 +0000] [8] [INFO] Listening at: http://0.0.0.0:5000 (8)
[2020-06-29 16:50:55 +0000] [8] [INFO] Using worker: threads
[2020-06-29 16:50:55 +0000] [11] [INFO] Booting worker with pid: 11
[2020-06-29 16:50:55 +0000] [12] [INFO] Booting worker with pid: 12
[2020-06-29 16:50:55 +0000] [13] [INFO] Booting worker with pid: 13
[2020-06-29 16:50:55 +0000] [14] [INFO] Booting worker with pid: 14
[2020-06-29 16:50:55 +0000] [15] [INFO] Booting worker with pid: 15
[2020-06-29 16:50:55 +0000] [16] [INFO] Booting worker with pid: 16
[2020-06-29 16:50:55 +0000] [17] [INFO] Booting worker with pid: 17
[2020-06-29 16:50:55 +0000] [18] [INFO] Booting worker with pid: 18
```

The webservice runs under gunicorn. There are two configuration files
that allow the webservice to be customized:

* /etc/wforce-report-api/wforce-report-api-instance.conf - The
report_api configuration file. The default config file shown below.
* /etc/wforce-report-api/wforce-report-api-web.conf - The gunicorn
configuration file; this will not normally need to be modified.

### Default webservice configuration file

```
import logging
ELASTICSEARCH_URL = ["http://elasticsearch:9200"]
ELASTICSEARCH_TIMEOUT = 1
ELASTICSEARCH_INDEX = "logstash-wforce*"
AUTH_PASSWORD = "secret"
LOG_LEVEL = logging.INFO
LOG_FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
DEVICE_UNIQUE_ATTRS = ['os.family', 'browser.family', 'imapc.family', 'device.family', 'app.name']
TRACKALERT_REDIS = True
TRACKALERT_SERVER = 'localhost'
TRACKALERT_PORT = 8085
TRACKALERT_PASSWORD = 'super'
```
This is no longer supported in the wforce image (>2.8.0)

0 comments on commit 444605c

Please sign in to comment.