Skip to content

Commit

Permalink
Merge pull request #153 from ot4i/11.0.0.12-r1
Browse files Browse the repository at this point in the history
11.0.0.12-r1 update
  • Loading branch information
IBMRob authored Apr 30, 2021
2 parents eb5f862 + adabc4b commit 10aa219
Show file tree
Hide file tree
Showing 18 changed files with 2,234 additions and 75 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,12 @@ You can mount the following file structure at `/home/aceuser/initial-config`. Mi
- A pem file called 'ca.crt' will be extracted into the directory `/home/aceuser/ace-server/ssl`
- A pem file called 'tls.key' will be extracted into the directory `/home/aceuser/ace-server/ssl`
- A pem file called 'tls.cert' will be extracted into the directory `/home/aceuser/ace-server/ssl`
- `/home/aceuser/initial-config/bar_overrides`
- For any parameters that need to be set via `mqsiapplybaroverride` include text files with extension `.properties` Eg:
```script
sampleFlow#MQInput.queueName=NEWC
```


## Logging

Expand Down
20 changes: 20 additions & 0 deletions ace_config_bar_overrides.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# © Copyright IBM Corporation 2018.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v2.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v20.html

if [ -z "$MQSI_VERSION" ]; then
source /opt/ibm/ace-11/server/bin/mqsiprofile
fi

if ls /home/aceuser/initial-config/bar_overrides/*.properties >/dev/null 2>&1; then
for propertyFile in /home/aceuser/initial-config/bar_overrides/*.properties
do
mqsiapplybaroverride -b /home/aceuser/initial-config/bars/barfile.bar -p $propertyFile -r
echo $propertyFile >> /home/aceuser/initial-config/bar_overrides/logs.txt
done
fi
2 changes: 2 additions & 0 deletions ace_config_webusers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ if [ -s $ADMINUSERSFILE ] || [ -s $OPERATORUSERSFILE ] || [ -s $EDITORUSERSFILE

OUTPUT=$(mqsichangefileauth -w /home/aceuser/ace-server -r admin -p all+ 2>&1)
logAndExitIfError $? "${OUTPUT}"
OUTPUT=$(mqsichangefileauth -w /home/aceuser/ace-server -r admin -o Data -p all+ 2>&1)
logAndExitIfError $? "${OUTPUT}"

OUTPUT=$(mqsichangefileauth -w /home/aceuser/ace-server -r operator -p read+,write-,execute+ 2>&1)
logAndExitIfError $? "${OUTPUT}"
Expand Down
10 changes: 10 additions & 0 deletions ace_integration_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ if [ -s /home/aceuser/ace-server/odbc.ini ]; then
export ODBCINI=/home/aceuser/ace-server/odbc.ini
fi

# For customers running pod environment
if [ -s /home/aceuser/generic/odbcinst.ini ]; then
export ODBCSYSINI=/home/aceuser/generic
fi

# For customers running ace in docker themselves
if [ -s /home/aceuser/ace-server/extensions/odbcinst.ini ]; then
export ODBCSYSINI=/home/aceuser/ace-server/extensions
fi

# We need to keep the kubernetes port overrides as customers could be running ace in docker themselves
# but we need to allow the ports to be overwritten in the pod environment if set by the operator
if ! [[ -z "${KUBERNETES_PORT}" ]] && ! [[ -z "${SERVICE_NAME}" ]] && ! [[ -z "${MQSI_OVERRIDE_HTTP_PORT}" ]] && ! [[ -z "${MQSI_OVERRIDE_HTTPS_PORT}" ]] ; then
Expand Down
27 changes: 25 additions & 2 deletions cmd/chkacehealthy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,40 @@ import (
"fmt"
"net"
"os"
"time"

"github.com/ot4i/ace-docker/internal/command"
"github.com/ot4i/ace-docker/internal/qmgr"
)

const restartIsTimeoutInSeconds = 60

func main() {
// Check if the integration server has started the admin REST endpoint
conn, err := net.Dial("tcp", "127.0.0.1:7600")

if err != nil {
fmt.Println(err)
os.Exit(1)

fmt.Println("REST endpoint failed" + err.Error())

fileInfo, statErr := os.Stat("/tmp/integration_server_restart.timestamp")

if statErr != nil {
fmt.Println(statErr)
os.Exit(1)
} else {
fmt.Println("Integration server restart file found")
timeNow := time.Now()
timeDiff := timeNow.Sub(fileInfo.ModTime())

if timeDiff.Seconds() < restartIsTimeoutInSeconds {
fmt.Println("Integration server is restarting")
os.Exit(0)
} else {
fmt.Println("Integration restart time elapsed")
os.Exit(1)
}
}
}
conn.Close()

Expand Down
2 changes: 1 addition & 1 deletion cmd/runaceserver/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func getLogOutputFormat() string {
case "json":
return "ibmjson"
case "basic":
return "text"
return "idText"
default:
return "ibmjson"
}
Expand Down
50 changes: 47 additions & 3 deletions cmd/runaceserver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ package main

import (
"errors"
"io/ioutil"
"os"

"github.com/ot4i/ace-docker/common/designer"
"github.com/ot4i/ace-docker/internal/command"
"github.com/ot4i/ace-docker/internal/configuration"
iscommandsapi "github.com/ot4i/ace-docker/internal/isCommandsApi"
"github.com/ot4i/ace-docker/internal/metrics"
"github.com/ot4i/ace-docker/internal/name"
"github.com/ot4i/ace-docker/internal/qmgr"
"github.com/ot4i/ace-docker/common/designer"
)

func doMain() error {
Expand Down Expand Up @@ -57,6 +59,7 @@ func doMain() error {
}

performShutdown := func() {

metrics.StopMetricsGathering()

log.Print("Stopping Integration Server")
Expand All @@ -69,9 +72,41 @@ func doMain() error {

checkLogs()

iscommandsapi.StopCommandsAPIServer()
log.Print("Shutdown complete")
}

restartIntegrationServer := func() error {
err := ioutil.WriteFile("/tmp/integration_server_restart.timestamp", []byte(""), 0755)

if err != nil {
log.Print("RestartIntegrationServer - Creating restart file failed")
return err
}

log.Print("RestartIntegrationServer - Stopping integration server")
stopIntegrationServer(integrationServerProcess)
log.Println("RestartIntegrationServer - Starting integration server")

integrationServerProcess = startIntegrationServer()
err = integrationServerProcess.ReturnError

if integrationServerProcess.ReturnError == nil {
log.Println("RestartIntegrationServer - Waiting for integration server")
err = waitForIntegrationServer()
}

if err != nil {
logTermination(err)
performShutdown()
return err
}

log.Println("RestartIntegrationServer - Integration server is ready")

return nil
}

// Start signal handler
signalControl := signalHandler(performShutdown)

Expand Down Expand Up @@ -120,7 +155,7 @@ func doMain() error {
return err
}

// Note: this will do nothing if there are no crs set in the environment
// Note: this will do nothing if there are no crs set in the environment
err = configuration.SetupConfigurationsFiles(log, "/home/aceuser")
if err != nil {
logTermination(err)
Expand Down Expand Up @@ -150,7 +185,7 @@ func doMain() error {
performShutdown()
return err
}

log.Println("Starting integration server")
integrationServerProcess = startIntegrationServer()
if integrationServerProcess.ReturnError != nil {
Expand All @@ -174,6 +209,15 @@ func doMain() error {
log.Println("Metrics are disabled")
}

log.Println("Starting integration server commands API server")
err = iscommandsapi.StartCommandsAPIServer(log, 7980, restartIntegrationServer)

if err != nil {
log.Println("Failed to start isapi server " + err.Error())
} else {
log.Println("Integration API started")
}

// Start reaping zombies from now on.
// Start this here, so that we don't reap any sub-processes created
// by this process (e.g. for crtmqm or strmqm)
Expand Down
2 changes: 1 addition & 1 deletion common/designer/flow_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ var IsFlowValid = func(log logger.LoggerInterface, flow string, flowFile []byte)

disabledConnectors := findDisabledConnectorInFlow(flowDocument, log)
if disabledConnectors != "" {
log.Errorf("Flow %v contains one or more connectors, which aren't supported under the current license. Please update your license to enable this flow to run. The unsupported connectors are: %v.", flow, disabledConnectors)
log.Errorf("Flow %v contains one or more connectors that aren't supported under the current license. Please update your license to enable this flow to run. The unsupported connectors are: %v.", flow, disabledConnectors)
}
return disabledConnectors == "", nil
}
Expand Down
9 changes: 0 additions & 9 deletions internal/configuration/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"bytes"
"encoding/base64"
"errors"
"io"
"io/ioutil"
"os"
"os/exec"
Expand Down Expand Up @@ -49,8 +48,6 @@ var (
* START: FUNCTIONS CREATES EXTERNAL REQUESTS
*/

var ioutilReadFile = ioutil.ReadFile

func getPodNamespace() (string, error) {
if data, err := ioutilReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace"); err == nil {
if ns := strings.TrimSpace(string(data)); len(ns) > 0 {
Expand All @@ -61,9 +58,6 @@ func getPodNamespace() (string, error) {
return "default", nil
}

var osMkdirAll = os.MkdirAll
var ioutilWriteFile = ioutil.WriteFile

func writeConfigurationFile(dir string, fileName string, contents []byte) error {
makeDirErr := osMkdirAll(dir, 0740)
if makeDirErr != nil {
Expand All @@ -72,9 +66,6 @@ func writeConfigurationFile(dir string, fileName string, contents []byte) error
return ioutilWriteFile(dir+string(os.PathSeparator)+fileName, contents, 0740)
}

var osOpenFile = os.OpenFile
var ioCopy = io.Copy

func unzip(log logger.LoggerInterface, dir string, contents []byte) error {
var filenames []string
zipReader, err := zip.NewReader(bytes.NewReader(contents), int64(len(contents)))
Expand Down
38 changes: 38 additions & 0 deletions internal/configuration/ioutil.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package configuration

import (
"io"
"io/ioutil"
"os"
)

var ioutilReadFile = ioutil.ReadFile
var osMkdirAll = os.MkdirAll
var ioutilWriteFile = ioutil.WriteFile
var osOpenFile = os.OpenFile
var ioCopy = io.Copy
var osStat = os.Stat
var osIsNotExist = os.IsNotExist

var internalAppendFile = func(fileName string, fileContent []byte, filePerm os.FileMode) error {

file, err := os.OpenFile(fileName, os.O_APPEND|os.O_CREATE|os.O_WRONLY, filePerm)

if err != nil {
return err
}

defer file.Close()

_, err = file.Write(fileContent)

if err == nil {
err = file.Sync()
}

if err != nil {
return err
}

return nil
}
Loading

0 comments on commit 10aa219

Please sign in to comment.