After Monolith Improvements, we should consider whether to deprecate this guide. If we keep it, this page needs some formatting cleanup.
This guide describes how to run the website using Rails’s rails server
command instead of Docker. Note that Docker is the recommended method - only use this guide if you have a specific reason for using it.
Run the Server with Rails
- Ensure you have the correct Ruby version installed. We recommend using a Ruby version manager like rvm or rbenv. They should both read the
.ruby-version
file to use the correct version (rvm current
orrbenv version
to confirm). - Ensure Bundler 2 is installed
- To update from bundler 1:
gem update --system bundle update --bundler
- Or, if you haven’t installed bundler previously:
gem update --system gem install bundler
- To update from bundler 1:
- Set up git pre-commit hook. Optional, but very useful.
(cd WcaOnRails; bundle install && bin/yarn && bundle exec overcommit --install)
If some changes are made to this hook, you will have to update it running this command from the repository’s root directory:
BUNDLE_GEMFILE=WcaOnRails/Gemfile bundle exec overcommit --sign
. - Install MySQL 8.0, and set it up with a user with username “root” with an empty password. If it poses problems, try the following:
# Run MySQL CLI as administrator and set an empty password for the root user: sudo mysql -u root ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '';
- Install dependencies and load development database.
cd WcaOnRails/
- Install Node.js and yarn, we need them for our javascript assets. Feel free to take a look at our chef recipe for the accurate versions we use and how we install them. Please note that other versions may work, but it is not guaranteed.
- Install
libyaml
using your package manager of choice, eg. Mac or Ubuntu bundle install && bin/yarn
bin/rake db:load:development
- Download and import the developer’s database export. Depending on your computer it may take a long time. Alternatively you can runbin/rake db:reset
which will create the database and seed it with random data (it’s way faster, but less representative of our website content).bin/rails server
- Run rails. The server will be accessible at localhost:3000
- Run tests.
RAILS_ENV=test bin/rake db:reset
- Set up test database.RAILS_ENV=test bin/rake assets:precompile
- Compile some assets needed for tests to run.bin/rspec
- Run tests.
- Mailcatcher is a good tool for catching emails in development.