The tech tracker is a specialized web application used internally by Carnegie Mellon University's Activities Board Technical Committee. Its major features are event planning/organization, incoming email management, financial tracking, and membership management (including payroll and timecard generation). It was originally written in ~2003 in perl-style Rails 1.x, and through the years has been taken over and upgraded by various techies.
The current version of Tracker uses Ruby 2.7.5 and Rails 6.1.7. The OS sendmail is used for sending emails, and Sphinx is used for searching events.
Work on large new features should be done in branches and/or forks; smaller changes can be done in master
. The production
branch should always be deployable.
A Devise configuration file is required for the membership model. One can be generated with the command rails g devise Member
. The generated configuration (and therefore, the membership data in the database) may not be compatible with production Tracker. If using a copy of the production database, this may mean you will either have to edit some records with rails c
to allow you to log in, or request a copy of the production Devise configuration file. See setup instructions below.
You must install Sphinx if you wish to use the event search feature. You can then generate an index by running the command rails ts:index
on the server.
You must install and configure a sendmail provider if you wish to send emails from Tracker.
rbenv install
gem install bundler
(ensure this runs in your rbenv environment)rbenv rehash
RAILS_ENV=development bundle install
rbenv rehash
EDITOR=nano ../rbenv/shims/bundle exec rails credentials:edit
. If you want to test out email or Slack integrations, then copy in the example at config/credentials/credentials.example.yml and update the values for your specific instance.yarn install
RAILS_ENV=development rails assets:precompile
abtt_development_master
and abtt_test
. Use an existing user or create a new user and give it access to these databases. Update config/database.yml
to match your local install for both the development
and test
environments. Be sure not to commit this file with your specific environmental changes.RAILS_ENV=development rails db:schema:load
RAILS_ENV=development rails db:seed
RAILS_ENV=development rails c
Member.create(namefirst: "Sam", namelast: "Abtek", email: "abtech@andrew.cmu.edu", phone: "5555555555", password: "password", password_confirmation: "password", payrate: 0.0, tracker_dev: true)
exit
RAILS_ENV=development puma
The intended directory structure is as follows. /srv/abtech-tracker
may be moved anywhere if you override the systemd service/socket files, and the production-01
and staging-01
may be any name (these are the instance names).
/srv
├── abtech-tracker
│ ├── production-01
│ │ ├── corepack
│ │ ├── pids
│ │ ├── rbenv
│ │ ├── repo
│ │ ├── run
│ │ └── tracker.env
│ └── staging-01
│ ├── corepack
│ ├── pids
│ ├── rbenv
│ ├── repo
│ ├── run
│ └── tracker.env
production-01
) and create the above directory path. Clone into the repo
folder and change to that directory.tracker.env
to the parent of repo
. Change any variables inside that need to be changed.repo
directory as root: set -o allexport; source ../tracker.env; set +o allexport
rbenv install
../rbenv/shims/gem install --no-document bundler
rbenv rehash
deploy-abtech-tracker
. This user does not need sudo
, a home folder, or a default shell.deploy-abtech-tracker
authenticated via UNIX socket. Create a database abtech_tracker_<instance name>
. Grant all permissions on the database to the user.deploy-abtech-tracker
user: sudo -u deploy-abtech-tracker
/bin/bashset -o allexport; source ../tracker.env; set +o allexport
../rbenv/shims/bundle config set --local deployment 'true'
../rbenv/shims/bundle install
EDITOR=nano ../rbenv/shims/bundle exec rails credentials:edit --environment production
(or staging) and make sure it looks right. Ensure it is up to date with the example at config/credentials/example.yml.../rbenv/shims/bundle exec rails db:environment:set RAILS_ENV=production
../rbenv/shims/bundle exec rails db:create
(may already exist)../rbenv/shims/bundle exec rails db:schema:load
../rbenv/shims/bundle exec rails db:seed
yarn install
../rbenv/shims/bundle exec rails assets:precompile
../rbenv/shims/bundle exec rails ts:index
../rbenv/shims/bundle exec rails c
Member.create(namefirst: "Sam", namelast: "Abtek", email: "abtech@andrew.cmu.edu", phone: "5555555555", password: "password", password_confirmation: "password", payrate: 0.0, tracker_dev: true)
exit
root
:
systemctl enable abtech-tracker@production-01.socket abtech-tracker@production-01.service abtech-tracker-ts@production-01.service abtech-tracker-email-idle@production-01.service abtech-tracker-ts-index@production-01.timer abtech-tracker-slack-notify@production-01.timer
root
:
systemctl start abtech-tracker-ts@production-01.service abtech-tracker@production-01.socket abtech-tracker@production-01.service abtech-tracker-email-idle@production-01.service
Tracker includes a rake task called email:idle
which will connect to a Gmail account and continuously pull email from it in the background. To do so, you need to get a client ID/secret from Google, and generate a refresh token for the Gmail account you want to authenticate with. Note: if you do not use the email:idle
task, the following instructions are unnecessary.
python oauth2.py --generate_oauth2_token --client_id=CLIENT_ID --client_secret=CLIENT_SECRET
Make sure to replace CLIENT_ID and CLIENT_SECRET with the appropriate values.
credentials:edit
task in the development and deployment instructions above). An example can be found at config/credentials/example.yml.