Skip to content

Commit

Permalink
Merge branch 'hotfix/1.5.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-barbosa-oliveira committed Apr 20, 2020
2 parents 1dda757 + e707b8c commit 7d7ab6d
Show file tree
Hide file tree
Showing 12 changed files with 211 additions and 23 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ Repository with configuration files required for OCARIoT platform **deployment i
All software installation is performed using the following command:

```sh
curl -o- https://raw.githubusercontent.com/ocariot/docker-swarm/1.5.0/install.sh | sudo bash
curl -o- https://raw.githubusercontent.com/ocariot/docker-swarm/1.5.1/install.sh | sudo bash
```

```sh
wget -qO- https://raw.githubusercontent.com/ocariot/docker-swarm/1.5.0/install.sh | sudo bash
wget -qO- https://raw.githubusercontent.com/ocariot/docker-swarm/1.5.1/install.sh | sudo bash
```


Expand Down Expand Up @@ -175,7 +175,7 @@ To execute all the necessary commands to lift the entire stack of containers use
$ sudo ocariot stack start
```

Lifting all containers may take a few seconds or a few minutes. When the entire stack has been successfully initialized, you will see the following message on the terminal: `Stack initialized successfully!!! :)` followed by the OCARIoT logo.
Lifting all containers may take a few seconds or a few minutes. When the entire stack has been successfully initialized, you will see the OCARIoT logo followed by the following message on the terminal: `Stack initialized successfully!!! :)`

> :warning: **During the first boot, the encryption keys and root access token will be generated. This content will be made available in the *keys* file, which will be generated at the place of execution of the command currently described. This file is of fundamental importance for the restoration of backups.**
>
Expand Down
163 changes: 163 additions & 0 deletions config/ocariot/notification/messages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
[{
"message_type": "notification:child",
"en": {
"title": "We miss you.",
"body": "You have not logged into OCARIoT Game APP in the last %d days!"
},
"pt": {
"title": "Sentimos a sua falta.",
"body": "Você não tem entrado no aplicativo do OCARIoT há %d dias!"
},
"es": {
"title": "Te echamos de menos.",
"body": "¡No has iniciado sesión en la aplicación del juego OCARIoT en los últimos %d días!"
},
"el": {
"title": "Μας λείπεις.",
"body": "Δεν έχετε συνδεθεί στο APP OCARIoT Game τις τελευταίες %d ημέρες!"
}
}, {
"message_type": "notification:family",
"en": {
"title": "We miss you.",
"body": "You have not logged into OCARIoT platform in the last %d days!"
},
"pt": {
"title": "Sentimos sua falta.",
"body": "Você não fez login na plataforma OCARIoT nos últimos %d dias!"
},
"es": {
"title": "Te echamos de menos.",
"body": "¡No has iniciado sesión en la plataforma OCARIoT en los últimos %d días!"
},
"el": {
"title": "Μας λείπεις.",
"body": "Δεν έχετε συνδεθεί στην πλατφόρμα OCARIoT τις τελευταίες %d ημέρες!"
}
}, {
"message_type": "notification:teacher",
"en": {
"title": "We miss you.",
"body": "You have not logged into OCARIoT platform in the last %d days!"
},
"pt": {
"title": "Sentimos sua falta.",
"body": "Você não fez login na plataforma OCARIoT nos últimos %d dias!\t"
},
"es": {
"title": "Te echamos de menos.",
"body": "¡No has iniciado sesión en la plataforma OCARIoT en los últimos %d días!"
},
"el": {
"title": "Μας λείπεις.",
"body": "Δεν έχετε συνδεθεί στην πλατφόρμα OCARIoT τις τελευταίες %d ημέρες!"
}
}, {
"message_type": "notification:child_teacher",
"en": {
"title": "Child not using OCARIoT Game APP.",
"body": "%s did not log into OCARIoT Game APP in the last %d days!"
},
"pt": {
"title": "A criança não está usando o aplicativo do OCARIoT.",
"body": "%s não fez login no aplicativo do OCARIoT nos últimos %d dias!"
},
"es": {
"title": "El niño no está usando la aplicación del juego OCARIoT.",
"body": "¡%s no inició sesión en la aplicación OCARIoT en los últimos %d días!"
},
"el": {
"title": "Το παιδί δεν χρησιμοποιεί την εφαρμογή OCARIoT APP.",
"body": "Ο χρήστης %s δεν μπήκε στο APP OCARIoT Game τις τελευταίες %d ημέρες!"
}
}, {
"message_type": "notification:child_family",
"en": {
"title": "Child not using OCARIoT Game APP.",
"body": "%s did not log into OCARIoT Game APP in the last %d days!"
},
"pt": {
"title": "A criança não está usando o aplicativo do OCARIoT.",
"body": "%s não entrou no aplicativo do OCARIoT nos últimos %d dias!"
},
"es": {
"title": "Niño que no usa la aplicación de juego OCARIoT.",
"body": "¡%s no inició sesión en la aplicación OCARIoT en los últimos %d días!"
},
"el": {
"title": "Το παιδί δεν χρησιμοποιεί την εφαρμογή OCARIoT APP.",
"body": "Ο χρήστης %s δεν μπήκε στο APP OCARIoT Game τις τελευταίες %d ημέρες!"
}
}, {
"message_type": "mission:new",
"en": {
"title": "New mission!",
"body": "You have a new mission available."
},
"pt": {
"title": "Nova missão!",
"body": "Você tem uma nova missão disponível."
},
"es": {
"title": "¡Nueva misión!",
"body": "Tienes una nueva misión disponible."
},
"el": {
"title": "Νέα αποστολή!",
"body": "Έχετε διαθέσιμη μια νέα αποστολή."
}
}, {
"message_type": "mission:done",
"en": {
"title": "Mission accomplished.",
"body": "Well done! You have completed a mission."
},
"pt": {
"title": "Missão cumprida.",
"body": "Muito bem! Você completou uma missão."
},
"es": {
"title": "Misión cumplida.",
"body": "¡Bien hecho! Has completado una misión"
},
"el": {
"title": "Αποστολή εξετελέσθει.",
"body": "Μπράβο! Έχετε ολοκληρώσει μια αποστολή."
}
}, {
"message_type": "monitoring:miss_child_data",
"en": {
"title": "No new data.",
"body": "OCARIoT has not received new data from %s in the last %d days!"
},
"pt": {
"title": "Sem novos dados.",
"body": "OCARIoT não recebeu novos dados de %s nos últimos %d dias!"
},
"es": {
"title": "No hay nuevos datos.",
"body": "¡OCARIoT no ha recibido nuevos datos de %s en los últimos %d días!"
},
"el": {
"title": "Ο αισθητήρας σταμάτησε να στέλνει δεδομένα.",
"body": "Το OCARIoT δεν έχει λάβει νέα δεδομένα από τον χρήστη %s τις τελευταίες ημέρες %d!"
}
}, {
"message_type": "iot:miss_data",
"en": {
"title": "Sensor stopped sending data.",
"body": "%s sensor deployed in %s, %s didn't send data in the last %d days."
},
"pt": {
"title": "O sensor parou de enviar dados.",
"body": "O sensor %s colocado em %s, %s não enviou dados nos últimos %d dias."
},
"es": {
"title": "El sensor dejó de enviar datos.",
"body": "El sensor %s implementado en %s, %s no envió datos en los últimos %d días."
},
"el": {
"title": "Ο αισθητήρας σταμάτησε να στέλνει δεδομένα.",
"body": "Ο αισθητήρας %s που αναπτύχθηκε στη θέση %s, %s δεν έστειλε δεδομένα τις τελευταίες X ημέρες."
}
}]
4 changes: 2 additions & 2 deletions config/ocariot/vault/scripts/initializing_vault.sh
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,8 @@ main()
# credentials and active the RabbitMQ plugin.
configure_rabbitmq_plugin

echo "Stack initialized successfully!!! :)"
wget -qO - https://pastebin.com/raw/jNnscFJX
wget -qO - https://pastebin.com/raw/jNnscFJX
echo -e "\nStack initialized successfully!!! :)"
}

# Function to check if Consul was initialized
Expand Down
12 changes: 11 additions & 1 deletion docker-ocariot-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -793,13 +793,19 @@ services:
- PORT_HTTPS=10001
- GOOGLE_APPLICATION_CREDENTIALS=/etc/keys/firebase_keyfile.json
- RABBITMQ_SSL=true
- MESSAGES_PATH=/etc/keys/messages.json
volumes:
- ${FIREBASE_KEYFILE_PATH}:/etc/keys/firebase_keyfile.json:ro
- type: bind
source: ./config/ocariot/vault/.tokens/access-token-notification-service
target: /tmp/access-token-notification-service
entrypoint: initializing_service.sh
configs:
- source: ocariot-messages-notification-config
target: /etc/keys/messages.json
mode: 0400
- source: ocariot-firebase-notification-config
target: /etc/keys/firebase_keyfile.json
mode: 0400
- source: ocariot-init-service-config
target: /usr/bin/initializing_service.sh
mode: 0100
Expand Down Expand Up @@ -951,6 +957,10 @@ configs:
file: config/ocariot/psmysql/scripts/initializing_psmysql.sh
ocariot-init-api-gateway-config:
file: config/ocariot/api-gateway/scripts/initializing_api_gateway.sh
ocariot-messages-notification-config:
file: config/ocariot/notification/messages.json
ocariot-firebase-notification-config:
file: ${FIREBASE_KEYFILE_PATH}

volumes:
psmdb-account-data:
Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ INSTALL_PATH="/opt/ocariot-swarm"

version()
{
echo "1.5.0"
echo "1.5.1"
}

isInstalled()
Expand Down
7 changes: 2 additions & 5 deletions scripts/general_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@ start_watchdog()
${INSTALL_PATH}/scripts/ocariot_watchdog.sh >> /tmp/ocariot_watchdog.log &
}

stop_watchdog()
stop_process()
{
ps aux \
| grep -w ocariot_watchdog.sh \
| sed '/grep/d' \
| awk '{system("kill -9 "$2)}'
pgrep -f "$1" | xargs kill -9
}

create_network()
Expand Down
7 changes: 6 additions & 1 deletion scripts/monitor/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,17 @@ if [ "$#" -ne 0 ]; then
exit
fi

if [ -z "$(docker stack ls | grep -w ${OCARIOT_STACK_NAME})" ];
if [ -z "$(docker stack ls --format {{.Name}} | grep -w ${OCARIOT_STACK_NAME})" ];
then
echo "It is necessary to initialize the ocariot services stack" \
"(sudo ocariot stack start) to make the Monitor accessible in the browser."
fi

if [ -z "$(docker stack ls --format {{.Name}} | grep -w ${MONITOR_STACK_NAME})" ];
then
docker stack rm ${MONITOR_STACK_NAME} &> /dev/null
fi

create_network

set_variables_environment "${ENV_MONITOR}"
Expand Down
3 changes: 2 additions & 1 deletion scripts/monitor/volumes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ fi
INCREMENT=1
for VOLUME in ${VOLUMES_BKP}; do
VOLUMES="${VOLUMES} -v ${VOLUME}:/source/${VOLUME}${SOURCE_VOLUME_PROPERTY}"
VOLUMES_CACHE="${VOLUMES_CACHE} -v /tmp/cache-ocariot-monitor/${VOLUME}:/volumerize-cache/${VOLUME}"
VOLUMES_CACHE="${VOLUMES_CACHE} -v cache-${VOLUME}:/volumerize-cache/${VOLUME}"
INCREMENT=$((INCREMENT + 1))
done

Expand Down Expand Up @@ -211,6 +211,7 @@ for VOLUME in ${VOLUMES_BKP}; do
echo "======Backup of ${VOLUME} volume======"

docker exec -t \
-e VOLUMERIZE_CACHE=/volumerize-cache/${VOLUME} \
-e VOLUMERIZE_SOURCE=/source/${VOLUME} \
-e VOLUMERIZE_TARGET="multi:///etc/volumerize/multiconfig.json?mode=mirror&onfail=abort" \
-e GOOGLE_DRIVE_ID=${CLOUD_ACCESS_KEY_ID} \
Expand Down
22 changes: 17 additions & 5 deletions scripts/stack/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
INSTALL_PATH="/opt/ocariot-swarm"
source ${INSTALL_PATH}/scripts/general_functions.sh

stop_log()
{
COMMAND="docker service logs ocariot_vault"
while [[ -z "$( ${COMMAND} 2> /dev/null | grep -ow 'Stack initialized successfully')" ]]; do
sleep 1
done

stop_process "${COMMAND}"
}

# General function for setting up the environment
# before starting services
configure_environment()
Expand Down Expand Up @@ -84,10 +94,11 @@ fi

GENERATE_KEYS_FILE="FALSE"

docker stack ps ${OCARIOT_STACK_NAME} > /dev/null 2>&1
STATUS_OCARIOT_STACK=$?
STATUS_OCARIOT_STACK=$(docker stack ls --format {{.Name}} | grep -w ${OCARIOT_STACK_NAME})

if [ -z "${STATUS_OCARIOT_STACK}" ]; then
docker stack rm ${OCARIOT_STACK_NAME} &> /dev/null

if [ "${STATUS_OCARIOT_STACK}" -ne 0 ]; then
# General function for setting up the environment
# before starting services
configure_environment
Expand Down Expand Up @@ -118,9 +129,10 @@ create_network
# Executing the services in mode swarm defined in docker-compose.yml file
docker stack deploy -c ${INSTALL_PATH}/docker-ocariot-stack.yml ${OCARIOT_STACK_NAME} --resolve-image changed

if [ "${STATUS_OCARIOT_STACK}" -ne 0 ]; then
if [ -z "${STATUS_OCARIOT_STACK}" ]; then
validate_keys "${GENERATE_KEYS_FILE}" &
waiting_vault
# Monitoring Vault service
docker service logs ${OCARIOT_STACK_NAME}_vault -f 2> /dev/null
docker service logs ${OCARIOT_STACK_NAME}_vault -f 2> /dev/null &
stop_log
fi
3 changes: 2 additions & 1 deletion scripts/stack/volumes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ fi
INCREMENT=1
for VOLUME in ${VOLUMES_BKP}; do
VOLUMES="${VOLUMES} -v ${VOLUME}:/source/${VOLUME}${SOURCE_VOLUME_PROPERTY}"
VOLUMES_CACHE="${VOLUMES_CACHE} -v /tmp/cache-ocariot/${VOLUME}:/volumerize-cache/${VOLUME}"
VOLUMES_CACHE="${VOLUMES_CACHE} -v cache-${VOLUME}:/volumerize-cache/${VOLUME}"
INCREMENT=$((INCREMENT + 1))
done

Expand Down Expand Up @@ -230,6 +230,7 @@ for VOLUME in ${VOLUMES_BKP}; do
echo "======Backup of ${VOLUME} volume======"

docker exec -t \
-e VOLUMERIZE_CACHE=/volumerize-cache/${VOLUME} \
-e VOLUMERIZE_SOURCE=/source/${VOLUME} \
-e VOLUMERIZE_TARGET="multi:///etc/volumerize/multiconfig.json?mode=mirror&onfail=abort" \
-e GOOGLE_DRIVE_ID=${CLOUD_ACCESS_KEY_ID} \
Expand Down
3 changes: 1 addition & 2 deletions scripts/uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ sudo rm -f /usr/local/bin/ocariot
( crontab -u ${USER} -l | sed "/${MONITOR_BKP_COMMAND}/d"; ) | crontab -u ${USER} -
sudo rm -fR ${INSTALL_PATH}
sudo rm -f /tmp/ocariot_watchdog.log /tmp/ocariot_backup.log
sudo rm -rf /tmp/cache-ocariot*

stop_watchdog
stop_process "ocariot_watchdog.sh"

STATUS=$(isInstalled)
if ! ${STATUS}; then
Expand Down
2 changes: 1 addition & 1 deletion scripts/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ sudo git -C ${INSTALL_PATH} checkout "tags/${TARGET}" &> /dev/null

if [ ${TARGET} = $(git -C ${INSTALL_PATH} describe --tags --abbrev=0) ];then
if [ "${ACTUAL_VERSION}" != ${TARGET} ];then
stop_watchdog
stop_process "ocariot_watchdog.sh"
start_watchdog
fi
update_env ${ENV_OCARIOT}
Expand Down

0 comments on commit 7d7ab6d

Please sign in to comment.