Skip to content

Instantly share code, notes, and snippets.

@groovelab
Last active April 21, 2016 11:18

Revisions

  1. groovelab revised this gist Feb 11, 2016. 1 changed file with 6 additions and 5 deletions.
    11 changes: 6 additions & 5 deletions 0 PerfectLib.md
    Original file line number Diff line number Diff line change
    @@ -35,9 +35,9 @@ $ sudo dpkg-reconfigure tzdata

    #### スナップショットからSwiftをインストール
    ```
    $ wget https://swift.org/builds/ubuntu1510/swift-2.2-SNAPSHOT-2015-12-22-a/swift-2.2-SNAPSHOT-2015-12-22-a-ubuntu15.10.tar.gz
    $ tar xzf swift-2.2-SNAPSHOT-2015-12-22-a-ubuntu15.10.tar.gz
    $ cd swift-2.2-SNAPSHOT-2015-12-22-a-ubuntu15.10/
    $ 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/
    @@ -47,7 +47,7 @@ $ sudo cp -fR ./* /usr/
    ```
    $ sudo apt-get update
    $ sudo apt-get upgrade
    $ sudo apt-get -y install clang libicu-dev
    $ sudo apt-get -y install clang
    $ sudo apt-get clean
    ```
    #### Swiftの動作確認
    @@ -63,7 +63,8 @@ $ swift

    ## RPMパッケージをインストール
    ```
    $ sudo apt-get -y install libssl-dev libevent-dev libsqlite3-dev make make-guile
    $ sudo apt-get -y install libssl-dev libevent-dev libsqlite3-dev libicu-dev libcurl4-openssl-dev uuid-dev
    make make-guile
    ```

    ## PerfectLibをインストール
  2. groovelab revised this gist Jan 19, 2016. 1 changed file with 10 additions and 5 deletions.
    15 changes: 10 additions & 5 deletions 0 PerfectLib.md
    Original file line number Diff line number Diff line change
    @@ -76,7 +76,10 @@ $ cd Perfect/PerfectLib
    $ sudo make clean
    $ sudo make
    $ sudo make install
    $ ls -al /usr/local/lib/*Perfect*
    $ 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 ../../
    ```

    @@ -85,9 +88,11 @@ $ cd ../../
    $ cd Perfect/PerfectServer
    $ sudo make clean
    $ sudo make
    $ sudo ln -sf perfectserverfcgi /usr/local/lib/
    $ sudo ln -sf perfectserverhttp /usr/local/lib/
    $ ls -al /usr/local/bin/perfect*
    $ 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 ../../
    ```

    @@ -141,7 +146,7 @@ $ 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
    $ ls -al /usr/lib/apache2/modules/mod_perfect.so
    $ ll /usr/lib/apache2/modules/mod_perfect.so
    ```

    #### apacheの設定
  3. groovelab revised this gist Jan 18, 2016. 2 changed files with 7 additions and 7 deletions.
    12 changes: 5 additions & 7 deletions 0 PerfectLib.md
    Original file line number Diff line number Diff line change
    @@ -63,9 +63,7 @@ $ swift

    ## RPMパッケージをインストール
    ```
    $ sudo apt-get -y install libssl-dev libevent-dev libsqlite3-dev
    $ sudo apt-get -y install make
    $ sudo apt-get -y install make-guile
    $ sudo apt-get -y install libssl-dev libevent-dev libsqlite3-dev make make-guile
    ```

    ## PerfectLibをインストール
    @@ -79,18 +77,18 @@ $ sudo make clean
    $ sudo make
    $ sudo make install
    $ ls -al /usr/local/lib/*Perfect*
    $ cd ../../
    ```

    ## PerfectServerをインストール
    ```
    $ cd ~/swift
    $ cd Perfect/PerfectServer
    $ sudo make clean
    $ sudo make
    $ cd /usr/local/bin/
    $ sudo ln -s ~/swift/Perfect/PerfectServer/perfectserverfcgi
    $ sudo ln -s ~/swift/Perfect/PerfectServer/perfectserverhttp
    $ sudo ln -sf perfectserverfcgi /usr/local/lib/
    $ sudo ln -sf perfectserverhttp /usr/local/lib/
    $ ls -al /usr/local/bin/perfect*
    $ cd ../../
    ```


    2 changes: 2 additions & 0 deletions 2 perfectServerFcgi.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    #! /bin/sh

    CWD=`dirname "${0}"`
    cd "${CWD}"
    PIDFILE="perfectserverfcgi.pid"

    do_start() {
  4. groovelab revised this gist Jan 15, 2016. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions 0 PerfectLib.md
    Original file line number Diff line number Diff line change
    @@ -75,8 +75,8 @@ $ mkdir swift
    $ cd swift
    $ git clone https://github.com/PerfectlySoft/Perfect.git
    $ cd Perfect/PerfectLib
    $ make clean
    $ make
    $ sudo make clean
    $ sudo make
    $ sudo make install
    $ ls -al /usr/local/lib/*Perfect*
    ```
    @@ -85,8 +85,8 @@ $ ls -al /usr/local/lib/*Perfect*
    ```
    $ cd ~/swift
    $ cd Perfect/PerfectServer
    $ make clean
    $ make
    $ sudo make clean
    $ sudo make
    $ cd /usr/local/bin/
    $ sudo ln -s ~/swift/Perfect/PerfectServer/perfectserverfcgi
    $ sudo ln -s ~/swift/Perfect/PerfectServer/perfectserverhttp
    @@ -139,7 +139,7 @@ $ sudo ./perfectServerFcgi.sh restart
    ```
    $ sudo apt-get -y install apache2
    $ cd Connectors/mod_perfect/
    $ make
    $ 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
    @@ -164,7 +164,7 @@ http://aws.your.domain へアクセス
    #### .soファイル
    ```
    $ cd ~/swift/Perfect/Examples/
    $ make
    $ sudo make
    $ cd /var/www
    $ sudo mkdir PerfectLibraries
    $ sudo ln -s ~/swift/Perfect/Examples/URL\ Routing/URLRouting.so
  5. groovelab revised this gist Jan 7, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions 0 PerfectLib.md
    Original file line number Diff line number Diff line change
    @@ -101,6 +101,7 @@ $ ls -al /usr/local/bin/perfect*
    ```
    $ cd /var/www
    $ sudo vi perfectServerHttp.sh
    $ sudo chmod +x perfectServerHttp.sh
    $ sudo ./perfectServerHttp.sh start
    ```

    @@ -123,6 +124,7 @@ http://aws.your.domain:8181 へアクセス
    ```
    $ cd /var/www
    $ sudo vi perfectServerFcgi.sh
    $ sudo chmod +x perfectServerFcgi.sh
    $ sudo ./perfectServerFcgi.sh start
    ```

  6. groovelab revised this gist Jan 7, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0 PerfectLib.md
    Original file line number Diff line number Diff line change
    @@ -78,7 +78,7 @@ $ cd Perfect/PerfectLib
    $ make clean
    $ make
    $ sudo make install
    $ ls /usr/local/lib/*Perfect*
    $ ls -al /usr/local/lib/*Perfect*
    ```

    ## PerfectServerをインストール
  7. groovelab revised this gist Jan 7, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0 PerfectLib.md
    Original file line number Diff line number Diff line change
    @@ -74,7 +74,7 @@ $ cd ~
    $ mkdir swift
    $ cd swift
    $ git clone https://github.com/PerfectlySoft/Perfect.git
    $ cd Perfect/PerfectLibls
    $ cd Perfect/PerfectLib
    $ make clean
    $ make
    $ sudo make install
  8. groovelab revised this gist Jan 7, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0 PerfectLib.md
    Original file line number Diff line number Diff line change
    @@ -40,7 +40,7 @@ $ tar xzf swift-2.2-SNAPSHOT-2015-12-22-a-ubuntu15.10.tar.gz
    $ cd swift-2.2-SNAPSHOT-2015-12-22-a-ubuntu15.10/
    $ sudo chown -R root:root usr/
    $ cd usr
    $ cp -fR ./* /usr/
    $ sudo cp -fR ./* /usr/
    ```

    #### RPMパッケージをインストール
  9. groovelab revised this gist Jan 1, 2016. 1 changed file with 23 additions and 4 deletions.
    27 changes: 23 additions & 4 deletions 2 perfectServerFcgi.sh
    Original file line number Diff line number Diff line change
    @@ -1,22 +1,41 @@
    #! /bin/sh

    PIDFILE="perfectserverfcgi.pid"

    do_start() {
    cd /var/www/
    if [ -e $PIDFILE ]; then
    echo "already started, because $PIDFILE exists"
    exit 1
    fi

    perfectserverfcgi &
    echo $! > $PIDFILE
    echo "start PID=$!"
    }

    do_stop() {
    pkill -f perfectserverfcgi
    if [ ! -e $PIDFILE ]; then
    echo "not started"
    exit 1
    fi

    PID=$(cat $PIDFILE)
    kill -9 $PID
    rm $PIDFILE
    echo "stop PID=$PID"
    }

    case "$1" in
    start | restart)
    do_stop
    start)
    do_start
    ;;
    stop)
    do_stop
    ;;
    restart)
    do_stop
    do_start
    ;;
    esac

    exit 0
  10. groovelab revised this gist Dec 27, 2015. 1 changed file with 8 additions and 4 deletions.
    12 changes: 8 additions & 4 deletions 0 PerfectLib.md
    Original file line number Diff line number Diff line change
    @@ -194,7 +194,11 @@ $ sudo cp ~/swift/Perfect/Examples/Tap\ Tracker/*.mustache taptracker/
    $ ./perfectServerFcgi.sh restart
    ```
    #### ブラウザから動作確認
    * http://aws.your.domain/authenticator/
    * http://aws.your.domain/uploadfile/
    * http://aws.your.domain/taptracker/
    * http://aws.your.domain/foo/hogehoge/baz
    * 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
  11. groovelab revised this gist Dec 27, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions 0 PerfectLib.md
    Original file line number Diff line number Diff line change
    @@ -184,8 +184,10 @@ $ sudo cp ~/swift/Perfect/Examples/Tap\ Tracker/*.mustache taptracker/
    ```

    > そのままだと Authenticatorが正しく動作しないので以下のように修正
    ```
    - document.location = '/login'
    + document.location = location.pathname + '/login'
    ```

    #### PerfectServerを再起動
    ```
  12. groovelab revised this gist Dec 27, 2015. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions 0 PerfectLib.md
    Original file line number Diff line number Diff line change
    @@ -183,6 +183,10 @@ $ sudo cp ~/swift/Perfect/Examples/Upload\ Enumerator/Upload\ Enumerator/*.musta
    $ sudo cp ~/swift/Perfect/Examples/Tap\ Tracker/*.mustache taptracker/
    ```

    > そのままだと Authenticatorが正しく動作しないので以下のように修正
    - document.location = '/login'
    + document.location = location.pathname + '/login'

    #### PerfectServerを再起動
    ```
    $ ./perfectServerFcgi.sh restart
  13. groovelab revised this gist Dec 27, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0 PerfectLib.md
    Original file line number Diff line number Diff line change
    @@ -117,7 +117,7 @@ http://aws.your.domain:8181 へアクセス
    #### Perfect Server FastCGI を起動
    **Perfect Server FastCGI** はApacheからFastCGIとしてリクエストを処理するインターフェース

    > 以下、Perfect Server Httpは起動せず、*Perfect Server FastCGI*のみを起動する
    > 以後、Perfect Server Httpは起動せず、*Perfect Server FastCGI*のみを起動する
    * 起動スクリプトを作成
    ```
  14. groovelab revised this gist Dec 27, 2015. 1 changed file with 12 additions and 12 deletions.
    24 changes: 12 additions & 12 deletions 0 PerfectLib.md
    Original file line number Diff line number Diff line change
    @@ -94,46 +94,46 @@ $ ls -al /usr/local/bin/perfect*
    ```


    ### Perfect Server HTTP を起動
    #### Perfect Server HTTP を起動
    **Perfect Server HTTP** はport:8181 でHTTPリクエストを受け付けるSwift製Webサーバ

    #### 起動スクリプトを作成
    * 起動スクリプトを作成
    ```
    $ cd /var/www
    $ sudo vi perfectServerHttp.sh
    $ sudo ./perfectServerHttp.sh start
    ```

    #### usage
    * usage
    ```
    $ sudo ./perfectServerHttp.sh start
    $ sudo ./perfectServerHttp.sh stop
    $ sudo ./perfectServerHttp.sh restart
    ```

    #### ブラウザから動作確認
    * ブラウザから動作確認
    http://aws.your.domain:8181 へアクセス

    ### Perfect Server FastCGI を起動
    #### Perfect Server FastCGI を起動
    **Perfect Server FastCGI** はApacheからFastCGIとしてリクエストを処理するインターフェース

    > 以下、Perfect Server Httpは起動せず、*Perfect Server FastCGI*のみを起動する
    #### 起動スクリプトを作成
    * 起動スクリプトを作成
    ```
    $ cd /var/www
    $ sudo vi perfectServerFcgi.sh
    $ sudo ./perfectServerFcgi.sh start
    ```

    #### usage
    * usage
    ```
    $ sudo ./perfectServerFcgi.sh start
    $ sudo ./perfectServerFcgi.sh stop
    $ sudo ./perfectServerFcgi.sh restart
    ```

    ## mod_perfect インストール
    #### mod_perfect インストール
    ```
    $ sudo apt-get -y install apache2
    $ cd Connectors/mod_perfect/
    @@ -144,7 +144,7 @@ $ sudo chmod 644 /usr/lib/apache2/modules/mod_perfect.so
    $ ls -al /usr/lib/apache2/modules/mod_perfect.so
    ```

    ## apacheの設定
    #### apacheの設定
    ```
    $ cd /etc/apache2
    $ sudo vi mods-available/perfect.load
    @@ -159,7 +159,7 @@ $ sudo service apache2 start
    http://aws.your.domain へアクセス

    ## Exampleのデプロイ
    ### .soファイル
    #### .soファイル
    ```
    $ cd ~/swift/Perfect/Examples/
    $ make
    @@ -171,7 +171,7 @@ $ sudo ln -s ~/swift/Perfect/Examples/Upload\ Enumerator/UploadEnumerator.so
    $ sudo ln -s ~/swift/Perfect/Examples/Tap\ Tracker/TapTrackerServer.so
    ```

    ### .mustacheファイル
    #### .mustacheファイル
    ```
    $ cd /var/www
    $ cd html
    @@ -183,7 +183,7 @@ $ sudo cp ~/swift/Perfect/Examples/Upload\ Enumerator/Upload\ Enumerator/*.musta
    $ sudo cp ~/swift/Perfect/Examples/Tap\ Tracker/*.mustache taptracker/
    ```

    ### PerfectServerを再起動
    #### PerfectServerを再起動
    ```
    $ ./perfectServerFcgi.sh restart
    ```
  15. groovelab revised this gist Dec 27, 2015. 5 changed files with 0 additions and 0 deletions.
    File renamed without changes.
    File renamed without changes.
    File renamed without changes.
  16. groovelab revised this gist Dec 27, 2015. 3 changed files with 0 additions and 0 deletions.
    File renamed without changes.
    File renamed without changes.
  17. groovelab revised this gist Dec 27, 2015. 4 changed files with 0 additions and 0 deletions.
    File renamed without changes.
    File renamed without changes.
  18. groovelab revised this gist Dec 27, 2015. No changes.
  19. groovelab revised this gist Dec 27, 2015. No changes.
  20. groovelab revised this gist Dec 27, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions 1 PerfectLib.md
    Original file line number Diff line number Diff line change
    @@ -93,6 +93,7 @@ $ sudo ln -s ~/swift/Perfect/PerfectServer/perfectserverhttp
    $ ls -al /usr/local/bin/perfect*
    ```


    ### Perfect Server HTTP を起動
    **Perfect Server HTTP** はport:8181 でHTTPリクエストを受け付けるSwift製Webサーバ

  21. groovelab revised this gist Dec 27, 2015. No changes.
  22. groovelab revised this gist Dec 27, 2015. 1 changed file with 0 additions and 3 deletions.
    3 changes: 0 additions & 3 deletions 1 PerfectLib.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,3 @@
    # UbuntuでSwiftとPerfectLibのサンプルを動かしてみる

    ---------------------------------------
    # AWS
    ## EC2インスタンスを作成
    #### AMI
  23. groovelab revised this gist Dec 27, 2015. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions 1 PerfectLib.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,6 @@
    # UbuntuでSwiftとPerfectLibのサンプルを動かしてみる

    ---------------------------------------
    # AWS
    ## EC2インスタンスを作成
    #### AMI
  24. groovelab revised this gist Dec 27, 2015. 1 changed file with 8 additions and 14 deletions.
    22 changes: 8 additions & 14 deletions 1 PerfectLib.md
    Original file line number Diff line number Diff line change
    @@ -116,6 +116,8 @@ http://aws.your.domain:8181 へアクセス
    ### Perfect Server FastCGI を起動
    **Perfect Server FastCGI** はApacheからFastCGIとしてリクエストを処理するインターフェース

    > 以下、Perfect Server Httpは起動せず、*Perfect Server FastCGI*のみを起動する
    #### 起動スクリプトを作成
    ```
    $ cd /var/www
    @@ -166,13 +168,12 @@ $ 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 ../
    ```

    ### .mustacheファイル
    ```
    $ sudo mkdir webroot
    $ cd webroot
    $ cd /var/www
    $ cd html
    $ sudo mkdir authenticator
    $ sudo mkdir taptracker
    $ sudo mkdir uploadfile
    @@ -183,17 +184,10 @@ $ sudo cp ~/swift/Perfect/Examples/Tap\ Tracker/*.mustache taptracker/

    ### PerfectServerを再起動
    ```
    $ ./perfectServerHttp.sh restart
    $ ./perfectServerFcgi.sh restart
    ```
    #### ブラウザから動作確認
    * Perfect Server Http
    * http://aws.your.domain:8181/authenticator/
    * http://aws.your.domain:8181/uploadfile/
    * http://aws.your.domain:8181/taptracker/
    * http://aws.your.domain:8181/foo/hogehoge/baz
    * Perfect Server FastCGI
    * http://aws.your.domain/authenticator/
    * http://aws.your.domain/uploadfile/
    * http://aws.your.domain/taptracker/
    * http://aws.your.domain/foo/hogehoge/baz
    * http://aws.your.domain/authenticator/
    * http://aws.your.domain/uploadfile/
    * http://aws.your.domain/taptracker/
    * http://aws.your.domain/foo/hogehoge/baz
  25. groovelab revised this gist Dec 27, 2015. 1 changed file with 2 additions and 25 deletions.
    27 changes: 2 additions & 25 deletions sites-available 000-default.conf
    Original file line number Diff line number Diff line change
    @@ -1,35 +1,12 @@
    <VirtualHost *:80>
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    #ServerName www.example.com

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn
    DocumentRoot /var/www/webroot

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf


    # for perfect
    <Directory "/var/www/html">
    <Directory "/var/www/webroot">
    Require all granted
    DirectoryIndex index.mustache index.html
    </Directory>
  26. groovelab revised this gist Dec 27, 2015. 1 changed file with 62 additions and 0 deletions.
    62 changes: 62 additions & 0 deletions sites-available 000-default.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,62 @@
    <VirtualHost *:80>
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    #ServerName www.example.com

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf


    # for perfect
    <Directory "/var/www/html">
    Require all granted
    DirectoryIndex index.mustache index.html
    </Directory>

    RewriteEngine on

    # unless a directory, remove trailing slash
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ $1 [R=301,L]

    # resolve .mustache file for extensionless mustache urls
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}\.mustache -f
    RewriteRule ^(.*)$ $1.mustache [NC,PT,L]

    # redirect external .mustache requests to extensionless url
    RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^/]+/)*[^.#?\ ]+\.mustache([#?][^\ ]*)?\ HTTP/
    RewriteRule ^(([^/]+/)*[^.]+)\.mustache $1 [R=301,L]

    <Location ~ "^.*\.[Mm][Uu][Ss][Tt][Aa][Cc][Hh][Ee]$">
    SetHandler perfect-handler
    </Location>

    # for using Perfect's URL routing system
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
    RewriteRule (.*) - [L,NS,H=perfect-handler]

    </VirtualHost>
  27. groovelab renamed this gist Dec 27, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  28. groovelab renamed this gist Dec 27, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  29. groovelab revised this gist Dec 27, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions perfect.load
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    LoadModule perfect_module /usr/lib/apache2/modules/mod_perfect.so
  30. groovelab revised this gist Dec 27, 2015. 1 changed file with 33 additions and 4 deletions.
    37 changes: 33 additions & 4 deletions PerfectLib.md
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ SSH, HTTP を許可
    #### elastic IP
    xxx.xxx.xxx.xxx -> EC2インスタンスに割り当て
    #### DNS
    aws.hoge.abc A xxx.xxx.xxx.xxx 追加
    aws.your.domain A xxx.xxx.xxx.xxx 追加

    ## ssh
    #### キーペアを作成する
    @@ -56,6 +56,7 @@ $ swift --version
    $ swift
    ```

    ---------------------------------------
    # PerfectLib インストール
    * 公式サイト [PerfectLib](https://www.perfect.org/)
    * 公式ドキュメント [Github](https://github.com/PerfectlySoft/Perfect)
    @@ -110,7 +111,7 @@ $ sudo ./perfectServerHttp.sh restart
    ```

    #### ブラウザから動作確認
    http://aws.hoge.abc:8181 へアクセス
    http://aws.your.domain:8181 へアクセス

    ### Perfect Server FastCGI を起動
    **Perfect Server FastCGI** はApacheからFastCGIとしてリクエストを処理するインターフェース
    @@ -152,9 +153,10 @@ $ sudo service apache2 start
    ```

    #### ブラウザから動作確認
    http://aws.hoge.abc へアクセス
    http://aws.your.domain へアクセス

    ## Exampleのデプロイ
    ### .soファイル
    ```
    $ cd ~/swift/Perfect/Examples/
    $ make
    @@ -165,6 +167,33 @@ $ 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 ../
    ```

    ### .mustacheファイル
    ```
    $ sudo mkdir webroot
    $ cd webroot
    $ 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/
    ```

    ### PerfectServerを再起動
    ```
    $ ./perfectServerHttp.sh restart
    $ ./perfectServerFcgi.sh restart
    ```
    ```
    #### ブラウザから動作確認
    * Perfect Server Http
    * http://aws.your.domain:8181/authenticator/
    * http://aws.your.domain:8181/uploadfile/
    * http://aws.your.domain:8181/taptracker/
    * http://aws.your.domain:8181/foo/hogehoge/baz
    * Perfect Server FastCGI
    * http://aws.your.domain/authenticator/
    * http://aws.your.domain/uploadfile/
    * http://aws.your.domain/taptracker/
    * http://aws.your.domain/foo/hogehoge/baz