Skip to content
Vera Clemens edited this page Jun 18, 2018 · 12 revisions

Refer to

for guidance on setting the project up.

Important notes

Test coverage

This project uses the simplecov gem which generates a coverage report each time an RSpec run is completed. The report shows how often each line of code in every file is hit by the tests. Ideally, they should all be hit at least once to make sure the tests are able to catch as many mistakes as possible. The test coverage report can be found at coverage/index.html.

Troubleshooting: Logs and restarting the server

Unicorn can be restarted using the command /etc/init.d/unicorn_hpi-career_production restart. Nginx can be restarted using the command /etc/init.d/nginx restart. The most important logs can be found at /var/logs/nginx/error.log and /var/www/hpi-career/current/log/unicorn.log.

Important: The SECRET_KEY_BASE environment variable needs to be set for Unicorn to function correctly. If, for some reason, it becomes unset, the page will display an error message and unicorn.log will show that SECRET_KEY_BASE is missing. The following fix works:

  1. /etc/init.d/unicorn_hpi-career_production stop
  2. export SECRET_KEY_BASE=... (A secret key can be generated with bundle exec rake secret, for example.)
  3. /etc/init.d/unicorn_hpi-career_production start

This causes a short downtime, but is unavoidable, as Unicorn retains its environment variables during hot restarts (using restart). For it to pick up new environment variables, it needs to be shut down fully and started again.

Keeping gems up-to-date

These commands need to be run locally (not on the server).

Step 1: Run bundle update to update all gems as far as the Gemfile allows. This will update Gemfile.lock.

Step 2: Run all tests and check if anything stopped working.

Step 3: If everything is fine, commit and push all changes. The next time the project is deployed, Capistrano will automatically update the gems on the server.

Keeping Ruby up-to-date

This project uses Ruby Version Manager (RVM) to manage the current Ruby version. All of the following commands need to be executed on the server.

Step 1: (Not always needed) If the currently installed version of RVM is out of date, it should be updated.

\curl -sSL https://get.rvm.io | sudo bash -s stable
rvm reload

Step 2: Update to the newest available Ruby version and set it as default.

rvm install 2.x
rvm --default use 2.x

Step 3: Copy the gemset.

rvm gemset copy <previous_version> <new_version>

Done!

Clone this wiki locally