ngsw

 

ようやくわかった

passenger_ruby /home/USER/.rbnev/versions/1.9.3-p0/bin/ruby;

passenger_ruby /home/USER/.rbnev/shims/ruby;
としていたため。とりあえずベタ書きで対応。

稼動しているサーバから持ってきた設定であったが、
おそらく以下のようなdot-file設定等々に影響してるのだろうな、と。
export PATH=”$HOME/.rbenv/bin:$PATH”
eval “$(rbenv init -)”
source ~/.rbenv/completions/rbenv.bash


今気がついて、まだ直せていない


/etc/init.d/nginx で起動すると
/home/USER/.rbenv/shims/ruby: line 4: exec: rbenv: not found
がnginxのerror_logに出続けるので修正する
例えば http://exmaple.com/ にアクセスするとして
Cannot spawn application ‘/path/to/rails_root’: Could not read from the spawn server: Connection reset by peer (104)
というエラーがでる
/usr/local/nginx/sbin/nginx も /etc/init.d.nginx start も
期待通りの挙動を示していないため、passengerとの連携に問題があると言えそう。
WEBRICK単独ではsinatraさんは期待通りに動いてくれている。

Continue reading »

 

WordPress に Gist コードを埋め込む Embed GitHub Gist

WordPressのコード埋め込みはGistでいいんじゃないかな
これいいと思った。
WordPress › Embed GitHub Gist « WordPress Plugins

手順レベルのものを gist にぺたぺたしてるし、
なによりシンタックスハイライト系がエンティティエンティティするからもういらついていらついて。

こんな感じで VMware せこせこ作ってる

yum install readline-devel.x86_64 libyaml.x86_64 tree nkf
yum install mysql mysql-server git
yum install readline-devel.x86_64 libyaml.x86_64 openssl-devel.x86_64 mysql-devel.x86_64
yum install gcc make zlib-devel gcc-c++

git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> $HOME/.bashrc
echo 'eval "$(rbenv init -)"' >> $HOME/.bashrc
echo "source ~/.rbenv/completions/rbenv.bash" >> $HOME/.bashrc
cd $HOME
git clone git://github.com/sstephenson/ruby-build.git
cd $HOME/ruby-build
sudo ./install.sh

rbenv-install 1.9.3-p0
rbenv global 1.9.3-p0
rbenv rehash
rbenv versions
rbenv exec gem install rails pry pry-doc

cd /path/to/railsdir/

cat << EOS > Gemfile
source "http://rubygems.org"
gem "rails", '~>3.2.0.rc2'
EOS


bundle install --path vendor/bundle
bundle exec rails new railsapp -d mysql
 
rm -f Gemfile
rm -f Gemfile.lock
rm -rf .bundle

cd railsapp
 #Gemfile追記 gem 'therubyracer'
bundle install --path vendor/bundle
bundle exec rails g scaffold post title:string body:text


# sl は $releasever をベタ書き
cat > /etc/yum.repos.d/nginx.repo <<'nginxREPO'
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/rhel/6/$basearch/
gpgcheck=0
enabled=1
nginxREPO

# ばっといれとく curl-devel は passenger あたりで言われる
yum install gcc pcre* zlib* openssl* gd* libpng* libjpeg* GeoIP* curl-devel

# /etc/init.d/nginx ファイルが欲しい
yum install nginx
cp -a /etc/init.d/nginx /root/
yum remove nginx

# rbenv 使ってるユーザで
$ rbenv exec gem install rake
$ rbenv exec gem install passenger

# nginx 入れる
export nginx_ver="1.1.14"
export nginx_configure_script="nginx_configure_`echo ${nginx_ver}|sed -e 's/\./_/g'`.sh"
mkdir /usr/local/src/NGINX/
cd /usr/local/src/NGINX
wget http://nginx.org/download/nginx-${nginx_ver}.tar.gz
tar zxvf nginx-${nginx_ver}.tar.gz

echo '#!/bin/sh

NGINX=nginx-NGINX_VER
SOURCE_DIR=/usr/local/src/NGINX
id nginx || sudo useradd -s /sbin/nologin -d /usr/local/nginx -M nginx
 
cd $SOURCE_DIR/$NGINX
[ -e "$SOURCE_DIR/$NGINX/Makefile" ] && make clean
./configure \
  --prefix="/usr/local/nginx" \
  --conf-path=/etc/nginx/nginx.conf \
  --error-log-path=/var/log/nginx/error.log \
  --pid-path=/var/run/nginx/nginx.pid \
  --lock-path=/var/lock/nginx.lock \
  --user=nginx \
  --group=nginx \
  --with-http_stub_status_module \
  --with-http_ssl_module \
  --with-http_gzip_static_module \
  --with-http_realip_module \
  --http-log-path=/var/log/nginx/access.log \
  --http-client-body-temp-path=/var/tmp/nginx/client/ \
  --http-proxy-temp-path=/var/tmp/nginx/proxy/ \
  --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \
  --with-cc-opt="-Wno-error" \
  --add-module="/home/USER/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/ext/nginx" \
&& make
' | sed -e "s/NGINX_VER/${nginx_ver}/g" > /usr/local/src/${nginx_configure_script}

# でpassengerのコンパイルで使う rake を root が見つけられずで実行できないから、
# /home/USER/.rbenv/shims を PATHに追加しちまったよ
# このやり方賢くない……

sh /usr/local/src/${nginx_configure_script}
cd /usr/local/src/NGINX/${nginx_ver}
make install

# とりあえずここまで
# sl は $releasever をベタ書き
cat > /etc/yum.repos.d/nginx.repo <<'nginxREPO'
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/rhel/6/$basearch/
gpgcheck=0
enabled=1
nginxREPO

# ばっといれとく curl-devel は passenger あたりで言われる
yum install gcc pcre* zlib* openssl* gd* libpng* libjpeg* GeoIP* curl-devel

# /etc/init.d/nginx ファイルが欲しい
yum install nginx
cp -a /etc/init.d/nginx /root/
yum remove nginx

# rbenv 使ってるユーザで
$ rbenv exec gem install rake
$ rbenv exec gem install passenger

# nginx 入れる
export nginx_ver="1.1.14"
export nginx_configure_script="nginx_configure_`echo ${nginx_ver}|sed -e 's/\./_/g'`.sh"
mkdir /usr/local/src/NGINX/
cd /usr/local/src/NGINX
wget http://nginx.org/download/nginx-${nginx_ver}.tar.gz
tar zxvf nginx-${nginx_ver}.tar.gz

echo '#!/bin/sh

NGINX=nginx-NGINX_VER
SOURCE_DIR=/usr/local/src/NGINX
id nginx || sudo useradd -s /sbin/nologin -d /usr/local/nginx -M nginx
 
cd $SOURCE_DIR/$NGINX
[ -e "$SOURCE_DIR/$NGINX/Makefile" ] && make clean
./configure \
  --prefix="/usr/local/nginx" \
  --conf-path=/etc/nginx/nginx.conf \
  --error-log-path=/var/log/nginx/error.log \
  --pid-path=/var/run/nginx/nginx.pid \
  --lock-path=/var/lock/nginx.lock \
  --user=nginx \
  --group=nginx \
  --with-http_stub_status_module \
  --with-http_ssl_module \
  --with-http_gzip_static_module \
  --with-http_realip_module \
  --with-http_geoip_module \
  --http-log-path=/var/log/nginx/access.log \
  --http-client-body-temp-path=/var/tmp/nginx/client/ \
  --http-proxy-temp-path=/var/tmp/nginx/proxy/ \
  --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \
  --with-cc-opt="-Wno-error" \
  --add-module="/home/USER/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/ext/nginx" \
&& make
' | sed -e "s/NGINX_VER/${nginx_ver}/g" > /usr/local/src/${nginx_configure_script}

# でpassengerのコンパイルで使う rake を root が見つけられずで実行できないから、
# /home/USER/.rbenv/shims を PATHに追加しちまったよ
# このやり方賢くない……

sh /usr/local/src/${nginx_configure_script}
cd /usr/local/src/NGINX/${nginx_ver}
make install

# とりあえずここまで

© 2012 # watch -d tail /var/log/ngsw.log Suffusion theme by Sayontan Sinha