Skip to content

Commit

Permalink
Modified the setup scripts for play1 and play1siena to deploy to resin
Browse files Browse the repository at this point in the history
  • Loading branch information
pfalls-techempower committed Apr 12, 2013
1 parent 08dc3aa commit 4ce61db
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 50 deletions.
1 change: 1 addition & 0 deletions play1/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
precompiled/*
10 changes: 5 additions & 5 deletions play1/benchmark_config
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"tests": [{
"default": {
"setup_file": "setup",
"json_url": "/json",
"db_url": "/db",
"query_url": "/db?queries=",
"json_url": "/play1/json",
"db_url": "/play1/db",
"query_url": "/play1/db?queries=",
"port": 8080,
"sort": 13
"sort": 65
}
}]
}
}
31 changes: 9 additions & 22 deletions play1/setup.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,19 @@
import subprocess
import sys
import setup_util
import os

def start(args):
setup_util.replace_text("play1/conf/application.conf", "jdbc:mysql:\/\/.*:3306", "jdbc:mysql://" + args.database_host + ":3306")
setup_util.replace_text("play1/conf/application.conf", "jdbc:mysql:\/\/.*:3306", "jdbc:mysql://" + args.database_host + ":3306")

subprocess.check_call("play war -o ../play1 --zip", shell=True, cwd="play1")
# TODO deploy to resin

# subprocess.check_call("play dist", shell=True, cwd="play-java")
# subprocess.check_call("unzip play-java-1.0-SNAPSHOT.zip", shell=True, cwd="play-java/dist")
# subprocess.check_call("chmod +x start", shell=True, cwd="play-java/dist/play-java-1.0-SNAPSHOT")
# TODO start resin

# subprocess.Popen("./start", shell=True, cwd="play-java/dist/play-java-1.0-SNAPSHOT")
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
def stop():
p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
out, err = p.communicate()
for line in out.splitlines():
if './start' in line or ('play' in line and 'java' in line):
pid = int(line.split(None, 2)[1])
os.kill(pid, 9)
try:
os.remove("play-java/RUNNING_PID")
except OSError:
pass
return 0
subprocess.check_call("$RESIN_HOME/bin/resinctl shutdown", shell=True)
subprocess.check_call("rm -rf $RESIN_HOME/webapps/*", shell=True)
return 0
except subprocess.CalledProcessError:
return 1
1 change: 1 addition & 0 deletions play1siena/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
precompiled/*
10 changes: 5 additions & 5 deletions play1siena/benchmark_config
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"tests": [{
"default": {
"setup_file": "setup",
"json_url": "/json",
"db_url": "/db",
"query_url": "/db?queries=",
"json_url": "/play1/json",
"db_url": "/play1/db",
"query_url": "/play1/db?queries=",
"port": 8080,
"sort": 13
"sort": 66
}
}]
}
}
1 change: 1 addition & 0 deletions play1siena/modules/siena-2.0.6
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../installs/play-1.2.5/modules/siena-2.0.6
1 change: 0 additions & 1 deletion play1siena/modules/siena-2.0.7

This file was deleted.

25 changes: 8 additions & 17 deletions play1siena/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,15 @@
def start(args):
setup_util.replace_text("play1siena/conf/application.conf", "jdbc:mysql:\/\/.*:3306", "jdbc:mysql://" + args.database_host + ":3306")

subprocess.check_call("play war -o ../play1siena --zip", shell=True, cwd="play1siena")
# TODO deploy to resin
#subprocess.check_call("unzip play-java-1.0-SNAPSHOT.zip", shell=True, cwd="play-java/dist")
#subprocess.check_call("chmod +x start", shell=True, cwd="play-java/dist/play-java-1.0-SNAPSHOT")
# TODO start resin
# subprocess.Popen("./start", shell=True, cwd="play-java/dist/play-java-1.0-SNAPSHOT")
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="play1siena")
subprocess.check_call("$RESIN_HOME/bin/resinctl start", shell=True)

return 0
def stop():
p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
out, err = p.communicate()
for line in out.splitlines():
if './start' in line or ('play' in line and 'java' in line):
pid = int(line.split(None, 2)[1])
os.kill(pid, 9)
try:
os.remove("play-java/RUNNING_PID")
except OSError:
pass
return 0
subprocess.check_call("$RESIN_HOME/bin/resinctl shutdown", shell=True)
subprocess.check_call("rm -rf $RESIN_HOME/webapps/*", shell=True)
return 0
except subprocess.CalledProcessError:
return 1

0 comments on commit 4ce61db

Please sign in to comment.