Redmine

Deployment

Redmine is deployed on OpenShift Online, as redmine-theforeman, updates can be pushed as usual to the OpenShift git remote to deploy. It uses the Ruby 1.9 and PostgreSQL 9.2 gears.

A copy of the git repository is stored here: https://github.com/theforeman/redmine/. Please ensure the OpenShift and GitHub repos remain in sync.

The repository is a copy of Redmine's master branch with the following changes:

This should be kept up to date from the Redmine project by merging in upstream/master on a regular basis.

Moving gears

It's possible to move the app from one gear to another if you need to resize it or similar. This is done by taking the app offline and cloning it to a new gear.

This example moves it from "redmine" to "redmine2".

  1. rhc app stop redmine -n theforeman
  2. rhc create-app redmine2 --from-app redmine --gear-size large -n theforeman
    • Needs rhc 1.22.3 or higher
    • Very network intensive, as it downloads the whole app locally (~1GB) and uploads again
  3. Check the new hostname responds correctly, should Just Work
  4. rhc alias remove redmine projects.theforeman.org -n theforeman
  5. rhc alias add redmine2 projects.theforeman.org -n theforeman
  6. Update DNS for projects.theforeman.org to point to the new hostname
  7. SSH to the new gear and run:
    1. rm -rf app-root/data/git (app cloning excludes the .git directories from our repo clones, which breaks git pulls)
    2. psql (to update the paths to the repos, change the replaces below to use the old & new gear IDs)
      1. update repositories set url=replace(url, '53ac48334382ec1efd000078', '53b3ba3fe0b8cd33ee000463');
      2. update repositories set root_url=url;
  8. rhc env set EMAIL_PASSWORD='redacted' -n theforeman -a redmine2 && rhc app stop redmine2 -n theforeman && rhc app start redmine2 -n theforeman (workaround for rhc BZ#1115386)
  9. Log into Foreman, update the dirvish class, change the SSH URL to the new gear

GitHub OAuth plugin

redmine_omniauth_github is installed to permit users to authenticate using GitHub via OAuth. This is registered with an application under our theforeman GitHub organisation, where admins can revoke tokens etc.

New Gear from Scratch

On 14/07/14 the redmine2 instance disappeared without warning. Below is a log of what Greg Sutcliffe did to spin up a new instance (instead of moving it as above, which was no longer possible)

  1. Created a new Large Ruby 1.9 gear
    1. Do not fill in the Git Repo box - the redmine repo is huge and gear creation will time out
    2. Add an additional 3GB storage (4GB total)
  2. Add the postgres and cron cartridges
  3. use "rhc env set EMAIL_PASSWORD='redacted' -n theforeman -a redmine4" to set the email route up
  4. Restore the db
    1. From the Foreman Puppetmaster, go to /srv/backups/redmine and get the latest backup of the redmine sql file
    2. SCP to the gear
    3. log in to the gear, and use "psql ; \i <file>" to restore the backup
  5. Restore the contents of app-root/data/files/ for attachments etc.
  6. Push the code
    1. git clone theforeman/redmine
    2. add the openshift remote
    3. git push -f openshift HEAD
  7. Update alias / repo urls / dirvish backups as above