ユーザ用ツール

サイト用ツール


temporary:asakusasatellite:install

Install

リポジトリ

CentOS 6.x

rpm -Uvh http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
 
2014/02/17 15:00

開発ツール

# yum -y install openssl-devel gcc-c++ git

MongoDB

# vi /etc/yum.repos.d/mongodb.repo

[mongodb-org-3.0]
name=MongoDB Repository
baseurl=http://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.0/x86_64/
gpgcheck=0
enabled=0

# yum --enablerepo=mongodb-org-3.0 install mongodb-org
# chkconfig mongod on
# service mongod start

Apache、etc

# yum -y install httpd libcurl-devel httpd-devel apr-devel apr-util-devel

Ruby、etc

rbenv

複数のRubyバージョンをインストールして、それぞれのRuby環境を切り替える

# cd /usr/local/
# git clone https://github.com/sstephenson/rbenv.git
# mkdir rbenv/shims rbenv/versions
# groupadd rbenv
# chgrp -R rbenv rbenv
# chmod -R g+rwxXs rbenv
# git clone git://github.com/sstephenson/ruby-build.git ruby-build
# cd ruby-build
# ./install.sh
# vi /etc/profile.d/rbenv.sh

export RBENV_ROOT="/usr/local/rbenv"
export PATH="/usr/local/rbenv/bin:$PATH"
eval "$(rbenv init -)"

# source /etc/profile.d/rbenv.sh
# which rbenv

ruby

※AsakusaSatelliteがjson 1.8.0を要求するが、ruby 2.2.2などではインストールできないのでダウングレード

# rbenv install 2.1.0
# rbenv global 2.1.0
# ruby -v
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]

bundler

プロジェクト内で使うRubyのパッケージを管理する。Gemfileにパッケージ名、バージョンなどを記述してgemのライブラリを管理する

# gem install bundler --no-rdoc --no-ri
Fetching: bundler-1.9.9.gem (100%)
Successfully installed bundler-1.9.9
1 gem installed

passenger

Apacheなど、webサーバ上でRubyのwebアプリを動作させるモジュール

インストール

# gem install passenger --no-rdoc --no-ri

Apacheモジュールのビルドとインストール

# passenger-install-apache2-module
Welcome to the Phusion Passenger Apache 2 module installer, v5.0.8.

This installer will guide you through the entire installation process. It
shouldn't take more than 3 minutes in total.

Here's what you can expect from the installation process:

 1. The Apache 2 module will be installed for you.
 2. You'll learn how to configure Apache.
 3. You'll learn how to deploy a Ruby on Rails application.

Don't worry if anything goes wrong. This installer will advise you on how to
solve any problems.

Press Enter to continue, or Ctrl-C to abort.
1

--------------------------------------------

Which languages are you interested in?

Use <space> to select.
If the menu doesn't display correctly, press '!'

 ‣ ⬢  Ruby
   ⬢  Python
   ⬡  Node.js
   ⬡  Meteor

--------------------------------------------

~省略~

--------------------------------------------
Almost there!

Please edit your Apache configuration file, and add these lines:

   LoadModule passenger_module /usr/local/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/passenger-5.0.8/buildout/apache2/mod_passenger.so
   <IfModule mod_passenger.c>
     PassengerRoot /usr/local/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/passenger-5.0.8
     PassengerDefaultRuby /usr/local/rbenv/versions/2.1.0/bin/ruby
   </IfModule>

After you restart Apache, you are ready to deploy any number of web
applications on Apache, with a minimum amount of configuration!

Press ENTER when you are done editing.


--------------------------------------------

Validating installation...

 * Checking whether this Passenger install is in PATH... ✓
 * Checking whether there are no other Passenger installations... (!)

   You are currently validating against Phusion Passenger 5.0.8, located in:
   
     /usr/local/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/passenger-5.0.8/bin/passenger
   
   Besides this Passenger installation, the following other
   Passenger installations have also been detected:
   
     /usr/local/rbenv/shims/passenger
   
   Please uninstall these other Passenger installations to avoid
   confusion or conflicts.

 * Checking whether Apache is installed... ✓
 * Checking whether the Passenger module is correctly configured in Apache... (!)

   You did not specify 'LoadModule passenger_module' in any of your Apache
   configuration files. Please paste the configuration snippet that this
   installer printed earlier, into one of your Apache configuration files, such
   as /etc/httpd/conf/httpd.conf.


Detected 0 error(s), 2 warning(s).
Press ENTER to continue.


--------------------------------------------

Deploying a web application: an example

Suppose you have a web application in /somewhere. Add a virtual host to your
Apache configuration file and set its DocumentRoot to /somewhere/public:

   <VirtualHost *:80>
      ServerName www.yourhost.com
      # !!! Be sure to point DocumentRoot to 'public'!
      DocumentRoot /somewhere/public    
      <Directory /somewhere/public>
         # This relaxes Apache security settings.
         AllowOverride all
         # MultiViews must be turned off.
         Options -MultiViews
         # Uncomment this if you're on Apache >= 2.4:
         #Require all granted
      </Directory>
   </VirtualHost>

And that's it! You may also want to check the Users Guide for security and
optimization tips, troubleshooting and other useful information:

  /usr/local/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/passenger-5.0.8/doc/Users guide Apache.html
  https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html

Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-)
https://www.phusionpassenger.com

Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.

Apacheの設定

※AsakusaSatelliteを「ドキュメントルート/as」に設置する前提で。

# vi /etc/httpd/conf.d/asakusasatellite.conf

LoadModule passenger_module /usr/local/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/passenger-5.0.8/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
  PassengerRoot /usr/local/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/passenger-5.0.8
  PassengerDefaultRuby /usr/local/rbenv/versions/2.1.0/bin/ruby
</IfModule>

RailsEnv production
RailsBaseURI /as

AsakusaSatellite

http://www.codefirst.org/AsakusaSatellite/
開発者向けのリアルタイムチャットアプリケーション

インストール

# cd /tmp/
# wget https://github.com/codefirst/AsakusaSatellite/archive/v0.9.0.tar.gz
# tar xzvf v0.9.0.tar.gz
# mv AsakusaSatellite-0.9.0 /var/AsakusaSatellite

# cd /var/AsakusaSatellite/

ライブラリインストール

/var/AsakusaSatellite/Gemfileを参考に、プロジェクト(/var/AsakusaSatellite/)配下に必要なライブラリをインストールする

# bundle install --path .bundle --without development test

# cp config/environments/production.rb config/environments/production.rb.bk
# vi config/environments/production.rb

12,13c12
<   #config.serve_static_assets = true
<   config.serve_static_assets = false
---
>   config.serve_static_assets = true

rake実行

プロジェクト(/var/AsakusaSatellite/)配下のライブラリを読み込んでrake実行

# bundle exec rake assets:precompile RAILS_ENV=production

認証設定

Twitter⇒Redmine

# cp /var/AsakusaSatellite/config/filter_intra.yml /var/AsakusaSatellite/config/filter_intra.yml.bk
# vi /var/AsakusaSatellite/config/filter_intra.yml

21c21
<  - dir: as_global_js_css
---
> # - dir: as_global_js_css
23c23
< # - dir: as_twitterauth_plugin
---
>  - dir: as_twitterauth_plugin
25c25
<  - dir: as_redmineauth_plugin
---
> # - dir: as_redmineauth_plugin

# cp /var/AsakusaSatellite/config/settings.yml /var/AsakusaSatellite/config/settings.yml.bk
# vi /var/AsakusaSatellite/config/settings.yml

1,6d0
< #omniauth:
< #  provider: "twitter"
< #  provider_args:
< #    - "Ug9FZ0r8zp3jwuvOGFYWQ"
< #    - "qMvcOzyQu4Qkz1bm0k1bOHYDn1m4JF3DXbQK9CWfMA"
< 
8c2
<   provider: 'redmine'
---
>   provider: "twitter"
10c4,10
<     - 'http://192.168.1.210/redmine/'
---
>     - "Ug9FZ0r8zp3jwuvOGFYWQ"
>     - "qMvcOzyQu4Qkz1bm0k1bOHYDn1m4JF3DXbQK9CWfMA"
> 
> #omniauth:
> #  provider: 'redmine'
> #  provider_args:
> #    - 'Redmine URL'

# cp /var/AsakusaSatellite/plugins/as_redmineauth_plugin/app/models/redmine_user.rb /var/AsakusaSatellite/plugins/as_redmineauth_plugin/app/models/redmine_user.rb.bk
# vi /var/AsakusaSatellite/plugins/as_redmineauth_plugin/app/models/redmine_user.rb

24c24
<     "#{last} #{first}"
---
>     "#{first} #{last}"

デスクトップ通知用設定

# cp /var/AsakusaSatellite/config/message_pusher.yml /var/AsakusaSatellite/config/message_pusher.yml.bk
# vi /var/AsakusaSatellite/config/message_pusher.yml

12,13c12,13
<   http: http://192.168.1.249:3002/http
<   web_socket: ws://192.168.1.249:3002/websocket
---
>   http: http://localhost:3002/http
>   web_socket: ws://localhost:3002/websocket

socky

デスクトップ通知用socky起動(プロジェクトローカルのthinでsocdkyを起動)

起動スクリプト

# vi /etc/init.d/socky

#!/bin/bash
#
### BEGIN CHKCONFIG INFO
# chkconfig: 2345 55 25
# description: bundle exec thin ...
### END CHKCONFIG INFO

prog=socky
cmd=/usr/local/rbenv/shims/bundle
pjroot=/var/AsakusaSatellite
pidfile=$pjroot/tmp/pids/thin.pid

start() {
  echo -n $"Starting $prog: "
  if [ -f "$pidfile" ] ; then
    pid=`cat "$pidfile"`
    printf 'Existing process: %d\n' "$pid" 
    retval=1
  else
    cd $pjroot
    $cmd exec thin -R socky/config.ru -p3002 -t0 -d start
  fi
}

stop() {
  echo -n $"Stopping $prog: "
  if [ -f "$pidfile" ] ; then
    cd $pjroot
    $cmd exec thin -R socky/config.ru -p3002 -t0 -d stop
    
    #SOCKYPID=`cat "$pidfile"`
    #/bin/kill "$SOCKYPID" >/dev/null 2>&1
  fi
}

restart()
{
  if [ -f "$pidfile" ] ; then
    cd $pjroot
    $cmd exec thin -R socky/config.ru -p3002 -t0 -d restart
  fi
}


case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        #restart
        stop
        start
        ;;
  *)
        echo "Usage: $prog {start|stop|restart}" >&2
        exit 3
        ;;
esac

exit

# chmod 755 /etc/init.d/socky
# /etc/init.d/socky start
# chkconfig socky on

ドキュメントへのシンボリックリンク作成

# cd /var/www/html
# ln -s /var/AsakusaSatellite/public as
# ln -s /var/AsakusaSatellite/public/assets/ assets

権限設定

# chown -R apache.apache /var/AsakusaSatellite
# chmod -R 777 /var/AsakusaSatellite/tmp
# chmod -R 777 /var/AsakusaSatellite/public/upload

apache(再)起動

# /etc/init.d/httpd restart
temporary/asakusasatellite/install.txt · 最終更新: 2016/01/13 05:31 by clownclown

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki