Skip to content

Commit

Permalink
#237 fix bugs after E2E testing
Browse files Browse the repository at this point in the history
  • Loading branch information
branciard committed Aug 4, 2020
1 parent b446f6b commit b707900
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 9 deletions.
30 changes: 23 additions & 7 deletions deployer/archipel/start-orchestrator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ if [ ! -z "$CONFIG_FILE" ]; then
#set variables from config file
#get NODES_ROLE
if [ -z "$NODES_ROLE" ]; then
NODES_ROLE=$(cat /config/config.json | jq ".nodesRole")
NODES_ROLE=$(cat /config/config.json | jq ".nodesRole" | sed 's/\"//g')
check_cmd $? 'retrieve NODES_ROLE'
if [ "$NODES_ROLE" == "null" ]; then
echo "Assure old config support. Force config NODES_ROLE to 'operator,operator,operator'"
Expand All @@ -65,9 +65,25 @@ if [ ! -z "$CONFIG_FILE" ]; then
NODE_ROLE=${rolesArray[index]}
fi

if [ -z "$NODE_GROUP" ]; then
NODES_GROUP=$(cat /config/config.json | jq ".nodesGroup" | sed 's/\"//g')
check_cmd $? 'retrieve NODES_GROUP'
IFS=',' read -ra groupsArray <<< "$NODES_GROUP"
index=$(( $NODE_ID - 1 ))
NODE_GROUP=${groupsArray[index]}
fi

if [ -z "$NODE_GROUP_ID" ]; then
NODES_GROUP_ID=$(cat /config/config.json | jq ".nodesGroupId" | sed 's/\"//g')
check_cmd $? 'retrieve NODES_GROUP_ID'
IFS=',' read -ra groupIdsArray <<< "$NODES_GROUP_ID"
index=$(( $NODE_ID - 1 ))
NODE_GROUP_ID=${groupIdsArray[index]}
fi

#get nexmoApiKey
if [ -z "$NEXMO_API_KEY" ]; then
NEXMO_API_KEY_LIST=$(cat /config/config.json | jq ".nexmoApiKey")
NEXMO_API_KEY_LIST=$(cat /config/config.json | jq ".nexmoApiKey" | sed 's/\"//g')
check_cmd $? 'retrieve NEXMO_API_KEY_LIST'
if [ "$NEXMO_API_KEY_LIST" != "null" ]; then
IFS=',' read -ra apikeysArray <<< "$NEXMO_API_KEY_LIST"
Expand All @@ -81,7 +97,7 @@ if [ ! -z "$CONFIG_FILE" ]; then

#get nexmoApiSecret
if [ -z "$NEXMO_API_SECRET" ]; then
NEXMO_API_SECRET_LIST=$(cat /config/config.json | jq ".nexmoApiSecret")
NEXMO_API_SECRET_LIST=$(cat /config/config.json | jq ".nexmoApiSecret" | sed 's/\"//g')
check_cmd $? 'retrieve NEXMO_API_SECRET_LIST'
if [ "$NEXMO_API_SECRET_LIST" != "null" ]; then
IFS=',' read -ra apiSecretArray <<< "$NEXMO_API_SECRET_LIST"
Expand All @@ -95,7 +111,7 @@ if [ ! -z "$CONFIG_FILE" ]; then

#get nexmoSignatureMethod
if [ -z "$NEXMO_API_SIGNATURE_METHOD" ]; then
NEXMO_API_SIGNATURE_METHOD_LIST=$(cat /config/config.json | jq ".nexmoApiSignatureMethod")
NEXMO_API_SIGNATURE_METHOD_LIST=$(cat /config/config.json | jq ".nexmoApiSignatureMethod" | sed 's/\"//g')
check_cmd $? 'retrieve NEXMO_API_SIGNATURE_METHOD_LIST'
if [ "$NEXMO_API_SIGNATURE_METHOD_LIST" != "null" ]; then
IFS=',' read -ra signatureMethodsArray <<< "$NEXMO_API_SIGNATURE_METHOD_LIST"
Expand All @@ -109,7 +125,7 @@ if [ ! -z "$CONFIG_FILE" ]; then

#get nexmoSignatureSecret
if [ -z "$NEXMO_API_SIGNATURE_SECRET" ]; then
NEXMO_API_SIGNATURE_SECRET_LIST=$(cat /config/config.json | jq ".nexmoApiSignatureSecret")
NEXMO_API_SIGNATURE_SECRET_LIST=$(cat /config/config.json | jq ".nexmoApiSignatureSecret" | sed 's/\"//g')
check_cmd $? 'retrieve NEXMO_API_SIGNATURE_SECRET_LIST'
if [ "$NEXMO_API_SIGNATURE_SECRET_LIST" != "null" ]; then
IFS=',' read -ra signatureSecretsArray <<< "$NEXMO_API_SIGNATURE_SECRET_LIST"
Expand All @@ -123,7 +139,7 @@ if [ ! -z "$CONFIG_FILE" ]; then

#get NexmoPhoneNumber
if [ -z "$NEXMO_PHONE_NUMBER" ]; then
NEXMO_PHONE_NUMBER_LIST=$(cat /config/config.json | jq ".nexmoPhoneNumber")
NEXMO_PHONE_NUMBER_LIST=$(cat /config/config.json | jq ".nexmoPhoneNumber" | sed 's/\"//g')
check_cmd $? 'retrieve NEXMO_PHONE_NUMBER_LIST'
if [ "$NEXMO_PHONE_NUMBER_LIST" != "null" ]; then
IFS=',' read -ra phoneNumbersArray <<< "$NEXMO_PHONE_NUMBER_LIST"
Expand All @@ -136,7 +152,7 @@ if [ ! -z "$CONFIG_FILE" ]; then
fi

if [ -z "$OUTLET_PHONE_NUMBER_LIST" ]; then
OUTLET_PHONE_NUMBER_LIST=$(cat /config/config.json | jq ".outletPhoneNumber")
OUTLET_PHONE_NUMBER_LIST=$(cat /config/config.json | jq ".outletPhoneNumber" | sed 's/\"//g')
check_cmd $? 'retrieve OUTLET_PHONE_NUMBERS'
if [ "$OUTLET_PHONE_NUMBERS" != "null" ]; then
OUTLET_PHONE_NUMBER_LIST=$OUTLET_PHONE_NUMBER_LIST
Expand Down
2 changes: 1 addition & 1 deletion orchestrator/src/heartbeats.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Heartbeats {
debug('anyOneAlive', `excludeNode ${excludeNode} aliveTime ${aliveTime} group ${group} bestNumber ${bestNumber}.`);
for (const [key, value] of this.heartbeats.entries()) {
if (key !== excludeNode) {
debug('anyOneAlive', `${key} is alive.`);
debug('anyOneAlive', `heartbeat found. key:${key}, group:${value.group}, blockNumber:${value.blockNumber}.`);
if (value.group === group) {
const lastSeenAgo = bestNumber - value.blockNumber;
if (lastSeenAgo < aliveTime) {
Expand Down
2 changes: 2 additions & 0 deletions orchestrator/src/orchestrator.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,8 @@ class Orchestrator {
// Get current leader from chain
let currentLeader = await this.chain.getLeader(this.group);
const isLeadedGroup = await this.chain.isLeadedGroup(this.group);

debug('orchestrateService', `Is Group ${this.group} a Leaded Group ? => ${isLeadedGroup} `);
currentLeader = currentLeader.toString();

// If current leader is empty
Expand Down
7 changes: 6 additions & 1 deletion orchestrator/src/polkadot.js
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,12 @@ class Polkadot {
// Launch service in specific mode
let containerName = '';
if (mode === 'active') {
const validatorCmdsList = ['--name', `${config.polkadotName.slice(0, -2)}-active`, ...this.commonPolkadotOptions, '--validator', '--reserved-only'];
let name = config.polkadotName;
if (!isEmptyString(config.polkadotAdditionalOptions) && config.polkadotAdditionalOptions.includes('kusama')) {
// slice for never change name for 1000 validator program check
name = config.polkadotName.slice(0, -2);
}
const validatorCmdsList = ['--name', `${name}-active`, ...this.commonPolkadotOptions, '--validator', '--reserved-only'];
if (!isEmptyString(config.polkadotReservedNodes)) {
const sentryPeers = await this.extractPeers(config.polkadotReservedNodes, config.nodesRole, 'sentry');
validatorCmdsList.push(...formatOptionList('--sentry-nodes', sentryPeers));
Expand Down

0 comments on commit b707900

Please sign in to comment.