Skip to content

Instantly share code, notes, and snippets.

@tamoot
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tamoot/c2dcc69cff69bc5b8017 to your computer and use it in GitHub Desktop.
Save tamoot/c2dcc69cff69bc5b8017 to your computer and use it in GitHub Desktop.
puma+apacheでtdiary最新版を動かす方法(2015/01)
1) git clone
pwd
/home/tamoot/workspace/github
git clone https://github.com/tdiary/tdiary-core.git
Cloning into 'tdiary-core'...
remote: Counting objects: 16775, done.
remote: Total 16775 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (16775/16775), 4.56 MiB | 254.00 KiB/s, done.
Resolving deltas: 100% (11363/11363), done.
Checking connectivity... done.
git clone https://github.com/tdiary/tdiary-contrib.git
Cloning into 'tdiary-contrib'...
remote: Counting objects: 4839, done.
remote: Compressing objects: 100% (36/36), done.
remote: Total 4839 (delta 13), reused 0 (delta 0)
Receiving objects: 100% (4839/4839), 1.46 MiB | 259.00 KiB/s, done.
Resolving deltas: 100% (2573/2573), done.
Checking connectivity... done.
git clone https://github.com/tdiary/tdiary-theme.git
Cloning into 'tdiary-theme'...
remote: Counting objects: 7832, done.
remote: Total 7832 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (7832/7832), 6.17 MiB | 275.00 KiB/s, done.
Resolving deltas: 100% (3311/3311), done.
Checking connectivity... done.
ls
tdiary-contrib tdiary-core tdiary-theme
2) core側でごにょごにょ
cd tdiary-core/js
pwd /home/tamoot/workspace/github/tdiary-core/js
ln -s ../../tdiary-contrib/js/* .
cd ../theme
pwd
/home/tamoot/workspace/github/tdiary-core/theme
ln -s ../../tdiary-theme/* .
3) tdiary.conf作成
pwd
/home/tamoot/workspace/github/tdiary-core
cp tdiary.conf.sample tdiary.conf
プラグインのパスは以下のように書いておく(慣れた人ならお手の物
@options['sp.path'] = [
'/home/tamoot/workspace/github/tdiary-core/misc/plugin',
'/home/tamoot/workspace/github/tdiary-contrib/plugin',
]
load_cgi_conf
4) Gemfile.localを作成
pwd
/home/tamoot/workspace/github/tdiary-core
cat Gemfile.local
source 'https://rubygems.org'
gem 'puma'
5) config.ru を変更
cat config.ru
$:.unshift( File.join(File::dirname( __FILE__ ), 'lib' ).untaint )
require 'tdiary/application'
use ::Rack::Reloader unless ENV['RACK_ENV'] == 'production'
base_dir = '/sample' # 任意
run TDiary::Application.new( base_dir )
6) bundle installとrake assets:copy
pwd
/home/tamoot/workspace/github/tdiary-core
rbenv local 2.2.0
rbenv exec bundle install --without test development
rbenv exec rake assets:copy
7) htpasswd作成
pwd
/home/tamoot/workspace/github/tdiary-core
htpasswd -c .htpasswd tamoot
New password:
Re-type new password:
Adding password for user tamoot
8) puma設定ファイル
pwd
/home/tamoot/workspace/github/tdiary-core
cat puma_config.rb
#!/usr/bin/env puma
application_path = "#{File.expand_path('../', __FILE__)}"
environment "production"
state_path "#{application_path}/tmp/puma.state"
pidfile "#{application_path}/tmp/pids/puma.pid"
stdout_redirect "#{application_path}/tmp/logs/puma.stdout.log", "#{application_path}/tmp/logs/puma.stderr.log"
bind "tcp://127.0.0.1:3001"
threads 0, 10
9) 起動、停止
cd /home/tamoot/workspace/github/tdiary-core
rbenv exec bundle exec pumactl -F puma_config.rb start &
rbenv exec bundle exec pumactl -F puma_config.rb stop
10) apacheでreverse proxy
ProxyPass /sample/ http://127.0.0.1:3001/sample/
ProxyPassReverse /sample/ http://127.0.0.1:3001/sample/
11) その他メモ
rssプラグイン、絵日記プラグインは特にtdiary.confでの設定不要。tdiary-core/public配下で参照される。
@tdtds
Copy link

tdtds commented Jan 6, 2015

clone済みcontribへのパスをGemfile.localで指定することで、jsのsymlinkを貼る作業がいらなくなりませんかね?

@tamoot
Copy link
Author

tamoot commented Jan 6, 2015

試してみたところ、jsのsymlink作業は不要になりました。

tdiary-contrib側のGemfileに記載されたgem "tdiary"の記述によって、bundler側にtdiaryのgemがインストールされましたが、うまく動きました。

試しに 自分でgit cloneしたほうの lib/tdiary/version.rbの値を4.1.1.1にしてみたところ、各所に反映されていたので、開発環境を兼ねて動作させる目的は果たしていたかな?と思っております。

@machu
Copy link

machu commented Jan 6, 2015

CSSやJavaScriptもRackサーバ側で返すのであれば、rake assets:copyは無くても動くはずです。
public以下をWebサーバで返すときに使うコマンドだった気がします。

@tamoot
Copy link
Author

tamoot commented Jan 9, 2015

確かにrake assets:copy無しで動いてました。 (おかげで tdiary/tdiary-core#475 が見つかりました)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment