summaryrefslogtreecommitdiffstats
path: root/src/main/scripts/start.sh
blob: 87043d95de41a54a9bf67292bc5db7d8928853e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/sh

BASEDIR="/opt/app/sparky"
AJSC_HOME="$BASEDIR"
AJSC_CONF_HOME="$BASEDIR/bundleconfig/"

if [ -z "$CONFIG_HOME" ]; then
	echo "CONFIG_HOME must be set in order to start up process"
	exit 1
fi

if [ -z "$KEY_STORE_PASSWORD" ]; then
	echo "KEY_STORE_PASSWORD must be set in order to start up process"
	exit 1
else
        sed -i /"KEY_STORE_PASSWORD"/d $AJSC_CONF_HOME/etc/sysprops/sys-props.properties
	echo "KEY_STORE_PASSWORD=$KEY_STORE_PASSWORD" >> $AJSC_CONF_HOME/etc/sysprops/sys-props.properties
fi

if [ -z "$KEY_MANAGER_PASSWORD" ]; then
	echo "KEY_MANAGER_PASSWORD must be set in order to start up process"
	exit 1
else
        sed -i /"KEY_MANAGER_PASSWORD"/d $AJSC_CONF_HOME/etc/sysprops/sys-props.properties
	echo "KEY_MANAGER_PASSWORD=$KEY_MANAGER_PASSWORD" >> $AJSC_CONF_HOME/etc/sysprops/sys-props.properties
fi

if [ -z "$UI_HTTPS_PORT" ] && [ -z "$UI_HTTP_PORT" ]; then
	echo "Either UI_HTTPS_PORT or UI_HTTP_PORT must be set in order to start up process"
	exit 1
fi

# Add any routes configured at deploy time to the sparky deployment
if [ -n "$DYNAMIC_ROUTES" ]; then
   if [ -e /opt/app/sparky/services/inventory-ui-service_v1.zip ]; then
      echo "Adding the following dynamic routes to the deployment: "
      mkdir -p /tmp/sparky/v1/routes
      for f in `ls $DYNAMIC_ROUTES`
         do
            cp $DYNAMIC_ROUTES/$f /tmp/sparky/v1/routes
            echo "Adding dynamic route $DYNAMIC_ROUTES/$f"
     done
     jar uf /opt/app/sparky/services/inventory-ui-service_v1.zip* -C /tmp/ sparky
     rm -rf /tmp/sparky
  fi
fi

# Add any spring bean configuration files to the sparky deployment
if [ -n "$SERVICE_BEANS" ]; then
   if [ -e /opt/app/sparky/services/inventory-ui-service_v1.zip ]; then
      echo "Adding the following dynamic service beans to the deployment: "
      mkdir -p /tmp/sparky/v1/conf
      for f in `ls $SERVICE_BEANS`
      do
         cp $SERVICE_BEANS/$f /tmp/sparky/v1/conf
         echo "Adding dynamic service bean $SERVICE_BEANS/$f"
      done
      jar uf /opt/app/sparky/services/inventory-ui-service_v1.zip* -C /tmp/ sparky
      rm -rf /tmp/sparky
   fi
fi

# Add any dynamic component configuration files to the sparky deployment
if [ -n "$COMPLIB" ]; then
   if [ -e /opt/app/sparky/services/inventory-ui-service_v1.zip ]; then
      echo "Adding the following dynamic libraries to the deployment: "
      mkdir -p /tmp/sparky/v1/lib
      for f in `ls $COMPLIB`
      do
           cp $COMPLIB/$f /tmp/sparky/v1/lib
           echo "Adding dynamic library $COMPLIB/$f"
      done
      jar uf /opt/app/sparky/services/inventory-ui-service_v1.zip* -C /tmp/ sparky
      rm -rf /tmp/sparky
   fi
fi

CLASSPATH="$AJSC_HOME/lib/ajsc-runner-2.0.0.jar"
CLASSPATH="$CLASSPATH:$AJSC_HOME/extJars/"
CLASSPATH="$CLASSPATH:$CONFIG_HOME/portal/"
PROPS="-DAJSC_HOME=$AJSC_HOME"
PROPS="$PROPS -DAJSC_CONF_HOME=$BASEDIR/bundleconfig/"
PROPS="$PROPS -Dlogback.configurationFile=$BASEDIR/bundleconfig/etc/logback.xml"
PROPS="$PROPS -DAJSC_SHARED_CONFIG=$AJSC_CONF_HOME"
PROPS="$PROPS -DAJSC_EXTERNAL_LIB_FOLDERS=$AJSC_HOME/commonLibs"
PROPS="$PROPS -DAJSC_EXTERNAL_PROPERTIES_FOLDERS=$AJSC_HOME/ajsc-shared-config/etc"
PROPS="$PROPS -DAJSC_SERVICE_NAMESPACE=ajsc-tier-support-ui"
PROPS="$PROPS -DAJSC_SERVICE_VERSION=v1"
PROPS="$PROPS -DSOACLOUD_SERVICE_VERSION=0.0.0"
PROPS="$PROPS -Dserver.port=8000"
PROPS="$PROPS -DCONFIG_HOME=$CONFIG_HOME"

echo $CLASSPATH

if [ "$UI_HTTPS_PORT" ]; then
	/usr/lib/jvm/java-8-openjdk-amd64/bin/java -Xms1024m -Xmx4096m  $PROPS -classpath $CLASSPATH com.att.ajsc.runner.Runner context=/ sslport=$UI_HTTPS_PORT
elif [ "$UI_HTTP_PORT" ]; then
	/usr/lib/jvm/java-8-openjdk-amd64/bin/java -Xms1024m -Xmx4096m  $PROPS -classpath $CLASSPATH com.att.ajsc.runner.Runner context=/ port=$UI_HTTP_PORT
fi