- Clone the repository
- Download
google_transit_urbano.zip
and extract the contents instuff/queries/gtfs
- Run
sqlite3 gtfs.db < import.sql
instuff/queries
to create a database with GTFS data
Consider that GTFS data from Trentino Trasporti is updated without notice, so this needs to be repeated every now and then.
Configuration of the application is done through the appsettings.json
file read from the current working directory at startup.
Examples for development and production environments are available.
Make sure that you have the .NET 6.0 SDK and runtime installed on your system.
Make sure that the src/Bot/bin/Debug/netcoreapp3.0
directory contains the appsettings.json
file and the gtfs.db
file created above.
Run with the nice green button.
Make sure that the src/Bot
directory contains the appsettings.json
file and the gtfs.db
file created above.
Run with the dotnet CLI by executing:
cd src/Bot
dotnet run
A development Docker Compose file would look like this:
version: '3'
services:
expelliarbusbot:
container_name: 'expelliarbusbot'
build: .
network_mode: 'host'
volumes:
- ./src/Bot/appsettings.json:/app/appsettings.json
- ./src/Bot/db:/app/db
This time make sure that the configuration file lies at src/Bot/appsettings.json
, and put the gtfs.db
file in src/Bot/db/gtfs.db
.
Also update the appsettings.json
file so that the databases paths are db/gtfs.db
and db/bot.db
.
Now run this command in the repository directory:
docker-compose -f docker-compose.yml up --build
NOTE: mapping a dedicated db
directory is required for database persistence. SQLite writes temporary files other than the .db
one, and it doesn't always clean them before shut down.
A basic Docker Compose file for production looks like this:
version: '3'
services:
expelliarbusbot:
container_name: 'expelliarbusbot'
image: 'matteocontrini/expelliarbusbot'
restart: unless-stopped
network_mode: 'host'
volumes:
- ./appsettings.json:/app/appsettings.json
- ./db:/app/db