Commit 01e22fca authored by iSergio's avatar iSergio
Browse files

Fix output forward

parent ff170b1a
Loading
Loading
Loading
Loading
+34 −34
Original line number Diff line number Diff line
@@ -22,9 +22,9 @@ if [[ ! -z $_JBOSS_PRIMARY_HOST ]]; then
fi

echo -n "JBOSS STANDBY HOST (Default: $JBOSS_STANDBY_HOST): "
read _JBOSS_PRIMARY_HOST
read _JBOSS_STANDBY_HOST
if [[ ! -z $_JBOSS_STANDBY_HOST ]]; then
    JBOSS_PRIMARY_HOST=$_JBOSS_STANDBY_HOST
    JBOSS_STANDBY_HOST=$_JBOSS_STANDBY_HOST
fi
echo -n "PostgreSQL host (Default: $PGPOOL_DELEGATE_IP): "
read _PGPOOL_DELEGATE_IP
@@ -171,7 +171,7 @@ align_left "$DOTSTRING" "Removing server groups"
result=`jboss-cli.sh --connect --commands="batch,
/server-group=main-server-group:remove(),
/server-group=other-server-group:remove(),
run-batch"` 2>$1
run-batch"` &>/dev/null
align_echo $? $result $result
# Remove full-sockets, ha-sockets, standard-sockets
#/socket-binding-group=standard-sockets:remove(),
@@ -179,12 +179,12 @@ align_left "$DOTSTRING" "Remove full and ha sockets"
result=`jboss-cli.sh --connect --commands="batch,
/socket-binding-group=full-sockets:remove(),
/socket-binding-group=ha-sockets:remove(),
run-batch"` 2>$1
run-batch"` &>/dev/null
align_echo $? $result $result
# First create standalone server group. Use it for non clustered application. Only one instace will be worked.
# If failover event, on standalone server must start on standby
align_left "$DOTSTRING" "Create standalone-server-group"
result=`jboss-cli.sh --connect --commands="/server-group=standalone-server-group:add(profile=default, socket-binding-group=standard-sockets)"` 2>$1
result=`jboss-cli.sh --connect --commands="/server-group=standalone-server-group:add(profile=default, socket-binding-group=standard-sockets)"` &>/dev/null
align_echo $? $result
# Configure main-server-group jvm options
align_left "$DOTSTRING" "Configure standalone-server-group"
@@ -201,12 +201,12 @@ result=`jboss-cli.sh --connect --commands="batch,
/server-group=standalone-server-group/jvm=default:add-jvm-option(jvm-option=\"-Dindicators_p.cfg=/etc/irz/indicators_p\"),
/server-group=standalone-server-group/jvm=default:add-jvm-option(jvm-option=\"-Dplanning.cfg=/etc/irz/planning\"),
/server-group=standalone-server-group/jvm=default:add-jvm-option(jvm-option=\"-Dfile.encoding=UTF-8\"),
run-batch"` 2>$1
run-batch"` &>/dev/null
align_echo $? $result

# Create correct main-server-group
align_left "$DOTSTRING" "Create cluster-server-group"
result=`jboss-cli.sh --connect --commands="/server-group=cluster-server-group:add(profile=full-ha, socket-binding-group=full-ha-sockets)"` 2>$1
result=`jboss-cli.sh --connect --commands="/server-group=cluster-server-group:add(profile=full-ha, socket-binding-group=full-ha-sockets)"` &>/dev/null
align_echo $? $result
# Configure main-server-group jvm options
align_left "$DOTSTRING" "Configure cluster-server-group"
@@ -223,7 +223,7 @@ reuslt=`jboss-cli.sh --connect --commands="batch,
/server-group=cluster-server-group/jvm=default:add-jvm-option(jvm-option=\"-Dindicators_p.cfg=/etc/irz/indicators_p\"),
/server-group=cluster-server-group/jvm=default:add-jvm-option(jvm-option=\"-Dplanning.cfg=/etc/irz/planning\"),
/server-group=cluster-server-group/jvm=default:add-jvm-option(jvm-option=\"-Dfile.encoding=UTF-8\"),
run-batch"` 2>$1
run-batch"` &>/dev/null
align_echo $? $result

# Remove default profile
@@ -334,26 +334,26 @@ function remove_full_profile {

# Third party configs
align_left "$DOTSTRING" "Configure thirdparty settings for defalt profile"
result=`jboss-cli.sh --connect --commands="/profile=default/subsystem=naming/binding=java\:global\/journal_settings:add(binding-type=object-factory,module=org.otdel414.commons,class=org.otdel414.journal.JournalSettings\$Factory,environment=[szi=\"enable:true\", out=\"enable:true,params:false,only_error:true\"])"` 2>$1
result=`jboss-cli.sh --connect --commands="/profile=default/subsystem=naming/binding=java\:global\/journal_settings:add(binding-type=object-factory,module=org.otdel414.commons,class=org.otdel414.journal.JournalSettings\$Factory,environment=[szi=\"enable:true\", out=\"enable:true,params:false,only_error:true\"])"` &>/dev/null
align_echo $? $result
align_left "$DOTSTRING" "Configure thirdparty settings for full-ha profile"
result=`jboss-cli.sh --connect --commands="/profile=full-ha/subsystem=naming/binding=java\:global\/journal_settings:add(binding-type=object-factory,module=org.otdel414.commons,class=org.otdel414.journal.JournalSettings\$Factory,environment=[szi=\"enable:true\", out=\"enable:true,params:false,only_error:true\"])"` 2>$1
result=`jboss-cli.sh --connect --commands="/profile=full-ha/subsystem=naming/binding=java\:global\/journal_settings:add(binding-type=object-factory,module=org.otdel414.commons,class=org.otdel414.journal.JournalSettings\$Factory,environment=[szi=\"enable:true\", out=\"enable:true,params:false,only_error:true\"])"` &>/dev/null
align_echo $? $result

# Set max post size request
align_left "$DOTSTRING" "Configure max-post-size for default profile"
result=`jboss-cli.sh --connect --commands="/profile=default/subsystem=web/connector=http:write-attribute(name=max-post-size,value=0)"` 2>$1
result=`jboss-cli.sh --connect --commands="/profile=default/subsystem=web/connector=http:write-attribute(name=max-post-size,value=0)"` &>/dev/null
align_echo $? $result
align_left "$DOTSTRING" "Configure max-post-size for full-ha profile"
result=`jboss-cli.sh --connect --commands="/profile=full-ha/subsystem=web/connector=http:write-attribute(name=max-post-size,value=0)"` 2>$1
result=`jboss-cli.sh --connect --commands="/profile=full-ha/subsystem=web/connector=http:write-attribute(name=max-post-size,value=0)"` &>/dev/null
align_echo $? $result

# Set transcations tumeout
align_left "$DOTSTRING" "Configure default-timeout for default profile"
result=`jboss-cli.sh --connect --commands="/profile=default/subsystem=transactions:write-attribute(name=default-timeout,value=300000)"` 2>$1
result=`jboss-cli.sh --connect --commands="/profile=default/subsystem=transactions:write-attribute(name=default-timeout,value=300000)"` &>/dev/null
align_echo $? $result
align_left "$DOTSTRING" "Configure default-timeout for default profile"
result=`jboss-cli.sh --connect --commands="/profile=full-ha/subsystem=transactions:write-attribute(name=default-timeout,value=300000)"` 2>$1
result=`jboss-cli.sh --connect --commands="/profile=full-ha/subsystem=transactions:write-attribute(name=default-timeout,value=300000)"` &>/dev/null
align_echo $? $result

# Set user and password for HornetQ server
@@ -361,17 +361,17 @@ align_left "$DOTSTRING" "Configure HornetQ server"
result=`jboss-cli.sh --connect --commands="batch,
/profile=full-ha/subsystem=messaging/hornetq-server=default:write-attribute(name=cluster-user, value=jms-user),
/profile=full-ha/subsystem=messaging/hornetq-server=default:write-attribute(name=cluster-password, value=jms-pass),
run-batch"` 2>$1
run-batch"` &>/dev/null
align_echo $? $result

# Set instance-id for domain:web
align_left "$DOTSTRING" "Configure instance-id HornetQ server"
reuslt=`jboss-cli.sh --connect --commands='/profile=full-ha/subsystem=web:write-attribute(name=instance-id, value=\"${jboss.node.name}\")'` 2>$1
reuslt=`jboss-cli.sh --connect --commands='/profile=full-ha/subsystem=web:write-attribute(name=instance-id, value=\"${jboss.node.name}\")'` &>/dev/null
align_echo $? $result

# Rename master -> primary
align_left "$DOTSTRING" "Rename server master -> primary"
result=`jboss-cli.sh --connect --commands="/host=master:write-attribute(name=name, value=$TYPE)"` 2>$1
result=`jboss-cli.sh --connect --commands="/host=master:write-attribute(name=name, value=$TYPE)"` &>/dev/null
align_echo $? $result

# Configure interfaces
@@ -380,54 +380,54 @@ result=`jboss-cli.sh --connect --commands="batch,
/host=master/interface=management:write-attribute(name=inet-address, value=$HOST),
/host=master/interface=public:write-attribute(name=inet-address, value=0.0.0.0),
/host=master/interface=unsecure:write-attribute(name=inet-address, value=0.0.0.0),
run-batch"` 2>$1
run-batch"` &>/dev/null
align_echo $? $result

if [[ "$TYPE" == "standby" ]]; then
    # Disable local domain controller, attach to primary
    align_left "$DOTSTRING" "Disable local domanin controller"
    result=`jboss-cli.sh --connect --commands="/host=master:write-remote-domain-controller(host=$JBOSS_PRIMARY_HOST, port=9999, security-realm=ManagementRealm)"` 2>$1
    result=`jboss-cli.sh --connect --commands="/host=master:write-remote-domain-controller(host=$JBOSS_PRIMARY_HOST, port=9999, security-realm=ManagementRealm)"` &>/dev/null
    align_echo $? $result
    # Set secret value for standby user
    align_left "$DOTSTRING" "Configure ManagementRealm"
    result=`jboss-cli.sh --connect --commands="/host=master/core-service=management/security-realm=ManagementRealm/server-identity=secret:add(value=\"$STANDBY_BASE64\")"` 2>$1
    result=`jboss-cli.sh --connect --commands="/host=master/core-service=management/security-realm=ManagementRealm/server-identity=secret:add(value=\"$STANDBY_BASE64\")"` &>/dev/null
    align_echo $? $result
fi

# Create standalone server
if [[ "$TYPE" == "primary" ]]; then
    align_left "$DOTSTRING" "Create server-standalone"
    result=`jboss-cli.sh --connect --commands="/host=master/server-config=server-standalone:add(group=standalone-server-group, auto-start=true)"` 2>$1
    result=`jboss-cli.sh --connect --commands="/host=master/server-config=server-standalone:add(group=standalone-server-group, auto-start=true)"` &>/dev/null
    align_echo $? $result
fi
if [[ "$TYPE" == "standby" ]]; then
    align_left "$DOTSTRING" "Create server-standalone"
    result=`jboss-cli.sh --connect --commands="/host=master/server-config=server-standalone:add(group=standalone-server-group, auto-start=false)"` 2>$1
    result=`jboss-cli.sh --connect --commands="/host=master/server-config=server-standalone:add(group=standalone-server-group, auto-start=false)"` &>/dev/null
    align_echo $? $result
fi
# Recreate server-one
align_left "$DOTSTRING" "Stop server-one"
result=`jboss-cli.sh --connect --commands="/host=master/server-config=server-one:stop()"` 2>$1
result=`jboss-cli.sh --connect --commands="/host=master/server-config=server-one:stop()"` &>/dev/null
align_echo $? $result
align_left "$DOTSTRING" "Recreate server-one"
result=`jboss-cli.sh --connect --commands="batch,
/host=master/server-config=server-one:remove(),
/host=master/server-config=server-one:add(group=cluster-server-group, socket-binding-port-offset=150, auto-start=true),
run-batch"` 2>$1
run-batch"` &>/dev/null
align_echo $? $result
# Recreate server two
align_left "$DOTSTRING" "Stop server-two"
result=`jboss-cli.sh --connect --commands="/host=master/server-config=server-two:stop()"` 2>$1
result=`jboss-cli.sh --connect --commands="/host=master/server-config=server-two:stop()"` &>/dev/null
align_echo $? $result
align_left "$DOTSTRING" "Recreate server-two"
result=`jboss-cli.sh --connect --commands="batch,
/host=master/server-config=server-two:remove(),
/host=master/server-config=server-two:add(group=cluster-server-group, socket-binding-port-offset=300, auto-start=true),
run-batch"` 2>$1
run-batch"` &>/dev/null
align_echo $? $result
# Remove server-three
align_left "$DOTSTRING" "Remove server-three"
result=`jboss-cli.sh --connect --commands="/host=master/server-config=server-three:remove()"` 2>$1
result=`jboss-cli.sh --connect --commands="/host=master/server-config=server-three:remove()"` &>/dev/null
align_echo $? $result

# Set controllers memory usage
@@ -436,7 +436,7 @@ result=`jboss-cli.sh --connect --commands="batch,
/host=master/jvm=default:remove(),
/host=master/jvm=default:add(heap-size=$HOST_HEAP_SIZE, max-heap-size=$HOST_MAX_HEAP_SIZE, permgen-size=$HOST_PERMGEN_SIZE, max-permgen-size=$HOST_MAX_PERMGEN_SIZE),
/host=master/jvm=default:add-jvm-option(jvm-option="\""-server"\""),
run-batch"` 2>$1
run-batch"` &>/dev/null
align_echo $? $result
#jboss-cli.sh --connect --commands="/host=master/jvm=default:add-jvm-option(jvm-option="\""-Djgroups.bind_addr=$HOST"\"")"

@@ -447,7 +447,7 @@ result=`jboss-cli.sh --connect --commands="batch,
/host=master/server-config=server-two/system-property=jgroups.bind_addr:add(value=$HOST),
/host=master/server-config=server-one/system-property=GEOSERVER_DATA_DIR:add(value=/data/geoserver-data/server-one),
/host=master/server-config=server-two/system-property=GEOSERVER_DATA_DIR:add(value=/data/geoserver-data/server-two),
run-batch"` 2>$1
run-batch"` &>/dev/null
align_echo $? $result

# Configure admin password and standby password
@@ -459,7 +459,7 @@ align_left "$DOTSTRING" "Add PostgreSQL JDBC Driver"
result=`jboss-cli.sh --connect --commands="batch,
/profile=default/subsystem=datasources/jdbc-driver=postgresql:add(driver-name=postgresql, driver-module-name=org.postgresql, driver-xa-datasource-class-name=org.postgresql.xa.PGXADataSource),
/profile=full-ha/subsystem=datasources/jdbc-driver=postgresql:add(driver-name=postgresql, driver-module-name=org.postgresql, driver-xa-datasource-class-name=org.postgresql.xa.PGXADataSource),
run-batch"` 2>$1
run-batch"` &>/dev/null
align_echo $? $result

# Remove ExampleDS datasource
@@ -467,7 +467,7 @@ align_left "$DOTSTRING" "Remove ExampleDS datasource"
result=`jboss-cli.sh --connect --commands="batch,
/profile=default/subsystem=datasources/data-source=ExampleDS:remove(),
/profile=full-ha/subsystem=datasources/data-source=ExampleDS:remove(),
run-batch"` 2>$1
run-batch"` &>/dev/null
align_echo $? $result
echo "Begin configure DataSource's"
for ((i = 0; i < ${#DS_POOL_NAMES[@]}; i++)); do
@@ -483,7 +483,7 @@ for ((i = 0; i < ${#DS_POOL_NAMES[@]}; i++)); do
        /profile=full-ha/subsystem=security/security-domain=encrypted_pass_$i:add(cache-type=default),
        /profile=full-ha/subsystem=security/security-domain=encrypted_pass_$i/authentication=classic:add(),
        /profile=full-ha/subsystem=security/security-domain=encrypted_pass_$i/authentication=classic/login-module=postgres_login_module:add(code=SecureIdentity, flag=required,module-options=[username="${DS_USERS[$i]}", password="$encrypted"]),
        run-batch"` 2>$1
        run-batch"` &>/dev/null
    align_echo $? $result

    # Add datasources from matrix
@@ -527,7 +527,7 @@ for ((i = 0; i < ${#DS_POOL_NAMES[@]}; i++)); do
        background-validation-millis=1,
        background-validation=true
        ),
    run-batch"` 2>$1
    run-batch"` &>/dev/null
    align_echo $? $result
done

@@ -542,7 +542,7 @@ result=`jboss-cli.sh --connect --commands="batch,
    /system-property=org.otd414.security.null_user_restrict:add(value=false),
    /system-property=org.otd414.security.dont_create_views:add(value=false),
    /system-property=org.otd414.servername:add(value=jboss.7.2),
    run-batch"` 2>$1
    run-batch"` &>/dev/null
align_echo $? $result

service as7-domain restart