Imports data from rating.chgk.info for rating.maii.li calculations.
All imports are rake tasks (defined in Rakefile
). Each task is responsible for one resource (tournament details, tournament roster, team, town, etc.).
For each import, we:
- create a temporary table (e.g.,
teams_temp
); - import data into this temporary table;
- record IDs of imported records into
@ids
(not autogenerated IDs from Postgres, but those provided by rating.chgk.info); - set
updated_at
for each imported row toDateTime.now
; - in one transaction, delete from the main table all rows with IDs from
@ids
and insert everything from the temp table.
This is defined in strategies/temp_table.rb
fly ssh console
cd app
bundle exec rake tournaments:results_for_single_tournament[6341]
Replace 6341 with the ID of the tournament you want to update.
rating-b runs on Fly. Deployment is defined in fly.toml
and has one process: supercronic /app/crontab
.
Supercronic is recommended by Fly for cron jobs: it loads environment variables, forwards job logs to stdout and stderr, and handles sigterm signals. We install it in the final section of Dockerfile
.
Cron jobs are set up in crontab
.