Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GTFS-RT converter: switch to newly imported GTFS automatically #1

Open
derhuerst opened this issue Oct 18, 2024 · 0 comments
Open

GTFS-RT converter: switch to newly imported GTFS automatically #1

derhuerst opened this issue Oct 18, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@derhuerst
Copy link
Member

Currently, new GTFS datasets get imported automatically:

- name: set up GTFS import cron job
ansible.builtin.cron:
name: 'gtfs-rt-feed: GTFS import'
user: root # todo: use `www-data` instead?
cron_file: gtfs-rt-feed-gtfs-import
job: '{{ gtfs_rt_feed_import_cmd }}'
# every hour
minute: '3'

# This command imports the GTFS data into a database. It then writes a systemd override config file setting $PGDATABASE.
# We assume that it is executed using `sh`.
# todo: make $GTFS_IMPORTER_DB_PREFIX configurable
gtfs_rt_feed_import_cmd: "export PGUSER=postgres PGPASSWORD='{{ postgresql_postgres_password }}' PGDATABASE='{{ gtfs_rt_feed_gtfs_importer_db }}' && env GTFS_DOWNLOAD_USER_AGENT='{{ gtfs_rt_feed_gtfs_download_user_agent }}' {{ gtfs_rt_feed_dir }}/import.sh --docker && echo \"[Service]\\nEnvironment=PGDATABASE=$(psql -q --csv -t -h localhost -c 'SELECT db_name FROM latest_import')\"| sponge /etc/systemd/system/gtfs-rt-feed.service.d/pgdatabase.conf"

However, gtfs-rt-feed.service needs to be restarted afterwards to use the new data.

@derhuerst derhuerst added the enhancement New feature or request label Oct 18, 2024
@derhuerst derhuerst self-assigned this Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant