Commit 71facb6a authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Merge branch 'dev' into 'master'

Actualiza configuración de despliegue

See merge request redmic-project/mqtt/vmq-redis-backup!9
parents 1eca84d3 6e43cb7d
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -16,14 +16,18 @@ stages:
  - maintenance

variables:
  STACK: mqtt
  STATUS_CHECK_DELAY: 30
  PROJECT_PARENT_NAME: mqtt

.deploy:
  script:
    - >
      deploy.sh IMAGE_NAME=${IMAGE_NAME} IMAGE_TAG=${IMAGE_TAG} AWS_REGION=${AWS_REGION} AWS_BUCKET=${AWS_BUCKET}
      AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
  variables:
    STACK: ${PROJECT_PARENT_NAME}
    SERVICES_TO_CHECK: ${PROJECT_PARENT_NAME}_${CI_PROJECT_NAME}
    STATUS_CHECK_DELAY: 30

.scheduled-run:
  variables:
    STACK: ${PROJECT_PARENT_NAME}
    SERVICE: ${PROJECT_PARENT_NAME}_${CI_PROJECT_NAME}

scheduled-run-development:
  script: ':'

LICENSE

0 → 100644
+21 −0
Original line number Diff line number Diff line
MIT License

Copyright (c) 2020 REDMIC Project / MQTT

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+3 −3
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ Get your backup file from S3 and copy it inside **vernemq-redis-data-vol** (moun

Update **vmq-redis** service to change command in containers:

```
```sh
# Assuming 'mqtt' is the stack name
$ docker service update --args="redis-server" mqtt_vmq-redis
```
@@ -28,7 +28,7 @@ This tells redis to load database from `dump.rdb` and stop using `appendonly.aof

Get into new container (Portainer or CLI) and run these commands:

```
```sh
# Replace the container name
$ docker exec -it mqtt_vmq-redis.<n>.<xxx> /bin/bash
# Assuming 'mqtt' is the stack name and '/data' is the current path
@@ -43,7 +43,7 @@ This will rotate the old appendonly file and enable again appendonly mode, to ge

Update **vmq-redis** service again to change command in containers:

```
```sh
# Assuming 'mqtt' is the stack name
docker service update --args="redis-server --appendonly yes" mqtt_vmq-redis
```
+18 −16
Original line number Diff line number Diff line
@@ -2,39 +2,41 @@ version: '3.5'

services:
  vmq-redis-backup:
    image: ${IMAGE_NAME}:${IMAGE_TAG:-latest}
    image: ${IMAGE_NAME:-registry.gitlab.com/redmic-project/mqtt/vmq-redis-backup}:${IMAGE_TAG:-latest}
    environment:
      - REDIS_HOST
      - REDIS_PORT
      - BACKUP_PATH
      - AWS_BUCKET
      - AWS_ACCESS_KEY_ID
      - AWS_SECRET_ACCESS_KEY
      - AWS_DEFAULT_REGION
      - PUSHGATEWAY_HOST
      - PUSHGATEWAY_JOB
      REDIS_HOST:
      REDIS_PORT:
      BACKUP_PATH:
      AWS_BUCKET:
      AWS_ACCESS_KEY_ID:
      AWS_SECRET_ACCESS_KEY:
      AWS_DEFAULT_REGION:
      PUSHGATEWAY_HOST:
      PUSHGATEWAY_JOB:
    networks:
      - vernemq-net
      - metric-net
    deploy:
      mode: replicated
      replicas: 1
      replicas: ${REPLICAS:-1}
      restart_policy:
        condition: on-failure
        delay: 10s
        window: 1m
        delay: ${RESTART_DELAY:-10s}
      resources:
        limits:
          cpus: '0.1'
          memory: 64M
          cpus: '${RESOURCES_LIMITS_CPUS:-0.1}'
          memory: ${RESOURCES_LIMITS_MEMORY:-64M}
        reservations:
          memory: 52M
          cpus: '${RESOURCES_RESERVATIONS_CPUS:-0.001}'
          memory: ${RESOURCES_RESERVATIONS_MEMORY:-16M}

networks:
  vernemq-net:
    name: ${VERNEMQ_NET_NAME:-vernemq-net}
    driver: ${VERNEMQ_NET_DRIVER:-overlay}
    external: true

  metric-net:
    name: ${METRIC_NET_NAME:-metric-net}
    driver: ${METRIC_NET_DRIVER:-overlay}
    external: true