スポンサーリンク

Redmine3.2をHerokuにデプロイ

以前は、openshift無料枠にRedmine3.2をインストールして使っていた。

http://twosquirrel.mints.ne.jp/?p=10904

https://tigefa.space/articles/03-01-2014-deploy-redmine-on-opensift-with-ssh.html

openshift無料枠にインストールするのもなかなか難しかったが、無料枠は1か月で強制終了なので、Herokuにインストールしたくなった。

全部で6時間くらいかかった気がする。

(環境)
Windows8.1
VirtualBox 5.0.20
Vagrant 1.8.1
CentOS7.2
Ruby 2.2,3
Rails ?
Redmine 3.2?

(参考)

HerokuにRedmineをデプロイする方法
ihatov08 2016年07月15日に更新
http://qiita.com/ihatov08/items/a4e7b299486b90bd170a

→だいたい、これに従えっていけばできるのであるが、2016/11/21現在、config/secrets.yml が.gitignore に設定されていて、がちゃがちゃsecrets.ymlを変更したのち、わざわざ、.gitignoreから、「config/secrets.yml」の行を消去してから、再度、herokuにデプロイした。

Redmine 3.2をCentOS 7.1にインストールする手順
2015-12-07 13:19
http://blog.redmine.jp/articles/3_2/install/centos/

production環境でsecret_tokenをセットする(rails)
takusemba 2016年06月12日に更新
http://qiita.com/takusemba/items/2ad25d3d0a007757c194

更新日: 2014年9月1日Rails
Rails が production 環境で真っ白、SECRET_KEY_BASE 設定忘れが原因でした
http://easyramble.com/rails-secret-key-base-env.html

GitHub 初心者による GitHub 入門(2)〜 status みて add して commit して push したい 〜
megu_ma 2015年02月14日に投稿
http://qiita.com/megu_ma/items/03388e1979b3fc0539f7

(1)ローカル環境(Windows8.1)に、vagrantでCentOS7.2のインストール。さらに、rubyをインストールして、redmine(20161121時点)をインストール

http://qiita.com/Gin326M/items/01c8aef45f9a55b9b028
参考

cd c:/vm
mkdir redmine
cd redmine

vagrant init bento/centos-7.2
vagrant up

PuTTYでログイン
127.0.0.1
2222
vagrant
vagrant

sudo yum -y update
sudo yum -y install git gcc make openssl-devel zlib-devel readline* gcc-c++
sudo yum -y install epel-release
sudo yum -y install nodejs
sudo yum -y install sqlite-devel
rubyのインストール

git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
echo ‘export PATH=”$HOME/.rbenv/bin:$PATH”‘ >> ~/.bash_profile
echo ‘eval “$(rbenv init -)”‘ >> ~/.bash_profile
. ~/.bash_profile
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
rbenv install -l
rbenv install -v 2.2.3

rbenv rehash
rbenv global 2.2.3

gem install bundler –no-rdoc –no-ri

 

「RSA」鍵の作成
http://www.server-memo.net/server-setting/ssh/centos-createkey.html

ssh-keygen -t rsa -b 2048

http://twosquirrel.mints.ne.jp/?p=10794

ssh -V
ls -a ~/.ssh
ssh-keygen
(誘導にしたがってパスワードを入力)
ls -a ~/.ssh

cat ~/.ssh/id_rsa.pub

で出てくる文字列をコピーして、Bitbucketにログインして、
BitbucketにSSHキー登録画面で登録

https://bitbucket.org/ にログインして(すでにログインしているかもしれないが)、
Dashboard 画面で、リポジトリ > リポジトリの作成
redmineのインストール
http://qiita.com/ihatov08/items/a4e7b299486b90bd170a

http://blog.techium.jp/entry/2016/11/18/232910

sudo yum -y install postgresql-devel
sudo yum -y install postgresql-server

sudo yum -y install imagemagick imagemagick-devel
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
sudo yum py install ImageMagick

結局、どうしても、rmagickをインストールできず、Gemfile.lockが作成されず、
先に進めない。調べてみると、rmagickなんて私には不要。
ということでrmagickはあきらめる。

Gemfileの中を、以下のようにコメントアウト
#  group :rmagick do
#    gem “rmagick”, “>= 2.14.0”
#  end

bundle install
git init
git add .
git commit -m “initialize repository”
git remote add origin git@bitbucket.org:xxxxxxxxxxxxx/helloexpress.git
git push -u origin –all
(パスワードを入力)
(3)2回目以降は、

git add .
git commit -m “xxxxxxxxxxx”
git push -u origin ?all

http://qiita.com/kaishero/items/777323c4ec8f9fd425f9

$ sudo wget -qO- https://toolbelt.heroku.com/install.sh | sh
$ echo ‘PATH=”/usr/local/heroku/bin:$PATH”‘ >> .bash_profile
$ source .bash_profile
$ heroku version
$ heroku login
Enter your Heroku credentials.
Email: メールアドレス
Password (typing will be hidden): パスワード

heroku create [NAME]

heroku addons:add heroku-postgresql

$ git add .
$ git commit -am “make it better”
$ git push heroku master

heroku run rake db:migrate RAILS_ENV=production

heroku restart

http://qiita.com/kaishero/items/777323c4ec8f9fd425f9
$ sudo wget -qO- https://toolbelt.heroku.com/install.sh | sh
$ echo ‘PATH=”/usr/local/heroku/bin:$PATH”‘ >> .bash_profile
$ source .bash_profile
$ heroku version
$ heroku login
Enter your Heroku credentials.
Email: メールアドレス
Password (typing will be hidden): パスワード

ここで、config/secret.yml がなんたらのエラー

.gitignore から、 /config/secrets.yml を消去。

http://qiita.com/takusemba/items/2ad25d3d0a007757c194

なぜか、毎回、heroku-toolbeltをインストールしないとheroku loginできない

$ heroku addons:add heroku-postgresql
$ git add .
$ git commit -am “make it better”
$ git push heroku master
$ heroku run rake db:migrate RAILS_ENV=production
heroku run rake redmine:load_default_data RAILS_ENV=production
heroku restart

やったー!

image

(2)admin, adminでログインして、パスワードの変更。

Redmineを使い始めるための設定
http://redmine.jp/tech_note/first-step/admin/

を見ながら、適宜設定。

http://redmine.jp/faq/administration/require-auth/

スポンサーリンク