Last active
February 21, 2017 15:11
-
-
Save anazawa/e53f1e20de5c3bb71fd8e7d847badf66 to your computer and use it in GitHub Desktop.
Running KGS Protocol Translator on Jetty9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Daemonize | |
vi /usr/local/etc/jetty/jetty | |
echo jetty_enable="YES" >> /etc/rc.conf | |
service jetty start |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Introduction to Jetty | |
# http://zetcode.com/java/jetty/introduction/ | |
# org.json | |
# http://mvnrepository.com/artifact/org.json/json | |
# KGS Protocol | |
# https://www.gokgs.com/help/protocol.html | |
# Create JETTY_BASE | |
mkdir $JETTY_BASE | |
cd $JETTY_BASE | |
java -jar $JETTY_HOME/start.jar --add-to-start=ext | |
java -jar $JETTY_HOME/start.jar --add-to-startd=http,http-forwarded,logging,deploy | |
# Install org.json | |
cd $JETTY_BASE/lib/ext | |
curl -O http://central.maven.org/maven2/org/json/json/20160212/json-20160212.jar | |
# Install KGS Protocol Translator | |
cd $JETTY_BASE/webapps | |
curl -O http://www.igoweb.org/~wms/kgs/jsonClient-2016-04-30T20_45Z.war | |
# Run | |
cd $JETTY_BASE | |
java -XX:NativeMemoryTracking=summary\ | |
-Xmx64m -Xms32m\ | |
-XX:ReservedCodeCacheSize=16m\ | |
-jar $JETTY_HOME/start.jar | |
open http://localhost:8080/jsonClient-2016-04-30T20_45Z/ | |
# Native Memory Tracking | |
sudo -u www jcmd # => $PID | |
sudo -u www jcmd $PID VM.native_memory summary |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Java servers like Jetty, GlassFish and Tomcat | |
# https://www.nginx.com/resources/wiki/start/topics/examples/javaservers/ | |
# Slightly tighter CORS config for nginx | |
# https://gist.github.com/alexjs/4165271 | |
# ブラウザごとの cookie path の挙動の違い | |
# http://please-sleep.cou929.nu/cookie-path-behavior-difference-of-browsers.html | |
location /api/access { | |
proxy_pass http://127.0.0.1:8080/jsonClient-2016-04-30T20_45Z/access; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header Host $http_host; | |
proxy_cookie_path /jsonClient-2016-04-30T20_45Z /api/access; | |
add_header Access-Control-Allow-Origin $http_origin; | |
add_header Access-Control-Allow-Methods "POST, GET"; | |
add_header Access-Control-Allow-Credentials true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment