ubuntu-wily-daily-amd64-server-20151209 (Ubuntu 15.10)
SSH, HTTP を許可
xxx.xxx.xxx.xxx -> EC2インスタンスに割り当て
aws.your.domain A xxx.xxx.xxx.xxx 追加
$ ssh -i ~/.ssh/aws.pem ubuntu@aws.groovelab.asia
$ cat /etc/lsb-release
$ uname -a
$ sudo dpkg-reconfigure tzdata
最新のスナップショットは swift.org で確認
$ wget https://swift.org/builds/development/ubuntu1510/swift-DEVELOPMENT-SNAPSHOT-2016-02-08-a/swift-DEVELOPMENT-SNAPSHOT-2016-02-08-a-ubuntu15.10.tar.gz
$ tar xzf swift-DEVELOPMENT-SNAPSHOT-2016-02-08-a-ubuntu15.10.tar.gz
$ cd swift-DEVELOPMENT-SNAPSHOT-2016-02-08-a-ubuntu15.10/
$ sudo chown -R root:root usr/
$ cd usr
$ sudo cp -fR ./* /usr/
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get -y install clang
$ sudo apt-get clean
$ swift --version
$ swift
- 公式サイト PerfectLib
- 公式ドキュメント Github
$ sudo apt-get -y install libssl-dev libevent-dev libsqlite3-dev libicu-dev libcurl4-openssl-dev uuid-dev
make make-guile
$ cd ~
$ mkdir swift
$ cd swift
$ git clone https://github.com/PerfectlySoft/Perfect.git
$ cd Perfect/PerfectLib
$ sudo make clean
$ sudo make
$ sudo make install
$ ll /usr/local/lib/*Perfect*
/usr/local/lib/PerfectLib.so -> (your_home)/swift/Perfect/PerfectLib/PerfectLib.so
/usr/local/lib/PerfectLib.swiftdoc -> (your_home)/swift/Perfect/PerfectLib/PerfectLib.swiftdoc
/usr/local/lib/PerfectLib.swiftmodule -> (your_home)/swift/Perfect/PerfectLib/PerfectLib.swiftmodule
$ cd ../../
$ cd Perfect/PerfectServer
$ sudo make clean
$ sudo make
$ sudo ln -sf "$(pwd)/perfectserverfcgi" /usr/local/bin/
$ sudo ln -sf "$(pwd)/perfectserverhttp" /usr/local/bin/
$ ll /usr/local/bin/perfect*
/usr/local/bin/perfectserverfcgi -> (your_home)/SwiftBBS/Perfect/PerfectServer/perfectserverfcgi
/usr/local/bin/perfectserverhttp -> (your_home)/SwiftBBS/Perfect/PerfectServer/perfectserverhttp
$ cd ../../
Perfect Server HTTP はport:8181 でHTTPリクエストを受け付けるSwift製Webサーバ
- 起動スクリプトを作成
$ cd /var/www
$ sudo vi perfectServerHttp.sh
$ sudo chmod +x perfectServerHttp.sh
$ sudo ./perfectServerHttp.sh start
- usage
$ sudo ./perfectServerHttp.sh start
$ sudo ./perfectServerHttp.sh stop
$ sudo ./perfectServerHttp.sh restart
- ブラウザから動作確認 http://aws.your.domain:8181 へアクセス
Perfect Server FastCGI はApacheからFastCGIとしてリクエストを処理するインターフェース
以後、Perfect Server Httpは起動せず、Perfect Server FastCGIのみを起動する
- 起動スクリプトを作成
$ cd /var/www
$ sudo vi perfectServerFcgi.sh
$ sudo chmod +x perfectServerFcgi.sh
$ sudo ./perfectServerFcgi.sh start
- usage
$ sudo ./perfectServerFcgi.sh start
$ sudo ./perfectServerFcgi.sh stop
$ sudo ./perfectServerFcgi.sh restart
$ sudo apt-get -y install apache2
$ cd Connectors/mod_perfect/
$ sudo make
$ sudo mv mod_perfect.so /usr/lib/apache2/modules/
$ sudo chown root:root /usr/lib/apache2/modules/mod_perfect.so
$ sudo chmod 644 /usr/lib/apache2/modules/mod_perfect.so
$ ll /usr/lib/apache2/modules/mod_perfect.so
$ cd /etc/apache2
$ sudo vi mods-available/perfect.load
$ sudo a2enmod perfect
$ sudo a2enmod rewrite
$ sudo cp sites-available/000-default.conf sites-available/000-default.conf.org
$ sudo vi sites-available/000-default.conf
$ sudo service apache2 start
http://aws.your.domain へアクセス
$ cd ~/swift/Perfect/Examples/
$ sudo make
$ cd /var/www
$ sudo mkdir PerfectLibraries
$ sudo ln -s ~/swift/Perfect/Examples/URL\ Routing/URLRouting.so
$ sudo ln -s ~/swift/Perfect/Examples/Authenticator/AuthenticatorServer.so
$ sudo ln -s ~/swift/Perfect/Examples/Upload\ Enumerator/UploadEnumerator.so
$ sudo ln -s ~/swift/Perfect/Examples/Tap\ Tracker/TapTrackerServer.so
$ cd /var/www
$ cd html
$ sudo mkdir authenticator
$ sudo mkdir taptracker
$ sudo mkdir uploadfile
$ sudo cp ~/swift/Perfect/Examples/Authenticator/Authenticator/*.mustache authenticator/
$ sudo cp ~/swift/Perfect/Examples/Upload\ Enumerator/Upload\ Enumerator/*.mustache uploadfile/
$ sudo cp ~/swift/Perfect/Examples/Tap\ Tracker/*.mustache taptracker/
そのままだと Authenticatorが正しく動作しないので以下のように修正
- document.location = '/login'
+ document.location = location.pathname + '/login'
$ ./perfectServerFcgi.sh restart
- Authenticator
- http://aws.your.domain/authenticator/
- Upload Enumerator
- http://aws.your.domain/uploadfile/
- Tap Tracker
- http://aws.your.domain/taptracker/
- URL Routing
- http://aws.your.domain/foo/hogehoge/baz