LoginSignup
2
0

More than 5 years have passed since last update.

Redmine 2.0 を Red Hat OpenShift にデプロイする

Last updated at Posted at 2018-06-10

[!NOTE]
この記事は 2013/08/24 に momoto.github.io へ投稿した内容を Qiita へ移行してきたものです

 Red Hat OpenShift にプロジェクト管理ソフトウェアの Redmine 2.0 をデプロイします。 rhcredmine-2.0-openshift-quickstart を使用しています。あらかじめ OpenShift のアカウントを作成している必要があります。

1. Ruby 1.9 のアプリケーションを作成する

 rhc app create でアプリケーションを作成します。 -a にはアプリケーション名、-t にはウェブカートリッジを指定します。

$ rhc app create -a redmine -t ruby-1.9
Application Options
-------------------
  Namespace:  momoto
  Cartridges: ruby-1.9
  Gear Size:  default
  Scaling:    no

Creating application 'redmine' ... done

Waiting for your DNS name to be available ... done

Cloning into 'redmine'...
Checking connectivity... done

Your application 'redmine' is now available.

  URL:        http://redmine-momoto.rhcloud.com/
  SSH to:     *
  Git remote: *
  Cloned to:  ~/Workspace/redmine

Run 'rhc show-app redmine' for more details about your app.

 アプリケーションの作成と同時に Git リポジトリがローカルにクローンされています。

2. MySQL Database 5.1カートリッジを追加する

 rhc cartridge add で MySQL Database 5.1 アドオンカートリッジを追加します。追加できるカートリッジは rhc cartridges または rhc cartridge list で確認できます。

$ rhc cartridge add -a redmine -c mysql-5.1
Adding mysql-5.1 to application 'redmine' ... done

mysql-5.1 (MySQL Database 5.1)
------------------------------
  Gears:          Located with ruby-1.9
  Connection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/
  Database Name:  *
  Password:       *
  Username:       *

MySQL 5.1 database added.  Please make note of these credentials:
       Root User: *
   Root Password: *
   Database Name: *
Connection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/
You can manage your new MySQL database by also embedding phpmyadmin-3.4.
The phpmyadmin username and password will be the same as the MySQL credentials above.

3. redmine-2.0-openshift-quickstart を併合する

  1. OpenShiftからクローンしたローカルリポジトリにワーキングディレクトリをうつします
  2. GitHub の redmine-2.0-openshift-quickstart を upstream としてリモートリポジトリに追加します
  3. ローカルリポジトリに upstream を併合します(MERGE STRATEGYはrecursive、recursive strategyのオプションはtheirs)

 もし、OpenShift からリポジトリをクローンしなおす場合は rhc git-clone <app> をつかいます。

$ cd redmine/
$ git remote add upstream -m master git://github.com/openshift/redmine-2.0-openshift-quickstart.git
$ git pull -s recursive -X theirs upstream master
warning: no common commits
remote: Counting objects: 2003, done.
remote: Compressing objects: 100% (1725/1725), done.
remote: Total 2003 (delta 300), reused 1897 (delta 199)
Receiving objects: 100% (2003/2003), 4.06 MiB | 272.00 KiB/s, done.
Resolving deltas: 100% (300/300), done.
From git://github.com/openshift/redmine-2.0-openshift-quickstart
 * branch            master     -> FETCH_HEAD
Auto-merging config.ru
Auto-merging README.md
Auto-merging .openshift/cron/weekly/jobs.allow
Auto-merging .openshift/cron/README.cron
...

4. OpenShift にデプロイする

 redmine-2.0-openshift-quickstart と併合したローカルリポジトリを OpenShift のリモートリポジトリ(origin)に更新します。

$ git push origin master
Counting objects: 2011, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (1625/1625), done.
Writing objects: 100% (2001/2001), 4.06 MiB | 1.58 MiB/s, done.
Total 2001 (delta 307), reused 1989 (delta 300)
remote: Stopping Ruby cart
remote: Running build on Ruby cart
remote: Bundling RubyGems based on Gemfile/Gemfile.lock to repo/vendor/bundle with 'bundle install --deployment'
remote: Fetching gem metadata from http://rubygems.org/.........
...

 git push の処理が終わったら、ウェブブラウザからアプリケーションの URL へアクセスして動作を確認します。アプリケーションの URL は rhc show-app <app> からも確認できます。

redmine-home.png

 OpenShift では Redmine のほか、Django、CakePHP、WordPress 3.x などのクイックスタートが用意されています。

参考

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0