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:
- some OpenShift hooks for deployment, copied from openshift-redmine-quickstart and updated for PostgreSQL
- cronjob to sync git repos: https://github.com/theforeman/redmine/blob/master/.openshift/cron/hourly/git_repos
- Gemfile.lock. To update, run a bundle install locally,
mv Gemfile.lock Gemfile.lock.ruby-1.9and commit
- plugins added as submodules under https://github.com/theforeman/redmine/tree/master/plugins
- redmine_backlogs is a fork of upstream with unmerged fixes
- e-mail configuration using mailgun.com, under config/configuration.yml (password set via an app environment variable)
- a few local customisation commits
This should be kept up to date from the Redmine project by merging in upstream/master on a regular basis.
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".
rhc app stop redmine -n theforeman
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
- Check the new hostname responds correctly, should Just Work
rhc alias remove redmine projects.theforeman.org -n theforeman
rhc alias add redmine2 projects.theforeman.org -n theforeman
- Update DNS for projects.theforeman.org to point to the new hostname
- SSH to the new gear and run:
rm -rf app-root/data/git(app cloning excludes the .git directories from our repo clones, which breaks git pulls)
psql(to update the paths to the repos, change the replaces below to use the old & new gear IDs)
update repositories set url=replace(url, '53ac48334382ec1efd000078', '53b3ba3fe0b8cd33ee000463');
update repositories set root_url=url;
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)
- 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)
- Created a new Large Ruby 1.9 gear
- Do not fill in the Git Repo box - the redmine repo is huge and gear creation will time out
- Add an additional 3GB storage (4GB total)
- Add the postgres and cron cartridges
- use "rhc env set EMAIL_PASSWORD='redacted' -n theforeman -a redmine4" to set the email route up
- Restore the db
- From the Foreman Puppetmaster, go to /srv/backups/redmine and get the latest backup of the redmine sql file
- SCP to the gear
- log in to the gear, and use "psql ; \i <file>" to restore the backup
- Restore the contents of app-root/data/files/ for attachments etc.
- Push the code
- git clone theforeman/redmine
- add the openshift remote
- git push -f openshift HEAD
- Update alias / repo urls / dirvish backups as above