Exemple #1
0
def start(args):
  setup_util.replace_text("lift-stateless/src/main/scala/Main.scala", "> \".*:3306", "> \"" + args.database_host + ":3306")

  subprocess.check_call("../sbt/sbt update assembly", shell=True, cwd="lift-stateless")
  subprocess.Popen("./run", shell=True, cwd="lift-stateless")

  return 0
def start(args):
    setup_util.replace_text(
        "php-symfony2/app/config/parameters.yml", "database_host: .*", "database_host: " + args.database_host
    )
    setup_util.replace_text(
        "php-symfony2/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks"
    )

    try:
        subprocess.check_call("composer.phar install", shell=True, cwd="php-symfony2")
        subprocess.check_call("php app/console cache:clear --env=prod --no-debug", shell=True, cwd="php-symfony2")
        subprocess.check_call("sudo chown -R www-data:www-data php-symfony2", shell=True)
        subprocess.check_call(
            "sudo php-fpm --fpm-config config/php-fpm.conf -g "
            + home
            + "/FrameworkBenchmarks/php-symfony2/deploy/php-fpm.pid",
            shell=True,
        )
        subprocess.check_call(
            "sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-symfony2/deploy/nginx.conf",
            shell=True,
        )
        return 0
    except subprocess.CalledProcessError:
        return 1
def start(args, logfile, errfile):
  setup_util.replace_text("lapis/config.lua", "DBHOSTNAME", args.database_host)
  setup_util.replace_text("lapis/nginx.conf", "DBHOSTNAME", args.database_host)
  #subprocess.Popen('/usr/local/openresty/nginx/sbin/nginx -c `pwd`/nginx.conf -g "worker_processes ' + str((args.max_threads)) + ';"', shell=True, cwd="lapis", stderr=errfile, stdout=logfile)
  subprocess.Popen('lapis server production', shell=True, cwd="lapis", stderr=errfile, stdout=logfile)

  return 0
def start(args, logfile, errfile, cwd="wt"):
    setup_util.replace_text("wt/benchmark.cpp", "INSERT_DB_HOST_HERE", args.database_host)
    subprocess.check_call(
        "g++ -O3 -DNDEBUG -std=c++0x -L/usr/local/lib -I/usr/local/include -o benchmark.wt benchmark.cpp -lwt -lwthttp -lwtdbo -lwtdbomysql -lboost_thread",
        shell=True,
        cwd=cwd,
        stderr=errfile,
        stdout=logfile,
    )
    os.environ["LD_LIBRARY_PATH"] = "/usr/local/lib:" + os.environ.get("LD_LIBRARY_PATH", ".")
    subprocess.Popen(
        [
            "./benchmark.wt",
            "-c",
            "wt_config.xml",
            "-t",
            str(args.max_threads * 4),
            "--docroot",
            ".",
            "--http-address",
            "0.0.0.0",
            "--http-port",
            "8080",
            "--accesslog=-",
            "--no-compression",
        ],
        cwd=cwd,
        stderr=errfile,
        stdout=logfile,
    )
    return 0
def start(args, logfile, errfile):
    global proc
    setup_util.replace_text("bottle/app.py", "DBHOSTNAME", args.database_host)
    proc = subprocess.Popen(
        [bin_dir + "/gunicorn", "-c", "gunicorn_conf.py", "app:app"],
        cwd="bottle", stderr=errfile, stdout=logfile)
    return 0
Exemple #6
0
def start(args, logfile, errfile):

  fwroot = args.fwroot

  try:
    ulib_root = subprocess.check_output('printf $ULIB_ROOT', shell=True, stderr=errfile)

    fcfg = ulib_root + "/benchmark.cfg"

    # 1. Change ULib Server configuration

    # I don't understand if the two approach are different...
    #threads = str(args.max_threads)
    PROCS = str(multiprocessing.cpu_count())
    setup_util.replace_text(fcfg, "PREFORK_CHILD .*", "PREFORK_CHILD " + PROCS)

    fprg = ulib_root + "/bin/userver_tcp"

    # 2. Start ULib Server (userver_tcp)
    logfile.write("ULib: trying to start server %s -c %s\n" % (fprg, fcfg))

    # sudo mysqlcheck -v -r -A -u benchmarkdbuser -p
    os.putenv("ORM_DRIVER","mysql")
    os.putenv("ORM_OPTION","host=" + args.database_host + " user=benchmarkdbuser password=benchmarkdbpass dbname=hello_world")
    os.putenv("UMEMPOOL", "1583,1507,-19,45,16458,523,-27,-14,34")

    # Run in the background, but keep stdout/stderr for easy debugging
    subprocess.Popen( "%s -c %s" % (fprg, fcfg), shell=True, stdout=logfile, stderr=errfile)
    # subprocess.Popen("UTRACE=\"0 50M\" " + fprg + " -c " + fcfg, shell=True, stdout=logfile, stderr=errfile)

    logfile.write("ULib: server STARTED\n")
    return 0
  except subprocess.CalledProcessError:
    return 1
Exemple #7
0
def start(args, logfile, errfile):
    setup_util.replace_text("rails/config/database.yml", "host: .*", "host: " + args.database_host)
    try:
        subprocess.check_call(
            "rvm ruby-2.0.0-p0 do bundle install --gemfile=Gemfile-ruby",
            shell=True,
            cwd="rails",
            stderr=errfile,
            stdout=logfile,
        )
        subprocess.check_call("cp Gemfile-ruby Gemfile", shell=True, cwd="rails", stderr=errfile, stdout=logfile)
        subprocess.check_call(
            "cp Gemfile-ruby.lock Gemfile.lock", shell=True, cwd="rails", stderr=errfile, stdout=logfile
        )
        subprocess.check_call(
            "sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/rails/config/nginx.conf",
            shell=True,
            stderr=errfile,
            stdout=logfile,
        )
        subprocess.Popen(
            "rvm ruby-2.0.0-p0 do bundle exec unicorn_rails -E production -c config/unicorn.rb",
            shell=True,
            cwd="rails",
            stderr=errfile,
            stdout=logfile,
        )
        return 0
    except subprocess.CalledProcessError:
        return 1
def start(args, logfile, errfile):
  setup_util.replace_text("vertx/app.js", "host: '.*'", "host: '" + args.database_host + "'")
  try:
    subprocess.Popen("vertx run app.js", shell=True, cwd="vertx", stderr=errfile, stdout=logfile)
    return 0
  except subprocess.CalledProcessError:
    return 1
Exemple #9
0
def start(args):
  setup_util.replace_text("play1/conf/application.conf", "jdbc:mysql:\/\/.*:3306", "jdbc:mysql://" + args.database_host + ":3306")
  subprocess.check_call("play1 start --%prod", shell=True, cwd="play1")
#  subprocess.check_call("rm -rf $RESIN_HOME/webapps/*", shell=True)
#  subprocess.check_call("play1 war -o $RESIN_HOME/webapps/play1 --exclude benchmark_config", shell=True, cwd="play1")
#  subprocess.check_call("$RESIN_HOME/bin/resinctl start", shell=True)
  return 0
Exemple #10
0
def start(args, logfile, errfile):
    setup_util.replace_text("hhvm/once.php.inc", "host=localhost;", "host=" + args.database_host + ";")
    setup_util.replace_text(
        "hhvm/deploy/config.hdf",
        "SourceRoot = .*\/FrameworkBenchmarks",
        "SourceRoot = " + home + "/FrameworkBenchmarks",
    )
    setup_util.replace_text(
        "hhvm/deploy/config.hdf", "Path = .*\/.hhvm.hhbc", "Path = " + home + "/FrameworkBenchmarks/hhvm/.hhvm.bbhc"
    )
    setup_util.replace_text(
        "hhvm/deploy/config.hdf", "PidFile = .*\/hhvm.pid", "PidFile = " + home + "/FrameworkBenchmarks/hhvm/hhvm.pid"
    )
    setup_util.replace_text(
        "hhvm/deploy/config.hdf", "File = .*\/error.log", "File = " + home + "/FrameworkBenchmarks/hhvm/error.log"
    )

    try:
        if os.name == "nt":
            # Not supported !
            return 0
        subprocess.check_call(
            "hhvm --config " + home + "/FrameworkBenchmarks/hhvm/deploy/config.hdf -m daemon",
            shell=True,
            stderr=errfile,
            stdout=logfile,
        )
        return 0
    except subprocess.CalledProcessError:
        return 1
def start(args):
    setup_util.replace_text(cwd + "/server.py", "localhost", args.database_host)

    subprocess.Popen(
        "python %s/FrameworkBenchmarks/tornado/server.py --port=8080 --logging=error" % home, shell=True, cwd=cwd
    )
    return 0
Exemple #12
0
def start(args, logfile, errfile):
  setup_util.replace_text("onion/hello.c", "mysql_real_connect\(data.db\[i\], \".*\",", "mysql_real_connect(data.db[i], \"" + args.database_host + "\",")
  os.putenv("ONION_LOG","noinfo")
  subprocess.call("rm *.o", cwd="onion", shell=True, stderr=errfile, stdout=logfile)
  subprocess.call("cp -R installs/onion/* onion/onion", shell=True, stderr=errfile, stdout=logfile)
  subprocess.Popen("make && ./hello", shell=True, cwd="onion", stderr=errfile, stdout=logfile)
  return 0
Exemple #13
0
def start(args):
  setup_util.replace_text("snap/bench/cfg/db.cfg", "host=\".*\"", "host=\"" + args.database_host + "\"")
  subprocess.check_call("cabal configure", shell=True, cwd="snap/bench")
  subprocess.check_call("cabal build", shell=True, cwd="snap/bench")

  t = str(args.max_threads)
  subprocess.Popen("dist/build/snap-bench/snap-bench +RTS -A" + t + "M -N" + t + " > /dev/null", shell=True, cwd="snap/bench")
  return 0
Exemple #14
0
def start(args, logfile, errfile):
  setup_util.replace_text('undertow-edge/src/main/resources/hello/server.properties', 'DATABASE_HOST', args.database_host)
  try:
    subprocess.check_call("mvn clean package", shell=True, cwd="undertow-edge", stderr=errfile, stdout=logfile)
    subprocess.Popen("java -Djava.library.path=target/ -jar target/undertow-edge-0.1-jar-with-dependencies.jar".rsplit(" "), cwd="undertow-edge", stderr=errfile, stdout=logfile)
    return 0
  except subprocess.CalledProcessError:
    return 1
Exemple #15
0
def start(args):
  setup_util.replace_text("snap/bench/cfg/db.cfg", "host=\".*\"", "host=\"" + args.database_host + "\"")
  subprocess.check_call("cabal install HDBC HDBC-mysql MonadCatchIO-transformers configurator json snap-core snap-server resource-pool", shell=True)  
  subprocess.check_call("cabal configure", shell=True, cwd="snap/bench")
  subprocess.check_call("cabal install", shell=True, cwd="snap/bench")

  subprocess.Popen("dist/build/snap-bench/snap-bench +RTS -N" + str(args.max_threads) + " > /dev/null", shell=True, cwd="snap/bench")
  return 0
def start(args, logfile, errfile):
  setup_util.replace_text("unfiltered/src/main/resources/application.conf", "jdbc:mysql:\/\/.*:3306", "jdbc:mysql://" + args.database_host + ":3306")
  setup_util.replace_text("unfiltered/src/main/resources/application.conf", "maxThreads = \\d+", "maxThreads = " + str(args.max_threads))

  subprocess.check_call("../sbt/sbt assembly", shell=True, cwd="unfiltered", stderr=errfile, stdout=logfile)
  subprocess.Popen("java -jar bench-assembly-1.0.0.jar", shell=True, cwd="unfiltered/target/scala-2.10", stderr=errfile, stdout=logfile)

  return 0
def start(args, logfile, errfile):
  setup_util.replace_text('undertow/src/main/resources/hello/server.properties', 'DATABASE_HOST', args.database_host)
  try:
    subprocess.check_call("mvn clean compile assembly:single", shell=True, cwd="undertow", stderr=errfile, stdout=logfile)
    subprocess.Popen("java -jar undertow-example-0.1-jar-with-dependencies.jar".rsplit(" "), cwd="undertow/target", stderr=errfile, stdout=logfile)
    return 0
  except subprocess.CalledProcessError:
    return 1
Exemple #18
0
def start(args):
  setup_util.replace_text("ringojs/ringo-main.js", "dbHost = '.*';", "dbHost = '" + args.database_host + "';")

  try:
    subprocess.Popen("ringo --production ringo-main.js", shell=True, cwd="ringojs")
    return 0
  except subprocess.CalledProcessError:
    return 1
def start(args):
  setup_util.replace_text("vertx/App.groovy", "host: '.*'", "host: '" + args.database_host + "'")

  try:    
    subprocess.Popen("vertx run WebServer.java", shell=True, cwd="vertx")
    return 0
  except subprocess.CalledProcessError:
    return 1
Exemple #20
0
def start(args, logfile, errfile):
  setup_util.replace_text("onion/hello.c", "mysql_real_connect\(data.db\[i\], \".*\",", "mysql_real_connect(data.db[i], \"" + args.database_host + "\",")
  
  subprocess.call("rm -f *.o", cwd="onion", shell=True, stderr=errfile, stdout=logfile)
  subprocess.call("cp -R $IROOT/onion/ onion/onion", shell=True, stderr=errfile, stdout=logfile)
  subprocess.call("rm CMakeCache.txt", shell=True, cwd="onion/onion/build", stderr=errfile, stdout=logfile)
  subprocess.Popen("make && ./hello", shell=True, cwd="onion", stderr=errfile, stdout=logfile)
  return 0
def start(args):
    setup_util.replace_text(
        cwd + "/server.py", "localhost", args.database_host)

    subprocess.Popen(
        python + " server.py --port=8080 --logging=error",
        shell=True, cwd=cwd)
    return 0
def start(args):
  setup_util.replace_text("snap/bench/cfg/db.cfg", "host=\".*\"", "host=\"" + args.database_host + "\"")
  subprocess.check_call("cabal update", shell=True, cwd="snap/bench")
  subprocess.check_call("cabal install --only-dependencies", shell=True, cwd="snap/bench")
  subprocess.check_call("cabal build", shell=True, cwd="snap/bench")

  subprocess.Popen("dist/build/snap-bench/snap-bench +RTS -A4M -N -qg2 -I0 -G2 > /dev/null", shell=True, cwd="snap/bench")
  return 0
Exemple #23
0
def start(args, logfile, errfile):
    global proc
    setup_util.replace_text(cwd + "/server.py", "localhost", args.database_host)

    proc = subprocess.Popen(
        python + " server.py --port=8080 --logging=error", shell=True, cwd=cwd, stderr=errfile, stdout=logfile
    )
    return 0
Exemple #24
0
def start(args):
  setup_util.replace_text("play-scala-mongodb/conf/application.conf", "localhost:27017", "" + args.database_host + ":27017")

  subprocess.check_call("play dist", shell=True, cwd="play-scala-mongodb")
  subprocess.check_call("unzip play-scala-1.0-SNAPSHOT.zip", shell=True, cwd="play-scala-mongodb/dist")
  subprocess.check_call("chmod +x start", shell=True, cwd="play-scala-mongodb/dist/play-scala-1.0-SNAPSHOT")
  subprocess.Popen("./start", shell=True, cwd="play-scala-mongodb/dist/play-scala-1.0-SNAPSHOT")

  return 0
Exemple #25
0
def start(args):
  setup_util.replace_text("vertx/App.groovy", "host: '.*'", "host: '" + args.database_host + "'")

  try:
    subprocess.check_call("javac WebServer.java -cp $VERTX_HOME/lib/vertx-core-1.3.1.final.jar:$VERTX_HOME/lib/vertx-platform-1.3.1.final.jar:$VERTX_HOME/lib/mustache.jar:$VERTX_HOME/lib/jackson-core-asl-1.9.4.jar:$VERTX_HOME/lib/jackson-mapper-asl-1.9.4.jar:$VERTX_HOME/lib/guava-11.0.2.jar", shell=True, cwd="vertx")
    subprocess.Popen("vertx run App.groovy", shell=True, cwd="vertx")
    return 0
  except subprocess.CalledProcessError:
    return 1
def start(args, logfile, errfile):
  setup_util.replace_text("snap/bench/cfg/db.cfg", "host=\".*\"", "host=\"" + args.database_host + "\"")
  subprocess.check_call("cabal update", shell=True, cwd="snap/bench", stderr=errfile, stdout=logfile)
  subprocess.check_call("cabal install", shell=True, cwd="snap/bench", stderr=errfile, stdout=logfile)
  subprocess.check_call("cabal configure", shell=True, cwd="snap/bench", stderr=errfile, stdout=logfile)
  subprocess.check_call("cabal build", shell=True, cwd="snap/bench", stderr=errfile, stdout=logfile)

  subprocess.Popen("dist/build/snap-bench/snap-bench +RTS -A4M -N -qg2 -I0 -G2", shell=True, cwd="snap/bench", stderr=errfile, stdout=logfile)
  return 0
Exemple #27
0
def start(args):
    setup_util.replace_text("dropwizard/hello-world.yml", "url: jdbc:mysql://.*/hello_world", "url: jdbc:mysql://" + args.database_host + ":3306/hello_world")

    try:
        subprocess.check_call("mvn clean package;", shell=True, cwd="dropwizard")
        subprocess.Popen("java -jar target/hello-world-0.0.1-SNAPSHOT.jar server hello-world.yml", shell=True, cwd="dropwizard")
        return 0
    except subprocess.CalledProcessError:
        return 1
def start(args, logfile, errfile):
  setup_util.replace_text("ninja-standalone/src/main/java/conf/application.conf", "mysql:\/\/.*:3306", "mysql://" + args.database_host + ":3306")
  
  try:
    subprocess.check_call("mvn clean compile assembly:single", shell=True, cwd="ninja-standalone", stderr=errfile, stdout=logfile)
    subprocess.Popen("java -Dninja.port=8080 -jar target/ninja-standalone-0.0.1-SNAPSHOT-jar-with-dependencies.jar", cwd="ninja-standalone", shell=True, stderr=errfile, stdout=logfile)
    return 0
  except subprocess.CalledProcessError:
    return 1
Exemple #29
0
def start(args):
  setup_util.replace_text("django/hello/hello/settings.py", "HOST': '.*'", "HOST': '" + args.database_host + "'")
  setup_util.replace_text("django/hello/hello/settings.py", "\/home\/ubuntu",  home)
  # because pooling doesn't work with meinheld, it's necessary to create a ton of gunicorn threads (think apache pre-fork)
  # to allow the OS to switch processes when waiting for socket I/O.
  #args.max_threads *= 8
  # and go from there until the database server runs out of memory for new threads (connections)
  subprocess.Popen("gunicorn hello.wsgi:application --worker-class=\"egg:meinheld#gunicorn_worker\"  -b 0.0.0.0:8080 -w " + str((args.max_threads * 8)) + " --log-level=critical", shell=True, cwd="django/hello")
  return 0
Exemple #30
0
def start(args):
  setup_util.replace_text("play204-scala/conf/application.conf", "jdbc:mysql:\/\/.*:3306", "jdbc:mysql://" + args.database_host + ":3306")

  subprocess.check_call("play dist", shell=True, cwd="play204-scala")
  subprocess.check_call("unzip play204-scala-1.0-SNAPSHOT.zip", shell=True, cwd="play204-scala/dist")
  subprocess.check_call("chmod +x start", shell=True, cwd="play204-scala/dist/play204-scala-1.0-SNAPSHOT")
  subprocess.Popen("./start", shell=True, cwd="play204-scala/dist/play204-scala-1.0-SNAPSHOT")

  return 0
def start(args, logfile, errfile):
  setup_util.replace_text("php-fuel/fuel/app/config/production/db.php", "localhost", ""+ args.database_host +"")
  setup_util.replace_text("php-fuel/deploy/nginx.conf", "root .*\/FrameworkBenchmarks/php-fuel", "root " + args.troot)

  try:
    if os.name == 'nt':
      subprocess.check_call('icacls "C:\\FrameworkBenchmarks\\php-fuel" /grant "IIS_IUSRS:(OI)(CI)F"', shell=True, stderr=errfile, stdout=logfile)
      subprocess.check_call('appcmd add site /name:PHP /bindings:http/*:8080: /physicalPath:"C:\\FrameworkBenchmarks\\php-fuel"', shell=True, stderr=errfile, stdout=logfile)
      return 0
    subprocess.check_call("sudo chown -R www-data:www-data php-fuel", shell=True, stderr=errfile, stdout=logfile)
    subprocess.check_call("sudo $PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
    return 0
  except subprocess.CalledProcessError:
    return 1
Exemple #32
0
def start(args):
    setup_util.replace_text("bottle/app.py", "DBHOSTNAME", args.database_host)
    try:
        subprocess.check_call('sudo /usr/local/nginx/sbin/nginx -c ' +
                              config_dir + '/nginx_uwsgi.conf',
                              shell=True)
        # Run in the background, but keep stdout/stderr for easy debugging
        subprocess.Popen(bin_dir + '/uwsgi --ini ' + config_dir +
                         '/uwsgi.ini' + ' --processes ' + str(NCPU * 3) +
                         ' --wsgi app:app',
                         shell=True,
                         cwd='bottle')
        return 0
    except subprocess.CalledProcessError:
        return 1
def start(args, logfile, errfile):
    setup_util.replace_text("flask/app.py", "DBHOSTNAME", args.database_host)
    try:
        subprocess.call(
            NGINX_COMMAND,
            shell=True, stdout=logfile, stderr=errfile)

        # Run in the background, but keep stdout/stderr for easy debugging
        subprocess.Popen(bin_dir + '/uwsgi --ini ' + config_dir + '/uwsgi.ini' +
            ' --processes ' + str(NCPU * 3) +
            ' --wsgi app:app',
            shell=True, cwd='flask', stderr=errfile, stdout=logfile)
        return 0
    except subprocess.CalledProcessError:
        return 1
Exemple #34
0
def start(args, logfile, errfile):
  setup_util.replace_text("nawak/model_postgre.nim", "host=.* port=5432",
                          "host=" + args.database_host + " port=5432")
  # compile the app
  subprocess.check_call(
      "nimrod c --threads:on -d:release -d:postgre_model --path:../installs/nawak/nawak -o:nawak_postgre app.nim",
      shell=True, cwd="nawak", stderr=errfile, stdout=logfile)
  # launch mongrel2
  subprocess.check_call("mkdir -p run logs tmp", shell=True, cwd="nawak/conf", stderr=errfile, stdout=logfile)
  subprocess.check_call("sudo m2sh load -config mongrel2.conf", shell=True, cwd="nawak/conf", stderr=errfile, stdout=logfile)
  subprocess.check_call("sudo m2sh start -name test", shell=True, cwd="nawak/conf", stderr=errfile, stdout=logfile)
  
  # launch workers
  subprocess.Popen("./nawak_postgre", shell=True, cwd="nawak", stderr=errfile, stdout=logfile)
  return 0
Exemple #35
0
def start(args):
    setup_util.replace_text("spark/src/main/webapp/WEB-INF/resin-web.xml",
                            "mysql:\/\/.*:3306",
                            "mysql://" + args.database_host + ":3306")

    try:
        subprocess.check_call("mvn clean package", shell=True, cwd="spark")
        subprocess.check_call("rm -rf $RESIN_HOME/webapps/*", shell=True)
        subprocess.check_call(
            "cp spark/target/spark.war $RESIN_HOME/webapps/spark.war",
            shell=True)
        subprocess.check_call("$RESIN_HOME/bin/resinctl start", shell=True)
        return 0
    except subprocess.CalledProcessError:
        return 1
Exemple #36
0
def start(args):
    setup_util.replace_text(
        'undertow/src/main/resources/hello/server.properties', 'DATABASE_HOST',
        args.database_host)
    try:
        subprocess.check_call("mvn clean compile assembly:single",
                              shell=True,
                              cwd="undertow")
        subprocess.Popen(
            "java -jar undertow-example-0.1-jar-with-dependencies.jar".rsplit(
                " "),
            cwd="undertow/target")
        return 0
    except subprocess.CalledProcessError:
        return 1
Exemple #37
0
def start(args):
  setup_util.replace_text("php-laravel/application/config/database.php", "localhost", ""+ args.database_host +"")
  setup_util.replace_text("php-laravel/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")

  try:
    if os.name == 'nt':
      subprocess.check_call('icacls "C:\\FrameworkBenchmarks\\php-laravel" /grant "IIS_IUSRS:(OI)(CI)F"', shell=True)
      subprocess.check_call('appcmd add site /name:PHP /bindings:http/*:8080: /physicalPath:"C:\\FrameworkBenchmarks\\php-laravel\\public"', shell=True)
      return 0
    subprocess.check_call("sudo chown -R www-data:www-data php-laravel", shell=True)
    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-laravel/deploy/php-fpm.pid", shell=True)
    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-laravel/deploy/nginx.conf", shell=True)
    return 0
  except subprocess.CalledProcessError:
    return 1
def start(args):
    setup_util.replace_text(
        "cowboy/src/hello_world_app.erl", "\"benchmarkdbpass\", \".*\", 3306",
        "\"benchmarkdbpass\", \"" + args.database_host + "\", 3306")

    try:
        subprocess.check_call("./rebar get-deps", shell=True, cwd="cowboy")
        subprocess.check_call("./rebar compile", shell=True, cwd="cowboy")
        subprocess.check_call(
            "erl -pa ebin deps/*/ebin +sbwt very_long +swt very_low -s hello_world -noshell -detached",
            shell=True,
            cwd="cowboy")
        return 0
    except subprocess.CalledProcessError:
        return 1
Exemple #39
0
def start(args):
    setup_util.replace_text("django/hello/hello/settings.py", "HOST': '.*'",
                            "HOST': '" + args.database_host + "'")
    setup_util.replace_text("django/hello/hello/settings.py", "\/home\/ubuntu",
                            home)
    # because pooling doesn't work with meinheld, it's necessary to create a ton of gunicorn threads (think apache pre-fork)
    # to allow the OS to switch processes when waiting for socket I/O.
    #args.max_threads *= 8
    # and go from there until the database server runs out of memory for new threads (connections)
    subprocess.Popen(
        "gunicorn hello.wsgi:application --worker-class=\"egg:meinheld#gunicorn_worker\"  -b 0.0.0.0:8080 -w "
        + str((args.max_threads * 8)) + " --log-level=critical",
        shell=True,
        cwd="django/hello")
    return 0
Exemple #40
0
def start(args):
    setup_util.replace_text(
        "elli/src/elli_bench_sup.erl", "\"benchmarkdbpass\", \".*\", 3306",
        "\"benchmarkdbpass\", \"" + args.database_host + "\", 3306")

    try:
        subprocess.check_call("./rebar get-deps", shell=True, cwd="elli")
        subprocess.check_call("./rebar compile", shell=True, cwd="elli")
        subprocess.check_call(
            "erl -pa ebin deps/*/ebin -s elli_bench -noshell -detached",
            shell=True,
            cwd="elli")
        return 0
    except subprocess.CalledProcessError:
        return 1
Exemple #41
0
def start(args, logfile, errfile):
    setup_util.replace_text("cake/app/Config/database.php", "'host' => '.*',",
                            "'host' => '" + args.database_host + "',")
    setup_util.replace_text("cake/deploy/cake", "\".*\/FrameworkBenchmarks",
                            "\"" + home + "/FrameworkBenchmarks")
    setup_util.replace_text("cake/deploy/cake",
                            "Directory .*\/FrameworkBenchmarks",
                            "Directory " + home + "/FrameworkBenchmarks")
    setup_util.replace_text("cake/deploy/nginx.conf",
                            "root .*\/FrameworkBenchmarks",
                            "root " + home + "/FrameworkBenchmarks")

    try:
        if os.name == 'nt':
            setup_util.replace_text("cake/app/Config/core.php", "'Apc'",
                                    "'Wincache'")
            subprocess.check_call(
                'icacls "C:\\FrameworkBenchmarks\\cake" /grant "IIS_IUSRS:(OI)(CI)F"',
                shell=True,
                stderr=errfile,
                stdout=logfile)
            subprocess.check_call(
                'appcmd add site /name:PHP /bindings:http/*:8080: /physicalPath:"C:\\FrameworkBenchmarks\\cake\\app\\webroot"',
                shell=True,
                stderr=errfile,
                stdout=logfile)
            return 0
        #subprocess.check_call("sudo cp cake/deploy/cake /etc/apache2/sites-available/", shell=True)
        #subprocess.check_call("sudo a2ensite cake", shell=True)
        subprocess.check_call("sudo chown -R www-data:www-data cake",
                              shell=True,
                              stderr=errfile,
                              stdout=logfile)
        #subprocess.check_call("sudo /etc/init.d/apache2 start", shell=True)
        subprocess.check_call(
            "sudo php-fpm --fpm-config config/php-fpm.conf -g " + home +
            "/FrameworkBenchmarks/cake/deploy/php-fpm.pid",
            shell=True,
            stderr=errfile,
            stdout=logfile)
        subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home +
                              "/FrameworkBenchmarks/cake/deploy/nginx.conf",
                              shell=True,
                              stderr=errfile,
                              stdout=logfile)
        return 0
    except subprocess.CalledProcessError:
        return 1
Exemple #42
0
def start(args, logfile, errfile):
    setup_util.replace_text(
        "servlet3-cass/src/main/resources/application.properties", "localhost",
        args.database_host)

    try:
        subprocess.check_call("mvn clean compile war:war",
                              shell=True,
                              cwd="servlet3-cass",
                              stderr=errfile,
                              stdout=logfile)
        if os.name == 'nt':
            subprocess.check_call("rmdir /s /q C:\\Java\\resin\\webapps",
                                  shell=True,
                                  stderr=errfile,
                                  stdout=logfile)
            subprocess.check_call("mkdir C:\\Java\\resin\\webapps",
                                  shell=True,
                                  stderr=errfile,
                                  stdout=logfile)
            subprocess.check_call(
                "cp servlet3-cass\\target\\servlet3-cass.war C:\\Java\\resin\\webapps\\servlet3-cass.war",
                shell=True,
                stderr=errfile,
                stdout=logfile)
            subprocess.check_call("C:\\Java\\resin\\bin\\start.bat",
                                  shell=True,
                                  stderr=errfile,
                                  stdout=logfile)
            return 0
        subprocess.check_call("rm -rf $RESIN_HOME/webapps/*",
                              shell=True,
                              stderr=errfile,
                              stdout=logfile)
        subprocess.check_call(
            "cp servlet3-cass/target/servlet3-cass.war $RESIN_HOME/webapps/",
            shell=True,
            stderr=errfile,
            stdout=logfile)
        #    subprocess.call("echo checking connection to TFB DB host: "+args.database_host, shell=True, stderr=errfile, stdout=logfile)
        #    subprocess.call("for i in 1 2 3 4 5; do nc -vz "+args.database_host+" 9160  && echo 'C* ok' && break || echo 'waiting for C*'; sleep 2; if [ $i -eq '5' ]; then echo 'ERROR: failed to connect to Cassandra'; fi; done", shell=True, stderr=errfile, stdout=logfile)
        subprocess.check_call("$RESIN_HOME/bin/resinctl start",
                              shell=True,
                              stderr=errfile,
                              stdout=logfile)
        return 0
    except subprocess.CalledProcessError:
        return 1
def start(args, logfile, errfile):
    if os.name == 'nt':
        return 1

    setup_util.replace_text(app + "/Web.config", "localhost",
                            args.database_host)

    try:
        # build
        subprocess.check_call("rm -rf bin obj",
                              shell=True,
                              cwd=app,
                              stderr=errfile,
                              stdout=logfile)
        subprocess.check_call("xbuild /p:Configuration=Release",
                              shell=True,
                              cwd=app,
                              stderr=errfile,
                              stdout=logfile)

        # nginx
        workers = 'worker_processes ' + str(args.max_threads) + ';'
        subprocess.check_call(
            'echo "upstream mono {\n' +
            ';\n'.join('\tserver 127.0.0.1:' + str(port)
                       for port in range(9001, 9001 + args.max_threads)) +
            ';\n}" > ' + root + '/nginx.upstream.conf',
            shell=True,
            stderr=errfile,
            stdout=logfile)
        subprocess.check_call('sudo /usr/local/nginx/sbin/nginx -c ' + root +
                              '/nginx.conf -g "' + workers + '"',
                              shell=True,
                              stderr=errfile,
                              stdout=logfile)

        # fastcgi
        for port in range(9001, 9001 + args.max_threads):
            subprocess.Popen(
                "MONO_OPTIONS=--gc=sgen fastcgi-mono-server4 /applications=/:. /socket=tcp:127.0.0.1:"
                + str(port) + " &",
                shell=True,
                cwd=app,
                stderr=errfile,
                stdout=logfile)
        return 0
    except subprocess.CalledProcessError:
        return 1
Exemple #44
0
def start(args, logfile, errfile):
    setup_util.replace_text("play-scala-mongodb/conf/application.conf",
                            "jdbc:mysql:\/\/.*:3306",
                            "jdbc:mysql://" + args.database_host + ":3306")

    subprocess.check_call("play clean dist",
                          shell=True,
                          cwd="play-scala-mongodb",
                          stderr=errfile,
                          stdout=logfile)

    if os.name == 'nt':
        ZipFile(
            "./play-scala-mongodb/target/universal/play-scala-mongodb-1.0-SNAPSHOT.zip"
        ).extractall("./play-scala-mongodb/target/universal")
        with open(
                "./play-scala-mongodb/target/universal/play-scala-mongodb-1.0-SNAPSHOT/bin/play-scala-mongodb.bat",
                "w+") as f:
            f.write("java %1 -cp \"./lib/*;\" play.core.server.NettyServer .")
        subprocess.Popen(
            "play-scala-mongodb.bat",
            shell=True,
            cwd=
            "play-scala-mongodb/target/universal/play-scala-mongodb-1.0-SNAPSHOT/bin",
            stderr=errfile,
            stdout=logfile)
    else:
        subprocess.check_call("unzip play-scala-mongodb-1.0-SNAPSHOT.zip",
                              shell=True,
                              cwd="play-scala-mongodb/target/universal",
                              stderr=errfile,
                              stdout=logfile)
        subprocess.check_call(
            "chmod +x play-scala-mongodb",
            shell=True,
            cwd=
            "play-scala-mongodb/target/universal/play-scala-mongodb-1.0-SNAPSHOT/bin",
            stderr=errfile,
            stdout=logfile)
        subprocess.Popen(
            "./play-scala-mongodb",
            shell=True,
            cwd=
            "play-scala-mongodb/target/universal/play-scala-mongodb-1.0-SNAPSHOT/bin",
            stderr=errfile,
            stdout=logfile)

    return 0
Exemple #45
0
def start(args, logfile, errfile):
    setup_util.replace_text("ringojs-convenient/app/models.js",
                            "dbHost = '.*';",
                            "dbHost = '" + args.database_host + "';")

    try:

        subprocess.check_call("sudo rm -rf /usr/share/ringojs/packages/*",
                              shell=True,
                              stderr=errfile,
                              stdout=logfile)
        subprocess.check_call(
            "sudo ringo-admin install oberhamsi/sql-ringojs-client",
            shell=True,
            stderr=errfile,
            stdout=logfile)
        subprocess.check_call("sudo ringo-admin install grob/ringo-sqlstore",
                              shell=True,
                              stderr=errfile,
                              stdout=logfile)
        subprocess.check_call("sudo ringo-admin install ringo/stick",
                              shell=True,
                              stderr=errfile,
                              stdout=logfile)
        subprocess.check_call("sudo ringo-admin install oberhamsi/reinhardt",
                              shell=True,
                              stderr=errfile,
                              stdout=logfile)

        subprocess.check_call(
            "sudo mkdir -p /usr/share/ringojs/packages/ringo-sqlstore/jars/",
            shell=True,
            stderr=errfile,
            stdout=logfile)
        subprocess.check_call(
            "sudo cp /usr/share/ringojs//packages/sql-ringojs-client/jars/mysql.jar /usr/share/ringojs/packages/ringo-sqlstore/jars/",
            shell=True,
            stderr=errfile,
            stdout=logfile)
        subprocess.Popen(
            "ringo --production -Dserver -DXmx=512m -DXms=512m ringo-main.js",
            shell=True,
            cwd="ringojs-convenient",
            stderr=errfile,
            stdout=logfile)
        return 0
    except subprocess.CalledProcessError:
        return 1
def start(args):
  setup_util.replace_text("rails-stripped/config/database-jruby.yml", "host: .*", "host: " + args.database_host)
  setup_util.replace_text("rails-stripped/resin-web.xml", "mysql:\/\/.*:3306", "mysql://" + args.database_host + ":3306")

  try:
    subprocess.check_call("rvm jruby-1.7.3 do bundle install --gemfile=Gemfile-jruby", shell=True, cwd="rails-stripped")
    subprocess.check_call("cp Gemfile-jruby Gemfile", shell=True, cwd="rails-stripped")
    subprocess.check_call("cp Gemfile-jruby.lock Gemfile.lock", shell=True, cwd="rails-stripped")
    subprocess.check_call("cp config/database-jruby.yml config/database.yml", shell=True, cwd="rails-stripped")
    subprocess.check_call("rvm jruby-1.7.3 do warble war", shell=True, cwd="rails-stripped")
    subprocess.check_call("rm -rf $RESIN_HOME/webapps/*", shell=True)
    subprocess.check_call("cp rails-stripped.war $RESIN_HOME/webapps/rails.war", shell=True, cwd="rails-stripped")
    subprocess.check_call("$RESIN_HOME/bin/resinctl start", shell=True)
    return 0
  except subprocess.CalledProcessError:
    return 1
Exemple #47
0
def start(args):
  setup_util.replace_text("treefrog/config/database.ini", "HostName=.*", "HostName=" + args.database_host)

  # 1. Generate Makefile
  # 2. Compile applicaton
  # 3. Clean log files
  # 4. Start TreeFrog
  try:
    subprocess.check_call("qmake -r CONFIG+=release", shell=True, cwd="treefrog")
    subprocess.check_call("make clean", shell=True, cwd="treefrog")
    subprocess.check_call("make -j8", shell=True, cwd="treefrog")
    subprocess.check_call("rm -f log/*.log", shell=True, cwd="treefrog")
    subprocess.check_call("treefrog -d " + home + "/FrameworkBenchmarks/treefrog", shell=True)
    return 0
  except subprocess.CalledProcessError:
    return 1
def start(args):
    setup_util.replace_text(
        "elli/src/elli_bench_sup.erl", "\"benchmarkdbpass\", \".*\", 3306",
        "\"benchmarkdbpass\", \"" + args.database_host + "\", 3306")

    try:
        subprocess.check_call("./rebar get-deps", shell=True, cwd="elli")
        subprocess.check_call("./rebar compile", shell=True, cwd="elli")
        # adding +K true seemed to actually slow performance
        subprocess.check_call(
            "erl -pa ebin deps/*/ebin +sbwt very_long +swt very_low -s elli_bench -noshell -detached",
            shell=True,
            cwd="elli")
        return 0
    except subprocess.CalledProcessError:
        return 1
Exemple #49
0
def start(args):
  setup_util.replace_text("play-scala/conf/application.conf", "jdbc:mysql:\/\/.*:3306", "jdbc:mysql://" + args.database_host + ":3306")

  subprocess.check_call("play dist", shell=True, cwd="play-scala")

  if os.name == 'nt':
    ZipFile("./play-scala/dist/play-scala-1.0-SNAPSHOT.zip").extractall("./play-scala/dist")
    with open("./play-scala/dist/play-scala-1.0-SNAPSHOT/start.bat", "w+") as f:
      f.write("java %1 -cp \"./lib/*;\" play.core.server.NettyServer .")
    subprocess.Popen("start.bat", shell=True, cwd="play-scala/dist/play-scala-1.0-SNAPSHOT")
  else:
    subprocess.check_call("unzip play-scala-1.0-SNAPSHOT.zip", shell=True, cwd="play-scala/dist")
    subprocess.check_call("chmod +x start", shell=True, cwd="play-scala/dist/play-scala-1.0-SNAPSHOT")
    subprocess.Popen("./start", shell=True, cwd="play-scala/dist/play-scala-1.0-SNAPSHOT")

  return 0
Exemple #50
0
def start(args):
    kill_running_process()  # Kill the running process and delete the
    # RUNNING_PID file (if any). With any luck no
    # new process has picked up the same PID.

    play_cmd = "play"
    if args.os.lower() == "windows":
        play_cmd = "play.bat"

    setup_util.replace_text("play-scala/conf/application.conf",
                            "jdbc:mysql:\/\/.*:3306",
                            "jdbc:mysql://" + args.database_host + ":3306")
    subprocess.Popen([play_cmd, "start"],
                     stdin=subprocess.PIPE,
                     cwd="play-scala")
    return 0
Exemple #51
0
def start(args):
    setup_util.replace_text(
        "dropwizard/hello-world.yml", "url: jdbc:mysql://.*/hello_world",
        "url: jdbc:mysql://" + args.database_host + ":3306/hello_world")

    try:
        subprocess.check_call("mvn clean package;",
                              shell=True,
                              cwd="dropwizard")
        subprocess.Popen(
            "java -jar target/hello-world-0.0.1-SNAPSHOT.jar server hello-world.yml",
            shell=True,
            cwd="dropwizard")
        return 0
    except subprocess.CalledProcessError:
        return 1
Exemple #52
0
def npm():
    if os.name == 'nt':
        subprocess.check_call("copy package.json package.json.dist /y > NUL",
                              shell=True,
                              cwd="nodejs")
        setup_util.replace_text("nodejs/package.json", ".*mysql.*", "")
        setup_util.replace_text("nodejs/package.json", ".*mapper.*", "")

    try:
        subprocess.check_call("npm install", shell=True, cwd="nodejs")
    finally:
        if os.name == 'nt':
            subprocess.check_call("del package.json", shell=True, cwd="nodejs")
            subprocess.check_call("ren package.json.dist package.json",
                                  shell=True,
                                  cwd="nodejs")
def start(args):
  setup_util.replace_text("unfiltered/src/main/resources/application.conf", "jdbc:mysql:\/\/.*:3306", "jdbc:mysql://" + args.database_host + ":3306")
  setup_util.replace_text("unfiltered/src/main/resources/application.conf", "maxThreads = \\d+", "maxThreads = " + str(args.max_threads))

  # Shamelessly stolen from stack overflow
  try:
    from subprocess import DEVNULL
  except ImportError:
    import os
    DEVNULL = open(os.devnull, 'wb')

  subprocess.check_call("chmod u+x sbt", shell=True, cwd="unfiltered")
  subprocess.check_call("./sbt assembly", shell=True, cwd="unfiltered")
  subprocess.Popen("java -jar bench-assembly-1.0.0.jar", stderr=DEVNULL, shell=True, cwd="unfiltered/target/scala-2.10")

  return 0
Exemple #54
0
def start(args):
    global proc
    setup_util.replace_text("django/hello/hello/settings.py", "HOST': '.*'", "HOST': '" + args.database_host + "'")
    setup_util.replace_text("django/hello/hello/settings.py", "\/home\/ubuntu",  home)
    env = os.environ.copy()
    env['DJANGO_DB'] = 'postgresql_psycopg2'
    proc = subprocess.Popen([
        bin_dir + "/gunicorn",
        "hello.wsgi:application",
        "-k", "meinheld.gmeinheld.MeinheldWorker",
        "-b", "0.0.0.0:8080",
        '-w', str(NCPU*3),
        "--log-level=critical"],
        cwd="django/hello",
        env=env)
    return 0
Exemple #55
0
def start(args, logfile, errfile):
    setup_util.replace_text(
        "ninja-resin/src/main/webapp/WEB-INF/resin-web.xml",
        "mysql:\/\/.*:3306", "mysql://" + args.database_host + ":3306")

    try:
        subprocess.check_call("mvn clean compile war:war",
                              shell=True,
                              cwd="ninja-resin",
                              stderr=errfile,
                              stdout=logfile)

        if os.name == 'nt':
            subprocess.check_call('rmdir /S /Q "%RESIN_HOME%\\webapps\\"',
                                  shell=True,
                                  stderr=errfile,
                                  stdout=logfile)
            subprocess.check_call('mkdir "%RESIN_HOME%\\webapps\\"',
                                  shell=True,
                                  stderr=errfile,
                                  stdout=logfile)
            subprocess.check_call(
                'copy ninja-resin\\target\\ninja.war "%RESIN_HOME%\\webapps\\ninja.war"',
                shell=True,
                stderr=errfile,
                stdout=logfile)
            subprocess.check_call('"%RESIN_HOME%\\bin\\start.bat"',
                                  shell=True,
                                  stderr=errfile,
                                  stdout=logfile)
        else:
            subprocess.check_call("rm -rf $RESIN_HOME/webapps/*",
                                  shell=True,
                                  stderr=errfile,
                                  stdout=logfile)
            subprocess.check_call(
                "cp ninja-resin/target/ninja.war $RESIN_HOME/webapps/ninja.war",
                shell=True,
                stderr=errfile,
                stdout=logfile)
            subprocess.check_call("$RESIN_HOME/bin/resinctl start",
                                  shell=True,
                                  stderr=errfile,
                                  stdout=logfile)
        return 0
    except subprocess.CalledProcessError:
        return 1
Exemple #56
0
def start(args, logfile, errfile):
    setup_util.replace_text("activeweb/src/main/webapp/WEB-INF/resin-web.xml",
                            "localhost", args.database_host)
    setup_util.replace_text("activeweb/src/main/java/app/config/DbConfig.java",
                            "localhost", args.database_host)

    try:
        subprocess.check_call("mvn clean  package",
                              shell=True,
                              cwd="activeweb",
                              stderr=errfile,
                              stdout=logfile)
        if os.name == 'nt':
            subprocess.check_call("rmdir /s /q C:\\Java\\resin\\webapps",
                                  shell=True,
                                  stderr=errfile,
                                  stdout=logfile)
            subprocess.check_call("mkdir C:\\Java\\resin\\webapps",
                                  shell=True,
                                  stderr=errfile,
                                  stdout=logfile)
            subprocess.check_call(
                "cp activeweb\\target\\activeweb.war C:\\Java\\resin\\webapps\\activeweb.war",
                shell=True,
                stderr=errfile,
                stdout=logfile)
            subprocess.check_call("C:\\Java\\resin\\bin\\start.bat",
                                  shell=True,
                                  stderr=errfile,
                                  stdout=logfile)
            return 0
        subprocess.check_call("rm -rf $RESIN_HOME/webapps/*",
                              shell=True,
                              stderr=errfile,
                              stdout=logfile)
        subprocess.check_call(
            "cp activeweb/target/activeweb.war $RESIN_HOME/webapps/",
            shell=True,
            stderr=errfile,
            stdout=logfile)
        subprocess.check_call("$RESIN_HOME/bin/resinctl start",
                              shell=True,
                              stderr=errfile,
                              stdout=logfile)
        return 0
    except subprocess.CalledProcessError:
        return 1
Exemple #57
0
def start(args):
    setup_util.replace_text("luminus/hello/src/hello/models/schema.clj",
                            ":subname \"//.*:3306",
                            ":subname \"//" + args.database_host + ":3306")

    try:
        subprocess.check_call("lein ring uberwar",
                              shell=True,
                              cwd="luminus/hello")
        subprocess.check_call("rm -rf $RESIN_HOME/webapps/*", shell=True)
        subprocess.check_call(
            "cp luminus/hello/target/hello-luminus-standalone.war $RESIN_HOME/webapps/luminus.war",
            shell=True)
        subprocess.check_call("$RESIN_HOME/bin/resinctl start", shell=True)
        return 0
    except subprocess.CalledProcessError:
        return 1
Exemple #58
0
def start(args):
  setup_util.replace_text("servlet/src/main/webapp/WEB-INF/resin-web.xml", "localhost", args.database_host)

  try:
    subprocess.check_call("mvn clean compile war:war", shell=True, cwd="servlet")
    if os.name == 'nt':
      subprocess.check_call("rmdir /s /q C:\\Java\\resin\\webapps", shell=True)
      subprocess.check_call("mkdir C:\\Java\\resin\\webapps", shell=True)
      subprocess.check_call("cp servlet\\target\\servlet.war C:\\Java\\resin\\webapps\\servlet.war", shell=True)
      subprocess.check_call("C:\\Java\\resin\\bin\\start.bat", shell=True)
      return 0
    subprocess.check_call("rm -rf $RESIN_HOME/webapps/*", shell=True)
    subprocess.check_call("cp servlet/target/servlet.war $RESIN_HOME/webapps/", shell=True)
    subprocess.check_call("$RESIN_HOME/bin/resinctl start", shell=True)
    return 0
  except subprocess.CalledProcessError:
    return 1
def start(args, logfile, errfile):
    setup_util.replace_text(
        "servlet3-cass/src/main/resources/application.properties", "localhost",
        args.database_host)

    try:
        subprocess.check_call("mvn clean compile war:war",
                              shell=True,
                              cwd="servlet3-cass",
                              stderr=errfile,
                              stdout=logfile)
        if os.name == 'nt':
            subprocess.check_call("rmdir /s /q C:\\Java\\resin\\webapps",
                                  shell=True,
                                  stderr=errfile,
                                  stdout=logfile)
            subprocess.check_call("mkdir C:\\Java\\resin\\webapps",
                                  shell=True,
                                  stderr=errfile,
                                  stdout=logfile)
            subprocess.check_call(
                "cp servlet3-cass\\target\\servlet3-cass.war C:\\Java\\resin\\webapps\\servlet3-cass.war",
                shell=True,
                stderr=errfile,
                stdout=logfile)
            subprocess.check_call("C:\\Java\\resin\\bin\\start.bat",
                                  shell=True,
                                  stderr=errfile,
                                  stdout=logfile)
            return 0
        subprocess.check_call("rm -rf $RESIN_HOME/webapps/*",
                              shell=True,
                              stderr=errfile,
                              stdout=logfile)
        subprocess.check_call(
            "cp servlet3-cass/target/servlet3-cass.war $RESIN_HOME/webapps/",
            shell=True,
            stderr=errfile,
            stdout=logfile)
        subprocess.check_call("$RESIN_HOME/bin/resinctl start",
                              shell=True,
                              stderr=errfile,
                              stdout=logfile)
        return 0
    except subprocess.CalledProcessError:
        return 1
Exemple #60
0
def start(args, logfile, errfile):
    setup_util.replace_text(CWD + "/src/benchmark/conf/app.conf",
                            "tcp\(.*:3306\)",
                            "tcp(" + args.database_host + ":3306)")
    if os.name == 'nt':
        env = os.environ.copy()
        env["GOPATH"] = "C:\\FrameworkBenchmarks\\" + CWD
        subprocess.call(
            "go get -u github.com/robfig/revel/revel github.com/coocood/qbs",
            shell=True,
            cwd=CWD,
            env=env,
            stderr=errfile,
            stdout=logfile)
        subprocess.call(
            r"go build -o bin\revel.exe github.com/robfig/revel/revel",
            shell=True,
            cwd=CWD,
            env=env,
            stderr=errfile,
            stdout=logfile)
        subprocess.Popen(r"bin\revel.exe run benchmark prod".rsplit(" "),
                         shell=True,
                         cwd=CWD,
                         env=env,
                         stderr=errfile,
                         stdout=logfile)
        return 0
    os.environ["GOPATH"] = os.path.expanduser(
        '~/FrameworkBenchmarks/revel-qbs')
    subprocess.call(
        "go get -u github.com/robfig/revel/revel github.com/coocood/qbs",
        shell=True,
        cwd=CWD,
        stderr=errfile,
        stdout=logfile)
    subprocess.call("go build -o bin/revel github.com/robfig/revel/revel",
                    shell=True,
                    cwd=CWD,
                    stderr=errfile,
                    stdout=logfile)
    subprocess.Popen("bin/revel run benchmark prod".rsplit(" "),
                     cwd=CWD,
                     stderr=errfile,
                     stdout=logfile)
    return 0