#!/bin/bash set -e if [[ ! -f $JBOSS_HOME/.setup ]]; then # run init script if (ls ${JBOSS_HOME}/customization/init.d/* 1>/dev/null 2>&1); then for f in ${JBOSS_HOME}/customization/init.d/*; do echo "=> Run custom init script '$f'" bash "$f" done fi # Set environment variables DATASOURCE=java:/jdbc/datasources/${DB_NAME}DS # Setup WildFly admin user echo "=> Add WildFly administrator" $JBOSS_HOME/bin/add-user.sh -u $WILDFLY_USER -p $WILDFLY_PASS --silent # Configure datasource echo "=> Create datasource: '${DATASOURCE}'" $JBOSS_CLI < Clean up" rm -rf $JBOSS_HOME/standalone/configuration/standalone_xml_history/* \ $JBOSS_HOME/standalone/log/* \ /tmp/*.jar unset WILDFLY_USER WILDFLY_PASS DB_NAME DB_USER DB_PASS DATASOURCE touch $JBOSS_HOME/.setup echo "=> Setup finished !!" fi echo "=> Start WildFly" # Boot WildFly in standalone mode and bind it to all interfaces (enable admin console and debug) $JBOSS_HOME/bin/standalone.sh -b 0.0.0.0 -bmanagement 0.0.0.0