mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-16 10:48:47 +00:00
bug4811: repaired "sailing" init.d script
This commit is contained in:
+1
-48
@@ -45,52 +45,6 @@ start_servers() {
|
||||
echo "No image-upgrade request found in EC2 user data $($EC2_METADATA_CMD -d); proceding with regular server launch..." >>/var/log/sailing.err
|
||||
echo "Servers to launch: ${JAVA_START_INSTANCES}" >>/var/log/sailing.err
|
||||
NUMBER_OF_INSTANCES=`echo "$JAVA_START_INSTANCES" | wc -w`
|
||||
<<<<<<< Updated upstream
|
||||
MINIMUM_MEMORY_IN_MB=2000
|
||||
MEM_TOTAL=`cat /proc/meminfo | grep MemTotal | awk '{print $2;}'`
|
||||
MEMORY_COMPUTED=$(( ${MEM_TOTAL} / 1024 * 3 / 4 - 1500 / 1 ))
|
||||
MEMORY_PER_INSTANCE_IN_MB=$(( $MEMORY_COMPUTED < $MINIMUM_MEMORY_IN_MB ? $MINIMUM_MEMORY_IN_MB : $MEMORY_COMPUTED ))
|
||||
echo "Using ${MEMORY_PER_INSTANCE_IN_MB}MB as default heap size per instance."
|
||||
for conf in $JAVA_START_INSTANCES; do
|
||||
echo "Checking for amazon update..." >>/var/log/sailing.out
|
||||
echo "MEMORY=\"${MEMORY_PER_INSTANCE_IN_MB}m\"" >>$SERVERS_DIR/$conf/env.sh
|
||||
su - sailing -c "cd $SERVERS_DIR/$conf && $GIT_REPOSITORY/java/target/refreshInstance.sh auto-install" 2>>/var/log/sailing.err >>/var/log/sailing.out
|
||||
(
|
||||
# execute env.sh in a subshell which now has the same set of variables that the server will see
|
||||
source $SERVERS_DIR/$conf/env.sh
|
||||
echo "Starting Java server \"$conf\"" >>/var/log/sailing.out
|
||||
su - sailing -c "cd $SERVERS_DIR/$conf && ./start" 2>>/var/log/sailing.err >>/var/log/sailing.out
|
||||
server_name="`echo $SERVER_NAME | tr [A-Z] [a-z]`"
|
||||
# The following Plain-SSL macro is important for Application Load Balancer / Target Group health checks
|
||||
# going to https://{local-address}/gwt/status. It will furthermore let Apache/httpd forward to the
|
||||
# default application server instance for all other addresses not recognized by any other ServerName directive,
|
||||
# thus creating the "default route" for this Apache/httpd configuration
|
||||
echo "Appending macro invocation to $APACHE_CONFIG_DIR/001-events.conf to map internal IP $INSTANCE_INTERNAL_IP4 to plain server running $SERVER_PORT..." >>/var/log/sailing.out
|
||||
echo "Use Plain-SSL ${INSTANCE_INTERNAL_IP4} 127.0.0.1 $SERVER_PORT" >>$APACHE_CONFIG_DIR/001-events.conf
|
||||
echo "Appending macro invocation to $APACHE_CONFIG_DIR/001-events.conf to map ${server_name}.sapsailing.com to event with ID $EVENT_ID with server running on local port $SERVER_PORT..." >>/var/log/sailing.out
|
||||
if [ "$EVENT_ID" != "" ]; then
|
||||
echo "## EVENT ${server_name}" >>$APACHE_CONFIG_DIR/001-events.conf
|
||||
echo "Use Event-SSL ${server_name}.sapsailing.com \"$EVENT_ID\" 127.0.0.1 $SERVER_PORT" >>$APACHE_CONFIG_DIR/001-events.conf
|
||||
else
|
||||
echo "## No event ID provided; forwarding domain to /gwt/Home.html" >>$APACHE_CONFIG_DIR/001-events.conf
|
||||
echo "Use Home-SSL ${server_name}.sapsailing.com 127.0.0.1 $SERVER_PORT" >>$APACHE_CONFIG_DIR/001-events.conf
|
||||
fi
|
||||
# check if n secondary event shall be pasted to 001-events.conf
|
||||
if [[ ${HTTP_SEC_EVENT} && ${HTTP_SEC_EVENT_ID} ]]; then
|
||||
http_sec_event="`echo $HTTP_SEC_EVENT | tr [A-Z] [a-z]`"
|
||||
echo "Appending macro invocation to $APACHE_CONFIG_DIR/001-events.conf to map ${http_sec_event}.sapsailing.com to event with ID ${HTTP_SEC_EVENT_ID} with server running on local port $SERVER_PORT..." >>/var/log/sailing.out
|
||||
echo "## EVENT ${http_sec_event}" >>$APACHE_CONFIG_DIR/001-events.conf
|
||||
echo "Use Event ${http_sec_event}.sapsailing.com \"$HTTP_SEC_EVENT_ID\" 127.0.0.1 $SERVER_PORT" >>$APACHE_CONFIG_DIR/001-events.conf
|
||||
echo "Use Event-SSL ${http_sec_event}.sapsailing.com \"$HTTP_SEC_EVENT_ID\" 127.0.0.1 $SERVER_PORT" >>$APACHE_CONFIG_DIR/001-events.conf
|
||||
fi
|
||||
HTTP_LOGROTATE=/etc/logrotate.d/httpd
|
||||
echo "Patching $HTTP_LOGROTATE so that old logs go to /var/log/old/$SERVER_NAME/$INSTANCE_IP4" >>/var/log/sailing.out
|
||||
sed -i -e "s/\/var\/log\/old\/\([^/]*\)\/\([^/ ]*\)/\/var\/log\/old\/$SERVER_NAME\/$INSTANCE_IP4/" $HTTP_LOGROTATE
|
||||
# terminating the subshell will forget all the variable assignments brought in by env.sh, clearing for the next server instance
|
||||
)
|
||||
RETVAL=$?
|
||||
[ $RETVAL -eq 0 ] && success || failure
|
||||
=======
|
||||
FIRST_SERVER=`echo $JAVA_START_INSTANCES | awk '{print $1;}'`
|
||||
if [ -f "${REBOOT_INDICATOR}" ]; then
|
||||
echo "This is a re-boot. No EC2 user data is evaluated for server configuration; no server configuration is performed. Only configured applications are launched." >>/var/log/sailing.err
|
||||
@@ -105,8 +59,8 @@ start_servers() {
|
||||
create_basic_httpd_config
|
||||
configure_and_start_server "${FIRST_SERVER}"
|
||||
reload_httpd
|
||||
echo 1 >"${REBOOT_INDICATOR}"
|
||||
fi
|
||||
>>>>>>> Stashed changes
|
||||
done
|
||||
fi
|
||||
}
|
||||
@@ -224,7 +178,6 @@ case "$1" in
|
||||
/usr/sbin/update-motd
|
||||
start_servers
|
||||
touch /var/lock/subsys/sailing
|
||||
echo 1 >"${REBOOT_INDICATOR}"
|
||||
;;
|
||||
stop)
|
||||
stop_servers
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
### Firing up replica's
|
||||
|
||||
(Note: the following was current back in 2016 but may not be current anymore in terms of the properties used to configure the instance! See [[here|/wiki/info/landscape/amazon-ec2] for up-to-date information.)
|
||||
|
||||
```
|
||||
INSTALL_FROM_RELEASE=build-201608091706
|
||||
USE_ENVIRONMENT=live-replica-server
|
||||
|
||||
Reference in New Issue
Block a user