From c81acb5265a6a281d2757710f36e2e6e2e48986e Mon Sep 17 00:00:00 2001 From: davor Date: Tue, 15 Nov 2011 14:04:05 +0100 Subject: Added support for PORT --- aa-local.yaml | 30 +++++++++++++++--------------- aa-server.yaml | 30 +++++++++++++++--------------- config.sh | 1 + nginx.conf | 14 +++++++------- nginx.sh | 5 +++++ opentox-ruby.sh | 4 ++-- production.yaml | 14 +++++++------- 7 files changed, 52 insertions(+), 46 deletions(-) diff --git a/aa-local.yaml b/aa-local.yaml index 260c72e..5ca2b72 100644 --- a/aa-local.yaml +++ b/aa-local.yaml @@ -15,25 +15,25 @@ # Exceptions: :free_uris: #request-method for uri not controlled by A&A ? - :GET - : - !ruby/regexp /http:\/\/ESCAPEDSERVER\/algorithm/ - - "http://SERVERNAME/model" - - "http://SERVERNAME/dataset" - - "http://SERVERNAME/validation" - - !ruby/regexp /http:\/\/ESCAPEDSERVER\/validation\/resources/ - - !ruby/regexp /http:\/\/ESCAPEDSERVER\/validation\/[a-z,A-Z,\/,_\-]*$/ + : - !ruby/regexp /http:\/\/ESCAPEDSERVERPORT\/algorithm/ + - "http://SERVERNAMEPORT/model" + - "http://SERVERNAMEPORT/dataset" + - "http://SERVERNAMEPORT/validation" + - !ruby/regexp /http:\/\/ESCAPEDSERVERPORT\/validation\/resources/ + - !ruby/regexp /http:\/\/ESCAPEDSERVERPORT\/validation\/[a-z,A-Z,\/,_\-]*$/ ? - :GET - :POST - : - !ruby/regexp /http:\/\/ESCAPEDSERVER\/toxcreate\/[a-z,A-Z,\/,_\-]*$/ - - !ruby/regexp /http:\/\/ESCAPEDSERVER\/task/ - - !ruby/regexp /http:\/\/ESCAPEDSERVER\/compound/ + : - !ruby/regexp /http:\/\/ESCAPEDSERVERPORT\/toxcreate\/[a-z,A-Z,\/,_\-]*$/ + - !ruby/regexp /http:\/\/ESCAPEDSERVERPORT\/task/ + - !ruby/regexp /http:\/\/ESCAPEDSERVERPORT\/compound/ - !ruby/regexp /sign_(in|out)$/ ? - :PUT - : - !ruby/regexp /http:\/\/ESCAPEDSERVER\/task/ + : - !ruby/regexp /http:\/\/ESCAPEDSERVERPORT\/task/ :authorize_exceptions: #request-method for uri only authenticated, no authorization ? - :POST - : - !ruby/regexp /http:\/\/ESCAPEDSERVER\/algorithm/ - - "http://SERVERNAME/dataset" - - "http://SERVERNAME/model" - - "http://SERVERNAME/validation" - - !ruby/regexp /http\:\/\/ESCAPEDSERVER\/validation\/[a-z,A-Z,\/,_\-]*$/ + : - !ruby/regexp /http:\/\/ESCAPEDSERVERPORT\/algorithm/ + - "http://SERVERNAMEPORT/dataset" + - "http://SERVERNAMEPORT/model" + - "http://SERVERNAMEPORT/validation" + - !ruby/regexp /http\:\/\/ESCAPEDSERVERPORT\/validation\/[a-z,A-Z,\/,_\-]*$/ diff --git a/aa-server.yaml b/aa-server.yaml index 260c72e..5ca2b72 100644 --- a/aa-server.yaml +++ b/aa-server.yaml @@ -15,25 +15,25 @@ # Exceptions: :free_uris: #request-method for uri not controlled by A&A ? - :GET - : - !ruby/regexp /http:\/\/ESCAPEDSERVER\/algorithm/ - - "http://SERVERNAME/model" - - "http://SERVERNAME/dataset" - - "http://SERVERNAME/validation" - - !ruby/regexp /http:\/\/ESCAPEDSERVER\/validation\/resources/ - - !ruby/regexp /http:\/\/ESCAPEDSERVER\/validation\/[a-z,A-Z,\/,_\-]*$/ + : - !ruby/regexp /http:\/\/ESCAPEDSERVERPORT\/algorithm/ + - "http://SERVERNAMEPORT/model" + - "http://SERVERNAMEPORT/dataset" + - "http://SERVERNAMEPORT/validation" + - !ruby/regexp /http:\/\/ESCAPEDSERVERPORT\/validation\/resources/ + - !ruby/regexp /http:\/\/ESCAPEDSERVERPORT\/validation\/[a-z,A-Z,\/,_\-]*$/ ? - :GET - :POST - : - !ruby/regexp /http:\/\/ESCAPEDSERVER\/toxcreate\/[a-z,A-Z,\/,_\-]*$/ - - !ruby/regexp /http:\/\/ESCAPEDSERVER\/task/ - - !ruby/regexp /http:\/\/ESCAPEDSERVER\/compound/ + : - !ruby/regexp /http:\/\/ESCAPEDSERVERPORT\/toxcreate\/[a-z,A-Z,\/,_\-]*$/ + - !ruby/regexp /http:\/\/ESCAPEDSERVERPORT\/task/ + - !ruby/regexp /http:\/\/ESCAPEDSERVERPORT\/compound/ - !ruby/regexp /sign_(in|out)$/ ? - :PUT - : - !ruby/regexp /http:\/\/ESCAPEDSERVER\/task/ + : - !ruby/regexp /http:\/\/ESCAPEDSERVERPORT\/task/ :authorize_exceptions: #request-method for uri only authenticated, no authorization ? - :POST - : - !ruby/regexp /http:\/\/ESCAPEDSERVER\/algorithm/ - - "http://SERVERNAME/dataset" - - "http://SERVERNAME/model" - - "http://SERVERNAME/validation" - - !ruby/regexp /http\:\/\/ESCAPEDSERVER\/validation\/[a-z,A-Z,\/,_\-]*$/ + : - !ruby/regexp /http:\/\/ESCAPEDSERVERPORT\/algorithm/ + - "http://SERVERNAMEPORT/dataset" + - "http://SERVERNAMEPORT/model" + - "http://SERVERNAMEPORT/validation" + - !ruby/regexp /http\:\/\/ESCAPEDSERVERPORT\/validation\/[a-z,A-Z,\/,_\-]*$/ diff --git a/config.sh b/config.sh index ae90af3..dcd4db3 100755 --- a/config.sh +++ b/config.sh @@ -22,6 +22,7 @@ REDIS_NUM_VER="2.2.2" # 4) Server settings. NGINX_SERVERNAME="localhost" WWW_DEST="$OT_PREFIX/www" +PORT="" # leave empty for port 80 otherwise set to e.g. ":8080" # Done. diff --git a/nginx.conf b/nginx.conf index c89efe2..4dcf81a 100644 --- a/nginx.conf +++ b/nginx.conf @@ -8,14 +8,14 @@ http { server_names_hash_bucket_size 256; - passenger_root RUBY_DEST/lib/ruby/gems/1.8/gems/PASSENGER; - passenger_ruby RUBY_DEST/bin/ruby; - passenger_default_user USER; + passenger_root /home/ot0/opentox-ruby/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.9; + passenger_ruby /home/ot0/opentox-ruby/ruby-enterprise-1.8.7-2011.03/bin/ruby; + passenger_default_user ot0; passenger_log_level 2; passenger_spawn_method conservative; #passenger_use_global_queue on; - include NGINX_DEST/conf/mime.types; + include /home/ot0/opentox-ruby/nginx/conf/mime.types; default_type application/octet-stream; sendfile on; @@ -23,11 +23,11 @@ http { # webservices server { - listen 80; + listen PORT; client_max_body_size 5000m; - server_name SERVERNAME; + server_name toxcreate3; location / { - root WWW_DEST; + root /home/ot0/opentox-ruby/www; passenger_enabled on; } passenger_base_uri /compound; diff --git a/nginx.sh b/nginx.sh index 800165e..3a872bc 100755 --- a/nginx.sh +++ b/nginx.sh @@ -53,6 +53,11 @@ servername=`hostname` $GIT checkout nginx.conf>>$LOG 2>&1 cmd="sed -i -e \"s,PASSENGER,$passenger,;s,SERVERNAME,$servername,;s,RUBY_DEST,$RUBY_DEST,;s,NGINX_DEST,$NGINX_DEST,;s,WWW_DEST,$WWW_DEST,\" ./nginx.conf" && run_cmd "$cmd" "Config" cmd="sed -i -e \"s,USER,`whoami`,\" ./nginx.conf" && run_cmd "$cmd" "User" +PORT=`echo "$PORT" | sed 's/^.//g'` +if [ -z "$PORT" ]; then + PORT=80 +fi +cmd="sed -i -e \"s,PORT,$PORT,\" ./nginx.conf" && run_cmd "$cmd" "Port" cmd="cp ./nginx.conf \"$NGINX_DEST/conf\"" && run_cmd "$cmd" "Copy" if [ ! -f $NGINX_CONF ]; then diff --git a/opentox-ruby.sh b/opentox-ruby.sh index 70d502b..03d6316 100755 --- a/opentox-ruby.sh +++ b/opentox-ruby.sh @@ -71,8 +71,8 @@ mkdir -p "$HOME/.opentox/tmp" >>$LOG 2>&1 $GIT checkout production.yaml >>$LOG 2>&1 $GIT checkout aa-$OT_INSTALL.yaml >>$LOG 2>&1 -cmd="sed -e \"s,SERVERNAME,$servername,;s,ESCAPEDSERVER,$escapedserver,;s,LOGGER,$logger,;s,AA,$aa,;s,WWW_DEST,$WWW_DEST,\" production.yaml > $HOME/.opentox/config/production.yaml" && run_cmd "$cmd" "Config 1" -cmd="sed -e \"s,SERVERNAME,$servername,;s,ESCAPEDSERVER,$escapedserver,;s,LOGGER,$logger,;s,AA,$aa,;s,WWW_DEST,$WWW_DEST,\" aa-$OT_INSTALL.yaml >> $HOME/.opentox/config/production.yaml" && run_cmd "$cmd" "Config 1" +cmd="sed -e \"s,SERVERNAME,$servername,;s,ESCAPEDSERVER,$escapedserver,;s,LOGGER,$logger,;s,AA,$aa,;s,WWW_DEST,$WWW_DEST,;s,PORT,$PORT,\" production.yaml > $HOME/.opentox/config/production.yaml" && run_cmd "$cmd" "Config 1" +cmd="sed -e \"s,SERVERNAME,$servername,;s,ESCAPEDSERVER,$escapedserver,;s,LOGGER,$logger,;s,AA,$aa,;s,WWW_DEST,$WWW_DEST,;s,PORT,$PORT,\" aa-$OT_INSTALL.yaml >> $HOME/.opentox/config/production.yaml" && run_cmd "$cmd" "Config 1" if [ "$OT_BRANCH" = "development" ] || expr match "$OT_BRANCH" "release"; then mkdir -p $WWW_DEST/opentox >>$LOG 2>&1 diff --git a/production.yaml b/production.yaml index 09efad0..d133cd0 100644 --- a/production.yaml +++ b/production.yaml @@ -2,13 +2,13 @@ :services: # make sure to enter a full uri (including training slash) - opentox-compound: "http://SERVERNAME/compound/" - opentox-dataset: "http://SERVERNAME/dataset/" - opentox-algorithm: "http://SERVERNAME/algorithm/" - opentox-model: "http://SERVERNAME/model/" - opentox-task: "http://SERVERNAME/task/" - opentox-toxcreate: "http://SERVERNAME/toxcreate/" - opentox-validation: "http://SERVERNAME/validation/" + opentox-compound: "http://SERVERNAMEPORT/compound/" + opentox-dataset: "http://SERVERNAMEPORT/dataset/" + opentox-algorithm: "http://SERVERNAMEPORT/algorithm/" + opentox-model: "http://SERVERNAMEPORT/model/" + opentox-task: "http://SERVERNAMEPORT/task/" + opentox-toxcreate: "http://SERVERNAMEPORT/toxcreate/" + opentox-validation: "http://SERVERNAMEPORT/validation/" opentox-ontology: "http://apps.ideaconsult.net:8080/ontology" :json_hosts: -- cgit v1.2.3