Skip to content

Commit

Permalink
Add env to the cronjob
Browse files Browse the repository at this point in the history
  • Loading branch information
CannonLock committed Sep 25, 2024
1 parent 41c2987 commit 9c1ffe3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
CMD printenv > /etc/environment && cron && tail -f /var/log/cron.log
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

0 comments on commit 9c1ffe3

Please sign in to comment.