Skip to content

Commit

Permalink
Use install.sh from run_local.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
oglimmer committed Aug 1, 2018
1 parent d7fb58b commit 3ca41c0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 25 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -30,3 +30,4 @@ scripts/*.json
docker/BuildInDockerAndDeployViaAnsible/.m2
docker/BuildInDockerAndDeployViaAnsible/repos
docker/BuildInDockerAndDeployViaAnsible/ssh
localrun/
8 changes: 6 additions & 2 deletions ansible/roles/cyc-container/files/scripts/run.sh
Expand Up @@ -47,5 +47,9 @@ else
XMX=512M
fi

$_java -Xms$XMX -Xmx$XMX $OPTS -XX:+UseConcMarkSweepGC -Djava.security.policy=/usr/local/cyc-engine-container/security.policy \
-Dcyc.home=/usr/local/cyc-engine-container -jar /usr/local/cyc-engine-container/engine-container-jar-with-dependencies.jar
if [ -z "$CYC_ENGINE_CONTAINER" ]; then
CYC_ENGINE_CONTAINER=/usr/local/cyc-engine-container
fi

$_java -Xms$XMX -Xmx$XMX $OPTS -XX:+UseConcMarkSweepGC -Djava.security.policy=$CYC_ENGINE_CONTAINER/security.policy \
-Dcyc.home=$CYC_ENGINE_CONTAINER -jar $CYC_ENGINE_CONTAINER/engine-container-jar-with-dependencies.jar
43 changes: 20 additions & 23 deletions run_local.sh
Expand Up @@ -5,34 +5,31 @@ trap cleanup 2
cleanup()
{
echo "****************************************************************"
echo "Stopping Docker, Tomcat and CYC-Container.....please wait...."
echo "Stopping CouchDB, Tomcat and CYC-Container.....please wait...."
echo "****************************************************************"
docker rm -f $containerID
./apache-tomcat-$TOMCAT_VERSION/bin/shutdown.sh
$CYC_WEBAPPS/../bin/shutdown.sh
exit 0
}

# vars
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
TOMCAT_VERSION=7.0.90
TOMCAT_URL=http://mirrors.ocf.berkeley.edu/apache/tomcat/tomcat-7/v$TOMCAT_VERSION/bin/apache-tomcat-$TOMCAT_VERSION.tar.gz
CYC_WEBAPPS=./localrun/apache-tomcat-$TOMCAT_VERSION/webapps
CYC_ENGINE_CONTAINER=./localrun

# check for dependencies
mvn --version 1>/dev/null || exit 1
npm --version 1>/dev/null || exit 1
java -version 2>/dev/null || exit 1
jq --version 1>/dev/null || exit 1
curl --version 1>/dev/null || exit 1
docker --version 1>/dev/null || exit 1

#build
mvn package

# prepare env
mkdir -p target/localrun
cd target/localrun
mkdir -p localrun
cd localrun

# set up the couchdb views
# set up couchdb and its views
containerID=$(docker run -d -p 5984:5984 couchdb:1.7)
if [ ! -d ./node_modules/couchviews ]; then
npm install --no-package-lock --loglevel=error couchviews
Expand All @@ -42,23 +39,23 @@ while [ "$(curl -s http://localhost:5984|jq -r '.couchdb')" != "Welcome" ]; do
sleep 1
done
curl -X PUT http://localhost:5984/cyc
./node_modules/.bin/couchviews push http://localhost:5984/cyc ../../persistence/src/couchdb/

# deploy the engine

mkdir -p cyc001/
cp ../../engine/target/engine-jar-with-dependencies.jar cyc001/
./node_modules/.bin/couchviews push http://localhost:5984/cyc ../persistence/src/couchdb/


# ready the tomcat
# download tomcat
if [ ! -f "/$TMPDIR/apache-tomcat-$TOMCAT_VERSION.tar" ]; then
curl -s $TOMCAT_URL | gzip -d >/$TMPDIR/apache-tomcat-$TOMCAT_VERSION.tar
fi
# extract tomcat
if [ ! -d "./apache-tomcat-$TOMCAT_VERSION" ]; then
curl -s $TOMCAT_URL | tar -xz
tar -xf /$TMPDIR/apache-tomcat-$TOMCAT_VERSION.tar -C ./
fi
cp ../../web/target/*.war apache-tomcat-$TOMCAT_VERSION/webapps/

# build and install via install.sh
cd ../
./install.sh -l site

# start tomcat
./apache-tomcat-$TOMCAT_VERSION/bin/startup.sh
$CYC_WEBAPPS/../bin/startup.sh

# start engine-container (blocking)
cp ../../engine-container/target/engine-container-jar-with-dependencies.jar .
java -Dcyc.home=./ -Djava.security.policy=../../ansible/roles/cyc-container/files/scripts/security.policy -jar engine-container-jar-with-dependencies.jar
$CYC_ENGINE_CONTAINER/run.sh

0 comments on commit 3ca41c0

Please sign in to comment.