さくらvpsセットアップ
- ユーザとかsshの設定
# vipw # visudo # vigr # vi /etc/ssh/ssh_config # service sshd restart
# rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm # yum install --enablerepo=webtatic git nginx # yum install gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel # yum install mysql mysql-devel
- rvm
$ echo insecure >> ~/.curlrc $ bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer) $ rvm requirements $ rvm install 1.9.3
pow入れる
常識に追いついていきたい。
$ curl get.pow.cx | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6813 100 6813 0 0 8384 0 --:--:-- --:--:-- --:--:-- 13254
*** Installing Pow 0.3.1...
*** Installing local configuration files...
/Users/seiryo/Library/LaunchAgents/cx.pow.powd.plist
*** Installing system configuration files as root...
Password:
/Library/LaunchDaemons/cx.pow.firewall.plist
/etc/resolver/dev
*** Starting the Pow server...
*** Performing self-test...
*** Installed
For troubleshooting instructions, please see the Pow wiki:
https://github.com/37signals/pow/wiki/Troubleshooting
To uninstall Pow, `curl get.pow.cx/uninstall.sh | sh`
$ cd ~/.pow
$ ln -s ~/Documents/work/tiqav
$ curl http://tiqav.dev/ | head
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 12611 0 12611 0 0 18740 0 --:--:-- --:--:-- --:--:-- 22202
<!DOCTYPE html>
<html lang='ja' xmlns:og='http://ogp.me/ns#'>
<head>
<title>レス画像検索No.1/画像会話なら ちくわぶ</title>
<meta charset='UTF-8'>
<meta content='tiqav,tiquav,ちくわぶ,ちくわ,tikuwabu,chikuwabu,chikuwa' name='keywords'>
<meta content='tiqav / ちくわぶ は、画像会話用画像検索エンジンです。' name='description'>
<meta content='tiqav / ちくわぶ' property='og:site_name'>
<link href='/' rel='start'>
<link href='/images/favicon.ico' rel='shortcut icon' type='image/x-icon'>
RSpecいろいろ
- 全実行
$ rake spec (in /Users/seiryo/Documents/work/tiqav) /Users/seiryo/.rvm/rubies/ruby-1.9.2-p180/bin/ruby -S bundle exec rspec ./spec/controllers/tiqav_controller_spec.rb ./spec/helpers/tiqav_helper_spec.rb ./spec/models/leaf_spec.rb ./spec/views/tiqav/index.html.haml_spec.rb ./spec/views/tiqav/show.html.haml_spec.rb ..*....** (中略) Finished in 11.37 seconds 9 examples, 0 failures, 3 pending
- あるファイルだけ実行
$ bundle exec rspec spec/controllers/tiqav_controller_spec.rb .. Finished in 6.58 seconds 2 examples, 0 failures
- あるファイルだけ実行して、詳細を出力
- 出力フォーマットは以下の4種類から選ぶ
[p]rogress (default - dots) [d]ocumentation (group and example names) [h]tml [t]extmate
- documentation
$ bundle exec rspec spec/controllers/tiqav_controller_spec.rb -f d
TiqavController
GET '/'
routes
should route to {:controller=>"tiqav", :action=>"index"}
response
should be success
Finished in 11.95 seconds
- ペンディング、あとでやる
describe TiqavHelper do
pending "add some examples to (or delete) #{__FILE__}"
end
EvernoteのAPIをrubyから用いる際の出力
httpsでやり取りする際に以下のような出力が出るが、cronでまわす際に余計な出力があると困るのでなんとかする。
warning: peer certificate won't be verified in this SSL session
Net::HTTP#verify_mode に OpenSSL::SSL::VERIFY_NONE を代入することで出力を無くすことが出来る。
ライブラリで該当する箇所に修正を加える。
# evernote-api-1.16/lib/ruby/thrift/transport/http_client_transport.rb def flush http = Net::HTTP.new @url.host, @url.port http.use_ssl = @url.scheme == "https" http.verify_mode = OpenSSL::SSL::VERIFY_NONE if http.use_ssl resp, data = http.post(@url.request_uri, @outbuf, @headers) @inbuf = StringIO.new data @outbuf = "" end
以下、参考ページ。
servermanにnginxインストール
yumでインストールする手もあるけど以下の問題が発生したのでソースからビルドする。
pcreが必要だと怒られるので
$ sudo yum install pcre pcre-devel
あらためて
$ wget http://nginx.org/download/nginx-0.8.54.tar.gz $ tar zxfv nginx-0.8.54.tar.gz $ cd nginx-0.8.54 $ ./configure --prefix=/usr/local/nginx $ make $ sudo make install
起動してアクセス。
$ sudo /usr/local/nginx/sbin/nginx
ご参考
[メモ] node.js install
夏風さんが #shisoconf で node.js インストールのハンズオンをやってたので、そのときのコマンドをメモ。
$ mkdir node $ cd node $ curl -O https://github.com/isaacs/nave/raw/master/nave.sh $ chmod +x nave.sh $ ./nave.sh install latest $ ./nave.sh ls $ ./nave.sh use latest $ curl http://npmjs.org/install.sh | sh $ npm install express
要らなくなったらnodeディレクトリごと消してしまってOKらしい。
クローラとかnode.jsで書いてみようかな。
