無料で自分専用CMSを運用する方法(OctoPress + OpenShift編)


前提(環境)

  • 自分の手元
    • Mac
  • Web
    • OpenShift

準備

  • OpenShiftのSignUp
  • gem install rhc しておく(自分の手元)
    • installの初期セットアップでOpenShiftとのSSH設定も行われる

手順

  • OpenShiftでの作業

    1. Ruby1.9.3以上を作成する
    2. Application画面の右下に出ている"SourceCode"の下にある ssh:〜 をコピーしておく
  • 手元の作業

    1. 好きなフォルダーを作る
    2. git clone git://github.com/imathis/octopress.git octopress && cd octopress
    3. sudo gem install bundler
    4. rbenv rehash
    5. bundle install
    6. rake install
    7. cd ..
    8. mkdir _deployment && cd _deployment
    9. cp ../octopress/config.ru .
    10. cp ../octopress/Gemfile .
    11. bundle install
    12. mkdir public/
    13. git init .
    14. git remote add openshift URI ここで指定するURIはOpenShiftの2.の作業のURI
    15. git add .
    16. git commit -am 'initial deploy'
    17. cd ..
    18. mv _deployment octopress
    19. cd octopress
    20. Rakefileの内容をRakefile@gistで上書きし、保存
    21. git add _deployment/
    22. rake new_post['Hello World']
    23. 22.で作成したファイルを編集し、保存する
    24. rake generate
    25. rake gen_deploy

簡単な操作方法

記事の作成

  1. rake new_post['title']

記事の内容を確認

  1. rake preview
  2. http://localhost:4000にアクセス

記事をOpenShiftにアップロード

  1. rake gen_deploy

参考サイト