Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-settings.php on line 472

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-settings.php on line 487

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-settings.php on line 494

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-settings.php on line 530

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-includes/cache.php on line 103

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-includes/query.php on line 21

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-includes/theme.php on line 623

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/custom_posts/custom_posts.php on line 22

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/pukiwiki.php on line 46

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/pukiwiki.php on line 67

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/pukiwiki.php on line 75

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/pukiwiki.php on line 92

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/modPukiWiki/class/PukiWikiRender.php on line 70

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/modPukiWiki/class/PukiWikiElement.php on line 181

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/modPukiWiki/class/PukiWikiElement.php on line 538

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/modPukiWiki/class/PukiWikiElement.php on line 695

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/modPukiWiki/class/PukiWikiElement.php on line 1087

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112
gollum(githubのwikiエンジン)をサーバ (apache + passenger)で動かしたよメモ。 | おれせか
おれせか

なんかそれっぽいのをうにうに。


Deprecated: Function split() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/modPukiWiki/lib/func.php on line 75

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/modPukiWiki/plugin/ref.inc.php on line 207

github/gollum

まずはbundle installまで

プロジェクトのdirを適当につくってGemfileを作成。あとgit initもしとこう。

$ mkdir gollum
$ bundle init
$ git init

Gemfileを編集。

# A sample Gemfile
source "https://rubygems.org"

gem 'gollum'

# formats
gem 'redcarpet'
gem 'github-markdown'
gem 'wikicloth'

# capistranoとか
group :development do
  gem 'capistrano'
  gem 'capistrano-ext'
end

bundle installする

bundle install --path vendor/bundle

あ、そうそう、.gitignoreも適当につくっときましょう。

/.bundle
/vendor/bundle

とりあえずlocalでrackupできるとこまで。

config.ruをふわっと書く

#!/usr/bin/env ruby

require 'rubygems'
require 'gollum'
require 'gollum/frontend/app'

use Rack::ShowExceptions

Gollum::Page.send :remove_const, :FORMAT_NAMES if defined? Gollum::Page::FORMAT_NAMES
Gollum::Page::FORMAT_NAMES = {
  :markdown  => "Markdown",
  :mediawiki => "MediaWiki"
}

Precious::App.set(:gollum_path, repos_path)
Precious::App.set(:default_markup, :markdown) 
Precious::App.set(:wiki_options,  {universal_toc: true})

run Precious::App

rackup (ッターン!

$ bundle exec rackup
[2012-12-21 19:36:14] INFO  WEBrick 1.3.1
[2012-12-21 19:36:14] INFO  ruby 1.9.3 (2012-11-10) [x86_64-darwin11.4.2]
[2012-12-21 19:36:14] INFO  WEBrick::HTTPServer#start: pid=22609 port=9292

"localhost:9292"で確認できたよー。わーい。

よし。capistranoでdeployするぞう。

このままcap deployする方向ですすめるとdeployするたびにwikiのデータがぶっ飛ぶというダメwikiになってしまうので、wikiのデータ用のレポジトリは分けましょうそうしましょう。

config.ruで別レポジトリがなければ作る的な処理を追加。

#!/usr/bin/env ruby

require 'rubygems'
require 'gollum'
require 'gollum/frontend/app'

use Rack::ShowExceptions

# reposがなければ作ればいいじゃない
repos_path = File.join(Dir.pwd, 'wiki.git')
unless File.exists? repos_path
  Dir::mkdir(repos_path)
end
unless File.exists? File.join(repos_path, '.git')
  Grit::Repo.init(repos_path)
end

Gollum::Page.send :remove_const, :FORMAT_NAMES if defined? Gollum::Page::FORMAT_NAMES
Gollum::Page::FORMAT_NAMES = {
  :markdown  => "Markdown",
  :mediawiki => "MediaWiki"
}

Precious::App.set(:gollum_path, repos_path)
Precious::App.set(:default_markup, :markdown) 
Precious::App.set(:wiki_options,  {universal_toc: true})

run Precious::App

.gitignoreもちょっと修正

/.bundle
/vendor/bundle
/wiki.git
/public

んで、"capify ."して編集するなり、ゼロから書くなりでconfig/deploy.rbを用意。

#encoding: utf-8

# capistrano-ext
require "capistrano/ext/multistage"

# bundler
require "bundler/capistrano"
set :bundle_flags, "--deployment"

####################################################
# Application
####################################################
set :application, "gollum"
set :keep_releases, 5 # releasesに残すverの数


####################################################
# Deploy user
####################################################
set :use_sudo, false
default_run_options[:pty] = true 


#####################################################
# Git
#####################################################
set :scm, :git
set :scm_verbose, true
set :repository, "git+ssh://path/to/hoge.git"

####################################################
# Task
####################################################
namespace :deploy do
  after 'deploy:setup' do
    sudo "chmod -R o+w #{deploy_to}"
    run "mkdir -m 777 #{shared_path}/wiki.git"
  end

  after 'deploy:create_symlink' do
    run <<-CMD
      cd #{release_path};
      rm -fr #{release_path}/public &&
      ln -nfs `bundle show gollum`/lib/gollum/frontend/public/gollum #{release_path}/public
    CMD
    run <<-CMD
      rm -fr #{release_path}/wiki.git &&
      ln -nfs #{shared_path}/wiki.git #{release_path}/wiki.git
    CMD
  end

  task :start, :roles => :app do
    run "touch #{current_release}/tmp/restart.txt"
  end

  task :stop, :roles => :app do
  end

  desc "Restart Application"
  task :restart, :roles => :app do
    run "touch #{current_release}/tmp/restart.txt"
  end

  # restart後にcleanup
  after "deploy:start", "deploy:cleanup"
  after "deploy:restart", "deploy:cleanup"
end

特に必要性ないけどいつものかんじでcapistrano-ext使ってるのでconfig/deploy/**.rbもつくる。とりあえず今回はproduction.rbにするべ。

#encoding: utf-8

####################################################
# Application
####################################################
set :deploy_to, "/path/to/dir" #deploy先
set :rails_env, 'production' # いらんかも

#####################################################
# Servers
######################################################
server 'hoge.net', :web, :app
role :db,  "#{roles[:app].first}", :primary => true

#####################################################
# Git
#####################################################
set :branch, 'master'

で、ひとまずdeployはまだ置いておいてサーバのほうの設定しましょう

apacheとpassengerをすでに入ってるってことでインスコとかの説明割愛。

apacheの設定にごにょごにょ追加。

<VirtualHost *:80>
    ServerName wiki.hoge.net

    ErrorLog logs/wiki_error_log
    CustomLog logs/wiki_access_log combined

    DocumentRoot /path/to/dir/gollum/current/public
    <Directory "/path/to/dir/gollum/current/public">
        Options FollowSymLinks -Includes -ExecCGI -Indexes -MultiViews
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>

    RackBaseURI /
    RailsEnv production
</VirtualHost>

んでapache再起動

$ sudo apachectl restart

よっしゃーdeployだー

初回だけまずは必要なdirやらfile作成

$ bundle exec cap production deploy:setup

問題なくsetup完了したらコードをポポポポーン。
あ、もちろんココまでに適宜gitにcommitはしててremoteにpushまで済んでるってことで。

$ bundle exec cap production deploy

わーい。できたよー。

PAGETOP
PAGETOP

Prev / Next in same category

PAGETOP

Comments (14)

十年前、あなたはあなたが他の誰かが重要ではないと昨日も、アール年前誰が、重要なのは、あなたが誰であるか、誰であり、あなたがなる明日、。

[2013/01/30 (水) 12:19]

私はあなたの記事を見てとても幸せです。

[2013/03/13 (水) 12:26]

自責の念が重要例示預金をもたらし

[2013/06/06 (木) 15:22]

Perfectly indited subject material, thank you for information. “In the fight between you and the world, back the world.” by Frank Zappa.
jack wills outlet http://spicesassociation.com/jackwillsoutlet.html

[2014/04/11 (金) 16:04]

My husband and i were thrilled when Ervin could deal with his basic research out of the ideas he was given through the site. It is now and again perplexing to simply always be freely giving tactics that some others could have been trying to sell. And we all keep in mind we have got the blog owner to thank for that. All the illustrations you’ve made, the straightforward site navigation, the friendships your site make it possible to instill - it is all excellent, and it is letting our son and the family recognize that this theme is satisfying, which is truly vital. Many thanks for all!

[2014/04/12 (土) 11:27]

プロジェクトのdirを適当につくってGemfileを作成。あとgit initもしとこう。

[2015/09/16 (水) 12:42]

赤くて緑の色合わせシャネル激安は自動的に鎖の腕時計に行って1人似通って見聞、
サンタクロースに富を極めて、
シャネル激安http://www.cctoh.com/

最も敬虔な祝福を使って祝いの贈り物をします楽しいクリスマスの時間。
シャネル眼鏡
シャネル腕時計
シャネルピアス
シャネル財布
シャネル靴
シャネルバッグ
シリーズの腕時計は皆賭博の世界の濃厚な息を含んで、
シャネルの時計の文字盤設計の格調をまねるのが鮮明で、
モナコ観光名所の蒙特ka羅の独特な個性を反映します。

[2015/11/19 (木) 00:12]

It is now and again perplexing to simply always be freely giving tactics that some others could have been trying to sell.

[2015/11/23 (月) 17:36]

bundle exec rails g migration add_max_attempts_to_delayed_jobs max_attempts:integer

[2016/01/06 (水) 17:43]

It is now and again perplexing to simply always be freely giving tactics that some others could have been trying to sell.

[2016/01/07 (木) 10:47]

アイブ氏は前に自分のものを読んで、あなたはあまりにも素晴らしい。

[2016/01/15 (金) 17:35]

動かしたよメモ。

[2016/07/08 (金) 09:31]

, if the mind is too long directed Training Pas Cher to one object Cheap New Balance 997.5 Shoes only, Training Pas Cher it will get stiff and rigid, and unable to take in many interests,’ said Margaret.‘I do not quite understand what you mean by a mind getting stiff and rigid. Nor do I admire tho Cheap Jordan 18 Shoes se whirligig characters that are full of this thin

[2017/09/29 (金) 18:31]

lls were Zapatillas Nike Zoom Hyperchaos close Maillot Suède Pas Cher d. I hardly know whether it will interest any one to learn that something under half a million yards of calico are here printed annually. At the Lowell Bleachery fifteen million yards are dyed annually. Maillot Algérie Pas Cher The Merrimack Cotton Mills were stopped, and so had the other mills at Lowell been

[2017/09/29 (金) 18:32]
PAGETOP

Comment Form

PAGETOP

Trackbacks (1)

gregory グレゴリー ハードテイル

gollum(githubのwikiエンジン)をサーバ (apache + passenger)で動かしたよメモ。 | おれせか

PAGETOP

Trackback URL

PAGETOP

Search