diff --git a/Dockerfile b/Dockerfile index 1c7efa6..8ea1bcf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM python:3.8 # Install cron -RUN apt-get update -y && apt-get install -y cron +RUN apt-get update -y && apt-get install -y cron logrotate # Set the working directory WORKDIR /app @@ -25,4 +25,4 @@ RUN crontab /etc/cron.d/import-cron RUN touch /var/log/cron.log # Start the cron service and the application -CMD cron && tail -f /var/log/cron.log \ No newline at end of file +CMD printenv > /etc/environment && cron && tail -f /var/log/cron.log \ No newline at end of file diff --git a/README.md b/README.md index 4d02b0c..478f469 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,21 @@ It keeps 30 days of logs compressed in the PVC on the cluster for debugging purp # Testing +## The Script + ```bash source .env # Construct the command with the environment variables python3 import-script/import_logs.py "$LOG_PATH" --dry-run --url "$MATOMO_URL" --token-auth "$API_TOKEN" + +# Print out the command that was just ran +echo "python3 import-script/import_logs.py \"$LOG_PATH\" --dry-run --url \"$MATOMO_URL\" --token-auth \"$API_TOKEN\"" ``` +## The Docker Image +```bash +docker build -t matomo-log-scraper:latest . +docker run --env-file .env --rm -it matomo-log-scraper:latest +```