Bläddra i källkod

Fixing a lot of production-only issues

msmith-techempower 10 år sedan
förälder
incheckning
9923de5077
32 ändrade filer med 66 tillägg och 41 borttagningar
  1. 4 9
      config/create.sql
  2. 1 1
      frameworks/C/onion/hello.c
  3. 2 0
      frameworks/C/onion/setup.sh
  4. 2 0
      frameworks/Clojure/pedestal/setup.sh
  5. 1 1
      frameworks/Clojure/pedestal/src/pedestal/service.clj
  6. 2 2
      frameworks/Elixir/phoenix/setup.sh
  7. 3 1
      frameworks/Java/jawn/setup.sh
  8. 2 3
      frameworks/Java/jawn/src/main/java/app/config/Database.java
  9. 2 2
      frameworks/Java/mangooio/setup.sh
  10. 2 2
      frameworks/Java/mangooio/src/main/resources/application.conf
  11. 1 1
      frameworks/Java/play2-java/play2-java-jpa-bonecp/conf/application.conf
  12. 2 0
      frameworks/Java/play2-java/setup_java_ebean_bonecp.sh
  13. 2 0
      frameworks/Java/play2-java/setup_java_ebean_hikaricp.sh
  14. 2 0
      frameworks/Java/play2-java/setup_java_jpa_bonecp.sh
  15. 2 0
      frameworks/Java/play2-java/setup_java_jpa_hikaricp.sh
  16. 1 1
      frameworks/JavaScript/hapi/handlers/redis.js
  17. 5 2
      frameworks/JavaScript/hapi/setup.sh
  18. 1 1
      frameworks/JavaScript/nodejs/handlers/redis.js
  19. 5 2
      frameworks/JavaScript/nodejs/setup.sh
  20. 1 1
      frameworks/JavaScript/sailsjs/api/controllers/RedisController.js
  21. 1 0
      frameworks/JavaScript/sailsjs/setup.sh
  22. 2 0
      frameworks/Python/AsyncIO/aiohttp.web/setup.sh
  23. 2 2
      frameworks/Python/cherrypy/app.py
  24. 2 0
      frameworks/Python/cherrypy/setup.sh
  25. 2 0
      frameworks/Python/cherrypy/setup_py3.sh
  26. 1 1
      frameworks/Python/historical/webware/app/Configs/AppServer.config
  27. 1 3
      frameworks/Python/klein/app.py
  28. 2 0
      frameworks/Python/klein/setup.sh
  29. 3 0
      frameworks/Scala/akka-http/setup.sh
  30. 3 4
      frameworks/Scala/akka-http/src/main/resources/application.conf
  31. 2 1
      toolset/setup/linux/frameworks/jester.sh
  32. 2 1
      toolset/setup/linux/languages/php.sh

+ 4 - 9
config/create.sql

@@ -1,12 +1,3 @@
-# create benchmark user
-REVOKE ALL ON *.* FROM 'benchmarkdbuser'@'%';
-REVOKE ALL ON *.* FROM 'benchmarkdbuser'@'localhost';
-
-GRANT ALL ON hello_world.world TO 'benchmarkdbuser'@'%' IDENTIFIED BY 'benchmarkdbpass';
-GRANT ALL ON hello_world.world TO 'benchmarkdbuser'@'localhost' IDENTIFIED BY 'benchmarkdbpass';
-GRANT SELECT ON hello_world.fortune TO 'benchmarkdbuser'@'%' IDENTIFIED BY 'benchmarkdbpass';
-GRANT SELECT ON hello_world.fortune TO 'benchmarkdbuser'@'localhost' IDENTIFIED BY 'benchmarkdbpass';
-
 # modified from SO answer http://stackoverflow.com/questions/5125096/for-loop-in-mysql
 DROP DATABASE IF EXISTS hello_world;
 CREATE DATABASE hello_world;
@@ -19,6 +10,8 @@ CREATE TABLE  World (
   PRIMARY KEY  (id)
 )
 ENGINE=INNODB;
+GRANT ALL ON hello_world.world TO 'benchmarkdbuser'@'%' IDENTIFIED BY 'benchmarkdbpass';
+GRANT ALL ON hello_world.world TO 'benchmarkdbuser'@'localhost' IDENTIFIED BY 'benchmarkdbpass';
 
 DROP PROCEDURE IF EXISTS load_data;
 
@@ -100,6 +93,8 @@ CREATE TABLE  fortune (
   PRIMARY KEY  (id)
 )
 ENGINE=INNODB;
+GRANT SELECT ON hello_world.fortune TO 'benchmarkdbuser'@'%' IDENTIFIED BY 'benchmarkdbpass';
+GRANT SELECT ON hello_world.fortune TO 'benchmarkdbuser'@'localhost' IDENTIFIED BY 'benchmarkdbpass';
 
 INSERT INTO fortune (message) VALUES ('fortune: No such file or directory');
 INSERT INTO fortune (message) VALUES ('A computer scientist is someone who fixes things that aren''t broken.');

+ 1 - 1
frameworks/C/onion/hello.c

@@ -334,7 +334,7 @@ int main(void){
 			ONION_ERROR("Cant create db connection: %s", mysql_error(data.db[i]));
 			return 1;
 		}
-		if (mysql_real_connect(data.db[i], "localhost", 
+		if (mysql_real_connect(data.db[i], "127.0.0.1", 
                         "benchmarkdbuser", "benchmarkdbpass", "hello_world", 0, NULL, 0) == NULL) {
 			ONION_ERROR("Error %u: %s\n", mysql_errno(data.db[i]), mysql_error(data.db[i]));
 			return 1;

+ 2 - 0
frameworks/C/onion/setup.sh

@@ -2,6 +2,8 @@
 
 fw_depends onion
 
+sed -i 's|127.0.0.1|'${DBHOST}'|g' hello.c
+
 make clean
 ln -s $IROOT/onion onion
 rm -f onion/build/CMakeCache.txt

+ 2 - 0
frameworks/Clojure/pedestal/setup.sh

@@ -2,6 +2,8 @@
 
 fw_depends java7 leiningen
 
+sed -i 's|127.0.0.1:3306|'${DBHOST}':3306|g' src/pedestal/service.clj
+
 lein clean
 
 rm -rf target

+ 1 - 1
frameworks/Clojure/pedestal/src/pedestal/service.clj

@@ -25,7 +25,7 @@
   (mysql {
     :classname "com.mysql.jdbc.Driver"
     :subprotocol "mysql"
-    :subname "//localhost:3306/hello_world"
+    :subname "//127.0.0.1:3306/hello_world"
     :user "benchmarkdbuser"
     :password "benchmarkdbpass"
     ;;OPTIONAL KEYS

+ 2 - 2
frameworks/Elixir/phoenix/setup.sh

@@ -1,9 +1,9 @@
 #!/bin/bash
 
-sed -i 's|db_host: "localhost",|db_host: "${DBHOST}",|g' config/config.exs
-
 fw_depends elixir
 
+sed -i 's|localhost|'${DBHOST}'|g' config/prod.exs
+
 rm -rf _build deps rel
 
 MIX_ENV=prod

+ 3 - 1
frameworks/Java/jawn/setup.sh

@@ -2,6 +2,8 @@
 
 fw_depends java8
 
+sed -i 's|127.0.0.1|'${DBHOST}'|g' src/main/java/app/config/Database.java
+
 ./gradlew clean --daemon
 
-./gradlew run -Pargs=production,$DBHOST
+./gradlew run -Pargs=production &

+ 2 - 3
frameworks/Java/jawn/src/main/java/app/config/Database.java

@@ -22,11 +22,10 @@ public class Database implements ApplicationDatabaseBootstrap {
                 "&useUnbufferedInput=false" +
                 "&useReadAheadInput=false" +
                 "&maintainTimeStats=false" +
-                "&useServerPrepStmts" +
+                "&useServerPrepStmts=true" +
                 "&cacheRSMetadata=true";
         
-        String host = System.getProperty("DBHOST", "localhost");
-        String dbUrl = "jdbc:mysql://"+host+"/hello_world?";
+        String dbUrl = "jdbc:mysql://127.0.0.1:3306/hello_world?";
         
         
         connections

+ 2 - 2
frameworks/Java/mangooio/setup.sh

@@ -1,9 +1,9 @@
 #!/bin/bash
 
-sed -i 's|mongodb.host=.*|mongodb.host='"${DBHOST}"'|g' src/main/resources/application.conf
-
 fw_depends java8 maven
 
+sed -i 's|mongodb.host=.*|mongodb.host='${DBHOST}'|g' src/main/resources/application.conf
+
 mvn clean package -Dmaven.test.skip=true
 
 java -jar target/mangooioapp.jar &

+ 2 - 2
frameworks/Java/mangooio/src/main/resources/application.conf

@@ -9,7 +9,7 @@
 # would overwrite the property
 # myproperty=my property
 
-application.host=localhost
+application.host=0.0.0.0
 application.port=8080
 %test.application.host=localhost
 %test.application.port=10808
@@ -31,7 +31,7 @@ smtp.username=
 smtp.password=
 smtp.ssl=false
 
-mongodb.host127.0.0.1
+mongodb.host=127.0.0.1
 mongodb.port=27017           
 mongodb.dbname=hello_world     
 mongodb.user=         

+ 1 - 1
frameworks/Java/play2-java/play2-java-jpa-bonecp/conf/application.conf

@@ -30,7 +30,7 @@ application.langs="en"
 # You can expose this datasource via JNDI if needed (Useful for JPA)
 # db.default.jndiName=DefaultDS
 db.default.driver= com.mysql.jdbc.Driver
-db.default.url="jdbc:mysql://localhost:3306/hello_world?jdbcCompliantTruncation=false&elideSetAutoCommits=true&useLocalSessionState=true&cachePrepStmts=true&cacheCallableStmts=true&alwaysSendSetIsolation=false&prepStmtCacheSize=4096&cacheServerConfiguration=true&prepStmtCacheSqlLimit=2048&zeroDateTimeBehavior=convertToNull&traceProtocol=false&useUnbufferedInput=false&useReadAheadInput=false&maintainTimeStats=false&useServerPrepStmts&cacheRSMetadata=true"
+db.default.url="jdbc:mysql://127.0.0.1:3306/hello_world?jdbcCompliantTruncation=false&elideSetAutoCommits=true&useLocalSessionState=true&cachePrepStmts=true&cacheCallableStmts=true&alwaysSendSetIsolation=false&prepStmtCacheSize=4096&cacheServerConfiguration=true&prepStmtCacheSqlLimit=2048&zeroDateTimeBehavior=convertToNull&traceProtocol=false&useUnbufferedInput=false&useReadAheadInput=false&maintainTimeStats=false&useServerPrepStmts&cacheRSMetadata=true"
 db.default.user=benchmarkdbuser
 db.default.password=benchmarkdbpass
 db.default.jndiName=DefaultDS

+ 2 - 0
frameworks/Java/play2-java/setup_java_ebean_bonecp.sh

@@ -2,6 +2,8 @@
 
 fw_depends java8 sbt
 
+sed -i 's|127.0.0.1:3306|'${DBHOST}':3306|g' play2-java-ebean-bonecp/conf/application.conf
+
 cd play2-java-ebean-bonecp
 
 rm -rf target/universal/stage/RUNNING_PID

+ 2 - 0
frameworks/Java/play2-java/setup_java_ebean_hikaricp.sh

@@ -2,6 +2,8 @@
 
 fw_depends java8 sbt
 
+sed -i 's|127.0.0.1|'${DBHOST}'|g' play2-java-ebean-hikaricp/conf/application.conf
+
 cd play2-java-ebean-hikaricp
 
 rm -rf target/universal/stage/RUNNING_PID

+ 2 - 0
frameworks/Java/play2-java/setup_java_jpa_bonecp.sh

@@ -2,6 +2,8 @@
 
 fw_depends java8 sbt
 
+sed -i 's|127.0.0.1|'${DBHOST}'|g' play2-java-jpa-bonecp/conf/application.conf
+
 cd play2-java-jpa-bonecp
 
 rm -rf target/universal/stage/RUNNING_PID

+ 2 - 0
frameworks/Java/play2-java/setup_java_jpa_hikaricp.sh

@@ -2,6 +2,8 @@
 
 fw_depends java8 sbt
 
+sed -i 's|127.0.0.1|'${DBHOST}'|g' play2-java-jpa-hikaricp/conf/application.conf
+
 cd play2-java-jpa-hikaricp
 
 rm -rf target/universal/stage/RUNNING_PID

+ 1 - 1
frameworks/JavaScript/hapi/handlers/redis.js

@@ -10,7 +10,7 @@ var Promise = require('bluebird');
 // Can treat redis library as one that supports Promises
 // these methods will then have "-Async" appended to them.
 var redis = Promise.promisifyAll(require('redis'));
-var client = redis.createClient();
+var client = redis.createClient(6379, '127.0.0.1', {});
 
 client.on('error', function (err) {
   console.log('Redis Error: ' + err);

+ 5 - 2
frameworks/JavaScript/hapi/setup.sh

@@ -1,8 +1,11 @@
 #!/bin/bash
 
-sed -i 's|localhost|'"${DBHOST}"'|g' app.js
-
 fw_depends nodejs
 
+sed -i 's|127.0.0.1|'"${DBHOST}"'|g' handlers/mongoose.js
+sed -i 's|127.0.0.1|'"${DBHOST}"'|g' handlers/sequelize-postgres.js
+sed -i 's|127.0.0.1|'"${DBHOST}"'|g' handlers/sequelize.js
+sed -i 's|127.0.0.1|'"${DBHOST}"'|g' handlers/redis.js
+
 npm install
 node app &

+ 1 - 1
frameworks/JavaScript/nodejs/handlers/redis.js

@@ -4,7 +4,7 @@ var async = require('async');
 // Otherwise, a pure JavaScript parser will be used."
 // >> hiredis is installed for these tests
 var redis = require('redis');
-var client = redis.createClient();
+var client = redis.createClient(6379, '127.0.0.1', {});
 
 client.on('error', function (err) {
   console.log('Redis Error: ' + err);

+ 5 - 2
frameworks/JavaScript/nodejs/setup.sh

@@ -2,8 +2,11 @@
 
 fw_depends nodejs
 
-sed -i 's|localhost|'"${DBHOST}"'|g' app.js
-sed -i 's|mongodb://.*/hello_world|mongodb://'"${DBHOST}"'/hello_world|g' app.js
+sed -i 's|127.0.0.1|'"${DBHOST}"'|g' handlers/mongodb-raw.js
+sed -i 's|127.0.0.1|'"${DBHOST}"'|g' handlers/mongoose.js
+sed -i 's|127.0.0.1|'"${DBHOST}"'|g' handlers/mysql-raw.js
+sed -i 's|127.0.0.1|'"${DBHOST}"'|g' handlers/redis.js
+sed -i 's|127.0.0.1|'"${DBHOST}"'|g' handlers/sequelize.js
 
 npm install
 node app.js &

+ 1 - 1
frameworks/JavaScript/sailsjs/api/controllers/RedisController.js

@@ -13,7 +13,7 @@ var Promise = require('bluebird')
 // Can treat redis library as one that supports Promises
 // these methods will then have "-Async" appended to them.
 var redis = Promise.promisifyAll(require('redis'))
-var client = redis.createClient()
+var client = redis.createClient(6379, '127.0.0.1', {})
 
 client.on('error', function (err) {
   console.log('Redis Error: ' + err)

+ 1 - 0
frameworks/JavaScript/sailsjs/setup.sh

@@ -2,6 +2,7 @@
 
 fw_depends nodejs
 
+sed -i 's|127.0.0.1|'"${DBHOST}"'|g' api/controllers/Redis.js
 sed -i 's|127.0.0.1|'"${DBHOST}"'|g' api/controllers/SequelizeMySQLController.js
 sed -i 's|127.0.0.1|'"${DBHOST}"'|g' api/controllers/SequelizePostgresController.js
 

+ 2 - 0
frameworks/Python/AsyncIO/aiohttp.web/setup.sh

@@ -2,6 +2,8 @@
 
 fw_depends python3
 
+sed -i 's|host: 127.0.0.1|host: '${DBHOST}'|g' aiohttp.web/etc/hello/main/main.yaml
+
 pip install --install-option="--prefix=${PY3_ROOT}" -r $TROOT/requirements.txt
 
 cd $TROOT/aiohttp.web

+ 2 - 2
frameworks/Python/cherrypy/app.py

@@ -119,11 +119,11 @@ if __name__ == "__main__":
     # Register the SQLAlchemy plugin
     from saplugin import SAEnginePlugin
     DBDRIVER = 'mysql'
-    DBHOSTNAME = os.environ.get('DBHOST', 'localhost')
-    DATABASE_URI = '%s://benchmarkdbuser:benchmarkdbpass@%s:3306/hello_world?charset=utf8' % (DBDRIVER, DBHOSTNAME)
+    DATABASE_URI = '%s://benchmarkdbuser:[email protected]:3306/hello_world?charset=utf8' % (DBDRIVER)
     SAEnginePlugin(cherrypy.engine, DATABASE_URI).subscribe()
     
     # Register the SQLAlchemy tool
     from satool import SATool
     cherrypy.tools.db = SATool()
+    cherrypy.server.socket_host = '0.0.0.0'
     cherrypy.quickstart(CherryPyBenchmark(), '', {'/': {'tools.db.on': True}})

+ 2 - 0
frameworks/Python/cherrypy/setup.sh

@@ -2,6 +2,8 @@
 
 fw_depends python2
 
+sed -i 's|127.0.0.1|'${DBHOST}'|g' app.py
+
 pip install --install-option="--prefix=${PY2_ROOT}" -r $TROOT/requirements.txt
 
 python app.py &

+ 2 - 0
frameworks/Python/cherrypy/setup_py3.sh

@@ -2,6 +2,8 @@
 
 fw_depends python3
 
+sed -i 's|127.0.0.1|'${DBHOST}'|g' app.py
+
 pip install --install-option="--prefix=${PY3_ROOT}" -r $TROOT/requirements.txt
 
 python3 app.py &

+ 1 - 1
frameworks/Python/historical/webware/app/Configs/AppServer.config

@@ -7,7 +7,7 @@ PlugInDirs = [WebwarePath] # load all Webware plug-ins
 PlugIns = [] # use this if you want to load specific plug-ins only
 
 # This is the IP address at which the application server will listen:
-Host = 'localhost' # use '' for listening on all network interfaces
+Host = '' # use '' for listening on all network interfaces
 
 EnableAdapter = True # enable WebKit adapter
 AdapterPort = 8086

+ 1 - 3
frameworks/Python/klein/app.py

@@ -22,9 +22,7 @@ from sqlalchemy.orm import sessionmaker
 if sys.version_info[0] == 3:
     xrange = range
 
-DBDRIVER = 'mysql'
-DBHOSTNAME = os.environ.get('DBHOST', 'localhost')
-DATABASE_URI = '%s://benchmarkdbuser:benchmarkdbpass@%s:3306/hello_world?charset=utf8' % (DBDRIVER, DBHOSTNAME)
+DATABASE_URI = 'mysql://benchmarkdbuser:[email protected]:3306/hello_world?charset=utf8'
 
 Base = declarative_base()
 db_engine = create_engine(DATABASE_URI)

+ 2 - 0
frameworks/Python/klein/setup.sh

@@ -2,6 +2,8 @@
 
 fw_depends python2
 
+sed -i 's|127.0.0.1|'${DBHOST}'|g' app.py
+
 pip install --install-option="--prefix=${PY2_ROOT}" -r $TROOT/requirements.txt
 
 python app.py &

+ 3 - 0
frameworks/Scala/akka-http/setup.sh

@@ -2,6 +2,9 @@
 
 fw_depends java8 sbt
 
+sed -i 's|dbhost: "0.0.0.0"|dbhost: "'${DBHOST}'"|g' src/main/resources/application.conf
+sed -i 's|0.0.0.0:3306|'${DBHOST}':3306|g' src/main/resources/application.conf
+
 sbt 'assembly'
 
 java -server -jar target/scala-2.11/akka-http-benchmark.jar &

+ 3 - 4
frameworks/Scala/akka-http/src/main/resources/application.conf

@@ -10,10 +10,9 @@ akka {
       port: 9000
       mysql {
         dbhost: "0.0.0.0"
-        dbhost: ${?DATABASE_HOST}
-        dbuser: root
-        dbpass: ""
-        jdbc-url: "jdbc:mysql://"${akka.http.benchmark.mysql.dbhost}":3306/hello_world?jdbcCompliantTruncation=false&elideSetAutoCommits=true&useLocalSessionState=true&cachePrepStmts=true&cacheCallableStmts=true&alwaysSendSetIsolation=false&prepStmtCacheSize=4096&cacheServerConfiguration=true&prepStmtCacheSqlLimit=2048&zeroDateTimeBehavior=convertToNull&traceProtocol=false&useUnbufferedInput=false&useReadAheadInput=false&maintainTimeStats=false&useServerPrepStmts&cacheRSMetadata=true"
+        dbuser: "benchmarkdbuser"
+        dbpass: "benchmarkdbpass"
+        jdbc-url: "jdbc:mysql://0.0.0.0:3306/hello_world?jdbcCompliantTruncation=false&elideSetAutoCommits=true&useLocalSessionState=true&cachePrepStmts=true&cacheCallableStmts=true&alwaysSendSetIsolation=false&prepStmtCacheSize=4096&cacheServerConfiguration=true&prepStmtCacheSqlLimit=2048&zeroDateTimeBehavior=convertToNull&traceProtocol=false&useUnbufferedInput=false&useReadAheadInput=false&maintainTimeStats=false&useServerPrepStmts&cacheRSMetadata=true"
         min-idle: 30
         max-idle: 30
         max-total: -1

+ 2 - 1
toolset/setup/linux/frameworks/jester.sh

@@ -14,7 +14,8 @@ cd jester
 # 2015-06-25
 git checkout 71b8cc069a0d271d619c2dc41bc6479047885587
 nimble update
-nimble install
+# If /home/testrunner/.nimble/pkgs/jester exists, write over it.
+echo 'y' | nimble install
 
 echo "export JESTER_HOME=${JESTER}" > $IROOT/jester.installed
 

+ 2 - 1
toolset/setup/linux/languages/php.sh

@@ -52,7 +52,8 @@ printf "\n" | $PHP_HOME/bin/pecl -q install -f yaf
 # phalcon.so
 #   The configure seems broken, does not respect prefix. If you 
 #   update the value of PATH then it finds the prefix from `which php`
-git clone --depth=1 --branch=phalcon-v1.3.2 --single-branch \
+git clone --depth=1 --branch=phalcon-v1.3.2 \ 
+  # This option doesn't work on older versions of git # --single-branch \
   --quiet git://github.com/phalcon/cphalcon.git
 cd cphalcon/build/64bits 
 $PHP_HOME/bin/phpize