diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..81eafdd --- /dev/null +++ b/.env.example @@ -0,0 +1,3 @@ +# Custom configs. +DATA_DIR=./public_data +#DATA_DIR=/var/www/html diff --git a/.gitignore b/.gitignore index d4b4ec5..e595f0a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ # Contents generated by the Python script. /public_data + + +# Docker environment file. +/.env diff --git a/README.md b/README.md index dae17f1..033f0fb 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,51 @@ # GTFS GTT Checker ## Usage with Docker Compose -You can execute the one-shot command with: +Install the default configuration file: + +``` +cp .env.example .env +``` + +Then you can execute the one-shot command with: ``` docker compose up ``` Look into the `public_data/` directory. It should contain these files: ``` $ tree public_data public_data/ ├── agency.txt.gz ├── calendar_dates.txt.gz ├── calendar.txt.gz ├── fare_attributes.txt.gz ├── fare_rules.txt.gz ├── feed_info.txt.gz ├── routes.txt.gz ├── shapes.txt.gz ├── stop_attributes.txt.gz ├── stops.txt.gz ├── stop_times.txt.gz ├── timetable_pages.txt.gz ├── timetable_stop_order.txt.gz ├── timetables.txt.gz ├── trips_booking.txt.gz ├── trips.txt.gz ├── vehicle_categories.txt.gz ├── vehicles.txt.gz └── versions.json ``` -The suggestion is to add the `docker compose up` in a crontab, every some minutes. +To automatically update these files, run `docker compose up` from a crontab, every some minutes. Example: + +``` +$ sudo crontab -l + +# Run every 10 minutes +*/10 * * * * cd /path/to/gtfs_gtt_checker && /usr/bin/docker compose up --no-color > /dev/null +``` diff --git a/compose.yaml b/docker-compose.yaml similarity index 55% rename from compose.yaml rename to docker-compose.yaml index 2171ec4..43a0373 100644 --- a/compose.yaml +++ b/docker-compose.yaml @@ -1,6 +1,8 @@ +version: '3.3' + services: gtfs-parser: build: . command: python parse_gtfs.py volumes: - - ./public_data:/app/public_data + - ${DATA_DIR:-./public_data}:/app/public_data