{"id":21133518,"url":"https://github.com/chiditarod/chiscore","last_synced_at":"2025-07-09T02:31:49.764Z","repository":{"id":35649188,"uuid":"39923987","full_name":"chiditarod/chiscore","owner":"chiditarod","description":"Online, real-time racer time tracking application for CHIditarod","archived":false,"fork":false,"pushed_at":"2024-03-15T05:01:49.000Z","size":333,"stargazers_count":0,"open_issues_count":16,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-10T22:01:52.211Z","etag":null,"topics":["chiditarod","heroku","nodejs","redis","ruby"],"latest_commit_sha":null,"homepage":"http://chiscore.chiditarod.org","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chiditarod.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2015-07-30T01:07:44.000Z","updated_at":"2023-02-02T03:39:41.000Z","dependencies_parsed_at":"2024-01-25T07:43:54.767Z","dependency_job_id":null,"html_url":"https://github.com/chiditarod/chiscore","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiditarod%2Fchiscore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiditarod%2Fchiscore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiditarod%2Fchiscore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiditarod%2Fchiscore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chiditarod","download_url":"https://codeload.github.com/chiditarod/chiscore/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225476236,"owners_count":17480222,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chiditarod","heroku","nodejs","redis","ruby"],"created_at":"2024-11-20T06:11:50.952Z","updated_at":"2024-11-20T06:11:51.458Z","avatar_url":"https://github.com/chiditarod.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# chiscore\n\n[![Build Status](https://travis-ci.org/chiditarod/chiscore.svg?branch=master)](https://travis-ci.org/chiditarod/chiscore)\n[![Code Climate](https://codeclimate.com/github/chiditarod/chiscore/badges/gpa.svg)](https://codeclimate.com/github/chiditarod/chiscore)\n[![Test Coverage](https://codeclimate.com/github/chiditarod/chiscore/badges/coverage.svg)](https://codeclimate.com/github/chiditarod/chiscore/coverage)\n\n_Timekeeping and Scoring application for the CHIditarod._\n\n## Requirements\n\n- Redis\n- Ruby (`2.5.0`)\n- Node.js (`6.13.0`, `8.9.4`)\n\n## Architecture\n\nchiscore consists of client and server components.  The server is\nwritten in Ruby and uses Sinatra.  The client-side is Node.js.\n\nThe application requires a secret key and an admin key in order to\nfunction.  These keys can easily be generated using the included rake\ntask, `rake gen_secrets`.  This will place the keys in the `config`\nfolder and the app will automatically consume them.\n\nAlternatively, and to support Cloud hosting services like Heroku, the\n`SECRET_KEY` and `ADMIN_KEY` environment variables can be provided in\nleiu of the files on disk.\n\n## Developer Setup\n\n_Assumes you are using OSX. Pull requests for other setups gladly accepted._\n\n### Setup Daemons and Environment\n\n- Install [homebrew](http://brew.sh/).\n- [Install rbenv](https://github.com/rbenv/rbenv#homebrew-on-mac-os-x) using homebrew.\n- Install prequisites and clone the code:\n\n```bash\nbrew install ruby-build\nrbenv install $(cat .ruby-version)\ngit clone github.com:chiditarod/chiscore\ncd chiscore\n```\n\nBoot local docker\n```\ndocker-compose up -d redis\n```\n\n### Install\n\n#### MacOS 12.6\n\n```\nxcode-select --install\nsoftwareupdate --all --install --force\n\nbrew install readline openssl ruby-build\nbrew install redis # skip if using docker\nrbenv install 2.7.5\ngem install bundler\nbundle install\nbundle exec rake gen_secrets     # generate secret keys\n```\n\n### Client Setup\n\nYou need node.js for compilation and running of JavaScript specs.\n\n```bash\nbrew install node\nnpm install -g n           # n is an easy node version switcher\nnpm install\n# sudo n 8.9.4               # install node version 8.9.4, for example\n# yarn\n```\n\n### Development Login\n\n- Use a username and password from `config/data/$year/logins.csv`\n- Use a team number from `config/data/$year/teams.csv`\n\n## Deployment to Heroku\n\nDo these steps every year.\n\n- Copy `config/data/2023/*` to `config/data/2024/` (change the years accordingly)\n- Customize the new files as necessary.\n- Modify `app.rb` and update the year.\n- Do not submit the new files as a PR.  Do not push them to GitHub otherwise you will expose the passwords.\n\nIf copying the directory outright, change the old passwords before pushing to GitHub.\n\n\n- Generate the admin and secret keys:\n\n        bundle exec rake gen_secrets\n\n- Set the following Heroku Config Vars:\n\n    - `ADMIN_KEY` - find in `config/` after running `bundle exec rake gen_secrets`\n    - `SECRET_KEY` - find in `config/` after running `bundle exec rake gen_secrets`\n    - `TZ` - Set the app timezone.  See the `TZ` column in [the list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)\n    - `REDIS_URL` - Example: `redis://redistogo:abc123abc12381276e68463f5b9d4764@foo.redistogo.com:11442/`\n\n- Add the heroku remote if needed:\n\n        heroku git:remote -a chiscore1\n\n- Deploy the application:\n\n        git push heroku main\n        git push heroku db/nopr-2024:main\n\n## Usage Examples\n\n### Server\n\nStart redis:\n\n    docker-compose up -d redis\n    # or 'redis-server', etc\n\nStart the server:\n\n    bundle exec rackup\n\nRun the ruby unit test suite:\n\n    bundle exec rake\n\n### Client\n\nRun the frontend tests:\n\n    grunt spec\n\nCompile coffee and EJS templates:\n\n    grunt build\n\nWatch and compile coffee and EJS templates:\n\n    grunt watch\n\nClean:\n\n    grunt clean\n\n## Redis Operations\n\n### Restore\n\n___Caution: Destructive___\n\n    docker-compose up -d redis\n    docker cp dump.rdb $(docker-compose ps -q redis):/data/dump.rdb\n    docker-compose restart redis\n\n### Flush Redis DB\n\n___Caution: Destructive___\n\n    rake redis_flushdb # local\n    heroku run bundle exec rake redis_flushdb\n\n### Manually add a checkin\n\nGet timestamp from linux shell\n```\n$ date +%s\n1706169136\n```\n\nOpen redis console\n```\n$ redis_cli\n$ heroku redis:cli -a $app_name\n\n\u003e hset \"checkins:$login_id\" $team_id $timestamp\n\u003e hset \"checkins:6\" 1617 1706169136\n```\n\n## Export\n\nThe finish line checkpoint ID still has to be hard-coded; see `lib/chiscore/support/data_exporter.rb`, then look for `def finish_checkpoint` and update the integer ID to match the ID used for the finish line in `config/data/checkpoints.csv`.\n\n```bash\nYEAR=2018 OUTPUT=html SUMMARY=true rake export   # export nice HTML table lines\nYEAR=2018 OUTPUT=csv rake export                 # export all timing data from redis\n```\n\nRun the export from Heroku:\n\n```bash\nheroku run -a chiscore1 YEAR=2020 OUTPUT=html rake export\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchiditarod%2Fchiscore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchiditarod%2Fchiscore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchiditarod%2Fchiscore/lists"}