diff --git a/.env b/.env new file mode 100644 index 0000000..9a3a2ed --- /dev/null +++ b/.env @@ -0,0 +1,6 @@ +LRPORT=1474 +ARPORT=1475 +MPORT=1883 +MSPORT=8883 +MWSPORT=9001 +REDPORT=1880 \ No newline at end of file diff --git a/README.md b/README.md index ccb12a2..7e8ed52 100644 --- a/README.md +++ b/README.md @@ -6,30 +6,34 @@ docker-compose : https://docs.docker.com/compose/ ## How to run -* Install docker on your system as described [here](https://docs.docker.com/get-docker/) -* Install docker-compose on your system as described [here](https://docs.docker.com/compose/install/) +* Install docker on your system as described (min 20.10.x) [here](https://docs.docker.com/get-docker/) +* Install docker-compose on your system as described (min 2.5.x) [here](https://github.com/docker/compose/releases/tag/v2.5.0) * `cd` into the root folder of this project +* create a .env file +```bash +cp env_template .env +``` * and then run: ```bash docker-compose up -d ``` -to build-up the container stack based on Debian Buster. +to build-up the container stack based on Alpine Linux. * instead run: ```bash -docker-compose -f docker-compose-alpine.yml up -d +docker-compose -f docker-compose-debian.yml up -d ``` -to build-up the container stack based on Alpine Linux. +to build-up the container stack based on Debian Buster. Once the command has been fired-up, docker-compose itself will take care of building the layer images and running a set of isolated containers in a standard docker network. In the very specific, the running containers will be: -* **redis-volatile** (volatile instance of Redis running on port 6379) -* **redis-persistent** (persistent instance of Redis running on port 6380) -* **rediseen-volatile** (REST-like API service for Redis volatile database running on port 8000) -* **rediseen-persistent** (REST-like API service for Redis persistent database running on port 8001) -* **lrod** (instance of Lightning-rod python module running on port 1474) -* **arancino** (instance of arancino python module running on port 1475) +* **redis-volatile** (volatile instance of Redis) +* **redis-persistent** (persistent instance of Redis) +* **lrod** (instance of Lightning-rod python module) +* **arancino** (instance of arancino python module) +* **mosquitto** (instance of mosquitto) +* **nodered** (instance of nodered) to be sure that the containers are properly up and running, execute from bash: @@ -59,24 +63,55 @@ tail -f /var/log/arancino/arancino.log what we expect, of course, is to get the MCU firmware interacting with the python module as it should on a physical Arancino main board. -## How to run without building the docker layer images +## Change the default ports +These are the default values: + +|Service| Variable | Port | +|-------|-------|---| +|lrod|LRPORT|1474| +|arancino api|ARPORT|1475| +|mosquitto default|MPORT|1883| +|secure mosquitto |MSPORT|8883| +|websocket mosquitto |MWSPORT|9001| +|nodered |REDPORT|1880| -* Install docker on your system as described [here](https://docs.docker.com/get-docker/) -* Install docker-compose on your system as described [here](https://docs.docker.com/compose/install/) +edit the .env file if you need to change them. + +## How to launch the stack + +* Install docker on your system as described (min 20.10.x) [here](https://docs.docker.com/get-docker/) +* Install docker-compose on your system as described (min 2.5.x) [here](https://github.com/docker/compose/releases/tag/v2.5.0) * `cd` into the root folder of this project * and then run: ```bash -docker-compose -f docker-compose-no-build.yml up -d +docker-compose up -d ``` -to build-up the container stack based on Debian Buster. +to build-up the container stack based on Alpine Linux. * instead run: ```bash -docker-compose -f docker-compose-alpine-no-build.yml up -d +docker-compose -f docker-compose-debian.yml up -d ``` +to build-up the container stack based on Debian Buster. +## How to launch the stack with building the docker layer images + +* Install docker on your system as described (min 20.10.x) [here](https://docs.docker.com/get-docker/) +* Install docker-compose on your system as described (min 2.5.x) [here](https://github.com/docker/compose/releases/tag/v2.5.0) +* `cd` into the root folder of this project +* and then run: +```bash +docker-compose -f docker-compose-build.yml up -d +``` to build-up the container stack based on Alpine Linux. +* instead run: +```bash +docker-compose -f docker-compose-build-debian.yml up -d +``` +to build-up the container stack based on Debian Buster. + + ## Final notes for Mac OSX Please note that under OSX, due to the specific system design, all volumes starting with the prefix: diff --git a/araX/docker-compose.yml b/araX/docker-compose.yml index 5e40553..e36325c 100644 --- a/araX/docker-compose.yml +++ b/araX/docker-compose.yml @@ -43,36 +43,6 @@ services: networks: - "arancino_net" - rediseen-volatile: - restart: always - privileged: true - image: smartmeio/rediseen:2.4.0 - environment: - - REDISEEN_REDIS_URI=redis://:@redis-volatile-arancino:6379 - - REDISEEN_DB_EXPOSED=0-5 - - REDISEEN_KEY_PATTERN_EXPOSE_ALL=true - - REDISEEN_HOST=0.0.0.0 - - REDISEEN_PORT=8001 - depends_on: - - redis-volatile-arancino - networks: - - "arancino_net" - - rediseen-persistent: - restart: always - privileged: true - image: smartmeio/rediseen:2.4.0 - environment: - - REDISEEN_REDIS_URI=redis://:@redis-persistent-arancino:6380 - - REDISEEN_DB_EXPOSED=0-5 - - REDISEEN_KEY_PATTERN_EXPOSE_ALL=true - - REDISEEN_HOST=0.0.0.0 - - REDISEEN_PORT=8002 - depends_on: - - redis-persistent-arancino - networks: - - "arancino_net" - arancino: restart: always privileged: true @@ -91,8 +61,7 @@ services: depends_on: - redis-volatile-arancino - redis-persistent-arancino - - rediseen-volatile - - rediseen-persistent + ports: - "127.0.0.1:${ARPORT}:1475" networks: diff --git a/docker-compose-alpine-no-build.yml b/docker-compose-alpine-no-build.yml deleted file mode 100644 index ecdaf03..0000000 --- a/docker-compose-alpine-no-build.yml +++ /dev/null @@ -1,152 +0,0 @@ -############################################################ -# # -# docker-compose.yml for Arancino Ecosystem (Alpine Linux) # -# # -############################################################ - -version: '3.7' -services: - lrod: - container_name: lrod - restart: always - privileged: true - image: smartmeio/lrod:0.5.0-alpine - volumes: - # - '/srv/lrod/etc/iotronic:/etc/iotronic' - - './srv/lrod/var/log/iotronic:/var/log/iotronic' - # - '/srv/lrod/var/lib/iotronic:/var/lib/iotronic' - network_mode: host - - redis-volatile: - container_name: redis-volatile-arancino - restart: always - privileged: true - image: smartmeio/redis-volatile:6.0.16-alpine - command: redis-server /etc/redis/redis-volatile.conf - environment: - - REDIS_REPLICATION_MODE=master - volumes: - - './srv/redis-volatile/redis-data:/var/lib/redis' - ports: - - '6379:6379' - networks: - - 'default' - - redis-persistent: - container_name: redis-persistent-arancino - restart: always - privileged: true - image: smartmeio/redis-persistent:6.0.16-alpine - command: redis-server /etc/redis/redis-persistent.conf - environment: - - REDIS_REPLICATION_MODE=master - volumes: - - './srv/redis-persistent/redis-data:/var/lib/redis' - ports: - - '6380:6380' - networks: - - 'default' - - rediseen-volatile: - container_name: rediseen-volatile-arancino - restart: always - privileged: true - image: smartmeio/rediseen:2.4.0 - environment: - - REDISEEN_REDIS_URI=redis://:@redis-volatile-arancino:6379 - - REDISEEN_DB_EXPOSED=0-5 - - REDISEEN_KEY_PATTERN_EXPOSE_ALL=true - - REDISEEN_HOST=0.0.0.0 - depends_on: - - redis-volatile - ports: - - '8000:8000' - networks: - - 'default' - - rediseen-persistent: - container_name: rediseen-persistent-arancino - restart: always - privileged: true - image: smartmeio/rediseen:2.4.0 - environment: - - REDISEEN_REDIS_URI=redis://:@redis-persistent-arancino:6380 - - REDISEEN_DB_EXPOSED=0-5 - - REDISEEN_KEY_PATTERN_EXPOSE_ALL=true - - REDISEEN_HOST=0.0.0.0 - - REDISEEN_PORT=8001 - depends_on: - - redis-persistent - ports: - - '8001:8001' - networks: - - 'default' - - arancino: - container_name: arancino - restart: always - privileged: true - image: smartmeio/arancino:2.4.0-alpine - command: /bin/bash -c 'gunicorn -c "/etc/arancino/config/gunicorn.cfg.py" arancino.ArancinoStart:app' - environment: - - ARANCINO=/etc/arancino - - ARANCINOCONF=/etc/arancino/config - - ARANCINOLOG=/var/log/arancino - - ARANCINOENV=PROD - - FLASK_ENV=production - volumes: - # - '/srv/arancino/etc/config:/etc/arancino/config' - - './srv/arancino/var/log/arancino:/var/log/arancino' - - '/dev:/dev' - # - '/dev/bus:/dev/bus:ro' - # - '/dev/serial:/dev/serial:ro' - depends_on: - - redis-volatile - - redis-persistent - - rediseen-volatile - - rediseen-persistent - ports: - - '1475:1475' - networks: - - 'default' - - mosquitto: - container_name: mosquitto-arancino - restart: always - image: smartmeio/eclipse-mosquitto:1.0.0 - volumes: - - 'mosquitto_conf:/mosquitto/config' - - 'mosquitto_data:/mosquitto/data' - - 'mosquitto_log:/mosquitto/log' - ports: - - 1883:1883 - - 8883:8883 - - 9001:9001 - networks: - - 'default' - - node-red: - container_name: node-red-arancino - restart: always - image: nodered/node-red:2.2.0-14 - volumes: - - node_red_data:/data - ports: - - 1880:1880 - networks: - - 'default' - -volumes: - node_red_data: - name: node_red_data - mosquitto_conf: - name: mosquitto_conf - mosquitto_data: - name: mosquitto_data - mosquitto_log: - name: mosquitto_log - -networks: - default: - name: arancino-network - driver: 'bridge' \ No newline at end of file diff --git a/docker-compose-alpine.yml b/docker-compose-alpine.yml deleted file mode 100644 index 22cbc1e..0000000 --- a/docker-compose-alpine.yml +++ /dev/null @@ -1,164 +0,0 @@ -############################################################ -# # -# docker-compose.yml for Arancino Ecosystem (Alpine Linux) # -# # -############################################################ - -version: '3.7' -services: - lrod: - container_name: lrod - restart: always - privileged: true - build: - context: . - dockerfile: dockerfiles-alpine/Dockerfile-lrod-alpine.dockerfile - image: smartmeio/lrod:0.5.0 - volumes: - # - '/srv/lrod/etc/iotronic:/etc/iotronic' - - './srv/lrod/var/log/iotronic:/var/log/iotronic' - # - '/srv/lrod/var/lib/iotronic:/var/lib/iotronic' - network_mode: host - - redis-volatile: - container_name: redis-volatile-arancino - restart: always - privileged: true - build: - context: . - dockerfile: dockerfiles-alpine/Dockerfile-redis-volatile-alpine.dockerfile - image: smartmeio/redis-volatile:6.0.16-alpine - command: redis-server /etc/redis/redis-volatile.conf - environment: - - REDIS_REPLICATION_MODE=master - volumes: - - './srv/redis-volatile/redis-data:/var/lib/redis' - ports: - - '6379:6379' - networks: - - 'default' - - redis-persistent: - container_name: redis-persistent-arancino - restart: always - privileged: true - build: - context: . - dockerfile: dockerfiles-alpine/Dockerfile-redis-persistent-alpine.dockerfile - image: smartmeio/redis-persistent:6.0.16-alpine - command: redis-server /etc/redis/redis-persistent.conf - environment: - - REDIS_REPLICATION_MODE=master - volumes: - - './srv/redis-persistent/redis-data:/var/lib/redis' - ports: - - '6380:6380' - networks: - - 'default' - - rediseen-volatile: - container_name: rediseen-volatile-arancino - restart: always - privileged: true - image: smartmeio/rediseen:2.4.0 - environment: - - REDISEEN_REDIS_URI=redis://:@redis-volatile-arancino:6379 - - REDISEEN_DB_EXPOSED=0-5 - - REDISEEN_KEY_PATTERN_EXPOSE_ALL=true - - REDISEEN_HOST=0.0.0.0 - depends_on: - - redis-volatile - ports: - - '8000:8000' - networks: - - 'default' - - rediseen-persistent: - container_name: rediseen-persistent-arancino - restart: always - privileged: true - image: smartmeio/rediseen:2.4.0 - environment: - - REDISEEN_REDIS_URI=redis://:@redis-persistent-arancino:6380 - - REDISEEN_DB_EXPOSED=0-5 - - REDISEEN_KEY_PATTERN_EXPOSE_ALL=true - - REDISEEN_HOST=0.0.0.0 - - REDISEEN_PORT=8001 - depends_on: - - redis-persistent - ports: - - '8001:8001' - networks: - - 'default' - - arancino: - container_name: arancino - restart: always - privileged: true - build: - context: . - dockerfile: dockerfiles-alpine/Dockerfile-arancino-alpine.dockerfile - image: smartmeio/arancino:2.4.0-alpine - command: /bin/bash -c 'gunicorn -c "/etc/arancino/config/gunicorn.cfg.py" arancino.ArancinoStart:app' - environment: - - ARANCINO=/etc/arancino - - ARANCINOCONF=/etc/arancino/config - - ARANCINOLOG=/var/log/arancino - - ARANCINOENV=PROD - - FLASK_ENV=production - volumes: - # - '/srv/arancino/etc/config:/etc/arancino/config' - - './srv/arancino/var/log/arancino:/var/log/arancino' - - '/dev:/dev' - # - '/dev/bus:/dev/bus:ro' - # - '/dev/serial:/dev/serial:ro' - depends_on: - - redis-volatile - - redis-persistent - - rediseen-volatile - - rediseen-persistent - ports: - - '1475:1475' - networks: - - 'default' - - mosquitto: - container_name: mosquitto-arancino - restart: always - image: smartmeio/eclipse-mosquitto:1.0.0 - volumes: - - 'mosquitto_conf:/mosquitto/config' - - 'mosquitto_data:/mosquitto/data' - - 'mosquitto_log:/mosquitto/log' - ports: - - 1883:1883 - - 8883:8883 - - 9001:9001 - networks: - - 'default' - - node-red: - container_name: node-red-arancino - restart: always - image: nodered/node-red:2.2.0-14 - volumes: - - node_red_data:/data - ports: - - 1880:1880 - networks: - - 'default' - -volumes: - node_red_data: - name: node_red_data - mosquitto_conf: - name: mosquitto_conf - mosquitto_data: - name: mosquitto_data - mosquitto_log: - name: mosquitto_log - -networks: - default: - name: arancino-network - driver: 'bridge' \ No newline at end of file diff --git a/docker-compose-build-debian.yml b/docker-compose-build-debian.yml new file mode 100644 index 0000000..2e5b694 --- /dev/null +++ b/docker-compose-build-debian.yml @@ -0,0 +1,123 @@ +############################################## +# # +# docker-compose.yml for Arancino Ecosystem # +# # +############################################## + +version: '3.7' +services: + lrod: + restart: always + privileged: true + build: + context: . + dockerfile: dockerfiles/Dockerfile-lrod.dockerfile + image: smartmeio/lrod:0.5.0 + command: startLR + volumes: + - "lr_conf:/etc/iotronic" + #- "lr_log:/var/log/iotronic" + - "lr_var:/var/lib/iotronic" + - "lr_nginx:/etc/nginx" + - "lr_le:/etc/letsencrypt" + ports: + - "127.0.0.1:${LRPORT}:1474" + networks: + - "arancino_net" + + redis-volatile-arancino: + restart: always + privileged: true + build: + context: . + dockerfile: dockerfiles/Dockerfile-redis-volatile.dockerfile + image: smartmeio/redis-volatile:6.0.16 + command: redis-server /etc/redis/redis-volatile.conf + environment: + - REDIS_REPLICATION_MODE=master + networks: + - "arancino_net" + + redis-persistent-arancino: + restart: always + privileged: true + build: + context: . + dockerfile: dockerfiles/Dockerfile-redis-persistent.dockerfile + image: smartmeio/redis-persistent:6.0.16 + command: redis-server /etc/redis/redis-persistent.conf + environment: + - REDIS_REPLICATION_MODE=master + volumes: + - "redis-data:/var/lib/redis" + networks: + - "arancino_net" + + arancino: + restart: always + privileged: true + build: + context: . + dockerfile: dockerfiles/Dockerfile-arancino.dockerfile + image: smartmeio/arancino:2.4.0 + command: /bin/bash -c 'gunicorn -c "/etc/arancino/config/gunicorn.cfg.py" arancino.ArancinoStart:app' + environment: + - ARANCINO=/etc/arancino + - ARANCINOCONF=/etc/arancino/config + - ARANCINOLOG=/var/log/arancino + - ARANCINOENV=PROD + - FLASK_ENV=production + volumes: + - "arancino_conf:/etc/arancino/config" + - "arancino_log:/var/log/arancino" + - "/dev:/dev" + depends_on: + - redis-volatile-arancino + - redis-persistent-arancino + ports: + - "127.0.0.1:${ARPORT}:1475" + networks: + - "arancino_net" + + mosquitto: + restart: always + image: smartmeio/eclipse-mosquitto:1.0.0 + volumes: + - "mosquitto_conf:/mosquitto/config" + - "mosquitto_data:/mosquitto/data" + - "mosquitto_log:/mosquitto/log" + ports: + - 127.0.0.1:${MPORT}:1883 + - 127.0.0.1:${MSPORT}:8883 + - 127.0.0.1:${MWSPORT}:9001 + networks: + - "arancino_net" + + node-red: + restart: always + image: nodered/node-red:2.2.0-14 + volumes: + - node_red_data:/data + ports: + - 127.0.0.1:${REDPORT}:1880 + networks: + - "arancino_net" + +volumes: + node_red_data: + mosquitto_conf: + mosquitto_data: + mosquitto_log: + redis-data: + lr_conf: + #lr_log: + lr_var: + lr_nginx: + lr_le: + arancino_conf: + arancino_log: + +networks: + arancino_net: + driver: "bridge" + diff --git a/docker-compose-build.yml b/docker-compose-build.yml new file mode 100644 index 0000000..c8437d6 --- /dev/null +++ b/docker-compose-build.yml @@ -0,0 +1,122 @@ +############################################## +# # +# docker-compose.yml for Arancino Ecosystem # +# # +############################################## + +version: '3.7' +services: + lrod: + restart: always + privileged: true + build: + context: . + dockerfile: dockerfiles-alpine/Dockerfile-lrod-alpine.dockerfile + image: smartmeio/lrod:0.5.0-alpine + volumes: + - "lr_conf:/etc/iotronic" + #- "lr_log:/var/log/iotronic" + - "lr_var:/var/lib/iotronic" + - "lr_nginx:/etc/nginx" + - "lr_le:/etc/letsencrypt" + ports: + - "127.0.0.1:${LRPORT}:1474" + networks: + - "arancino_net" + + redis-volatile-arancino: + restart: always + privileged: true + build: + context: . + dockerfile: dockerfiles-alpine/Dockerfile-redis-volatile-alpine.dockerfile + image: smartmeio/redis-volatile:6.0.16-alpine + command: redis-server /etc/redis/redis-volatile.conf + environment: + - REDIS_REPLICATION_MODE=master + networks: + - "arancino_net" + + redis-persistent-arancino: + restart: always + privileged: true + build: + context: . + dockerfile: dockerfiles-alpine/Dockerfile-redis-persistent-alpine.dockerfile + image: smartmeio/redis-persistent:6.0.16-alpine + command: redis-server /etc/redis/redis-persistent.conf + environment: + - REDIS_REPLICATION_MODE=master + volumes: + - "redis-data:/var/lib/redis" + networks: + - "arancino_net" + + arancino: + restart: always + privileged: true + build: + context: . + dockerfile: dockerfiles-alpine/Dockerfile-arancino-alpine.dockerfile + image: smartmeio/arancino:2.4.0-alpine + command: /bin/bash -c 'gunicorn -c "/etc/arancino/config/gunicorn.cfg.py" arancino.ArancinoStart:app' + environment: + - ARANCINO=/etc/arancino + - ARANCINOCONF=/etc/arancino/config + - ARANCINOLOG=/var/log/arancino + - ARANCINOENV=PROD + - FLASK_ENV=production + volumes: + - "arancino_conf:/etc/arancino/config" + - "arancino_log:/var/log/arancino" + - "/dev:/dev" + depends_on: + - redis-volatile-arancino + - redis-persistent-arancino + ports: + - "127.0.0.1:${ARPORT}:1475" + networks: + - "arancino_net" + + mosquitto: + restart: always + image: smartmeio/eclipse-mosquitto:1.0.0 + volumes: + - "mosquitto_conf:/mosquitto/config" + - "mosquitto_data:/mosquitto/data" + - "mosquitto_log:/mosquitto/log" + ports: + - 127.0.0.1:${MPORT}:1883 + - 127.0.0.1:${MSPORT}:8883 + - 127.0.0.1:${MWSPORT}:9001 + networks: + - "arancino_net" + + node-red: + restart: always + image: nodered/node-red:2.2.0-14 + volumes: + - node_red_data:/data + ports: + - 127.0.0.1:${REDPORT}:1880 + networks: + - "arancino_net" + +volumes: + node_red_data: + mosquitto_conf: + mosquitto_data: + mosquitto_log: + redis-data: + lr_conf: + #lr_log: + lr_var: + lr_nginx: + lr_le: + arancino_conf: + arancino_log: + +networks: + arancino_net: + driver: "bridge" + diff --git a/docker-compose-debian.yml b/docker-compose-debian.yml new file mode 100644 index 0000000..79e60f9 --- /dev/null +++ b/docker-compose-debian.yml @@ -0,0 +1,111 @@ +############################################## +# # +# docker-compose.yml for Arancino Ecosystem # +# # +############################################## + +version: '3.7' +services: + lrod: + restart: always + privileged: true + image: smartmeio/lrod:0.5.0 + command: startLR + volumes: + - "lr_conf:/etc/iotronic" + #- "lr_log:/var/log/iotronic" + - "lr_var:/var/lib/iotronic" + - "lr_nginx:/etc/nginx" + - "lr_le:/etc/letsencrypt" + ports: + - "127.0.0.1:${LRPORT}:1474" + networks: + - "arancino_net" + + redis-volatile-arancino: + restart: always + privileged: true + image: smartmeio/redis-volatile:6.0.16 + command: redis-server /etc/redis/redis-volatile.conf + environment: + - REDIS_REPLICATION_MODE=master + networks: + - "arancino_net" + + redis-persistent-arancino: + restart: always + privileged: true + image: smartmeio/redis-persistent:6.0.16 + command: redis-server /etc/redis/redis-persistent.conf + environment: + - REDIS_REPLICATION_MODE=master + volumes: + - "redis-data:/var/lib/redis" + networks: + - "arancino_net" + + arancino: + restart: always + privileged: true + image: smartmeio/arancino:2.4.0 + command: /bin/bash -c 'gunicorn -c "/etc/arancino/config/gunicorn.cfg.py" arancino.ArancinoStart:app' + environment: + - ARANCINO=/etc/arancino + - ARANCINOCONF=/etc/arancino/config + - ARANCINOLOG=/var/log/arancino + - ARANCINOENV=PROD + - FLASK_ENV=production + volumes: + - "arancino_conf:/etc/arancino/config" + - "arancino_log:/var/log/arancino" + - "/dev:/dev" + depends_on: + - redis-volatile-arancino + - redis-persistent-arancino + ports: + - "127.0.0.1:${ARPORT}:1475" + networks: + - "arancino_net" + + mosquitto: + restart: always + image: smartmeio/eclipse-mosquitto:1.0.0 + volumes: + - "mosquitto_conf:/mosquitto/config" + - "mosquitto_data:/mosquitto/data" + - "mosquitto_log:/mosquitto/log" + ports: + - 127.0.0.1:${MPORT}:1883 + - 127.0.0.1:${MSPORT}:8883 + - 127.0.0.1:${MWSPORT}:9001 + networks: + - "arancino_net" + + node-red: + restart: always + image: nodered/node-red:2.2.0-14 + volumes: + - node_red_data:/data + ports: + - 127.0.0.1:${REDPORT}:1880 + networks: + - "arancino_net" + +volumes: + node_red_data: + mosquitto_conf: + mosquitto_data: + mosquitto_log: + redis-data: + lr_conf: + #lr_log: + lr_var: + lr_nginx: + lr_le: + arancino_conf: + arancino_log: + +networks: + arancino_net: + driver: "bridge" + diff --git a/docker-compose-no-build.yml b/docker-compose-no-build.yml deleted file mode 100644 index 340d0b8..0000000 --- a/docker-compose-no-build.yml +++ /dev/null @@ -1,153 +0,0 @@ -############################################## -# # -# docker-compose.yml for Arancino Ecosystem # -# # -############################################## - -version: '3.7' -services: - lrod: - container_name: lrod - restart: always - privileged: true - image: smartmeio/lrod:0.5.0 - command: startLR - volumes: - # - '/srv/lrod/etc/iotronic:/etc/iotronic' - - './srv/lrod/var/log/iotronic:/var/log/iotronic' - # - '/srv/lrod/var/lib/iotronic:/var/lib/iotronic' - network_mode: host - - redis-volatile: - container_name: redis-volatile-arancino - restart: always - privileged: true - image: smartmeio/redis-volatile:6.0.16 - command: redis-server /etc/redis/redis-volatile.conf - environment: - - REDIS_REPLICATION_MODE=master - volumes: - - './srv/redis-volatile/redis-data:/var/lib/redis' - ports: - - '6379:6379' - networks: - - 'default' - - redis-persistent: - container_name: redis-persistent-arancino - restart: always - privileged: true - image: smartmeio/redis-persistent:6.0.16 - command: redis-server /etc/redis/redis-persistent.conf - environment: - - REDIS_REPLICATION_MODE=master - volumes: - - './srv/redis-persistent/redis-data:/var/lib/redis' - ports: - - '6380:6380' - networks: - - 'default' - - rediseen-volatile: - container_name: rediseen-volatile-arancino - restart: always - privileged: true - image: xddeng/rediseen:latest - environment: - - REDISEEN_REDIS_URI=redis://:@redis-volatile-arancino:6379 - - REDISEEN_DB_EXPOSED=0-5 - - REDISEEN_KEY_PATTERN_EXPOSE_ALL=true - - REDISEEN_HOST=0.0.0.0 - depends_on: - - redis-volatile - ports: - - '8000:8000' - networks: - - 'default' - - rediseen-persistent: - container_name: rediseen-persistent-arancino - restart: always - privileged: true - image: xddeng/rediseen:latest - environment: - - REDISEEN_REDIS_URI=redis://:@redis-persistent-arancino:6380 - - REDISEEN_DB_EXPOSED=0-5 - - REDISEEN_KEY_PATTERN_EXPOSE_ALL=true - - REDISEEN_HOST=0.0.0.0 - - REDISEEN_PORT=8001 - depends_on: - - redis-persistent - ports: - - '8001:8001' - networks: - - 'default' - - arancino: - container_name: arancino - restart: always - privileged: true - image: smartmeio/arancino:2.4.0 - command: /bin/bash -c 'gunicorn -c "/etc/arancino/config/gunicorn.cfg.py" arancino.ArancinoStart:app' - environment: - - ARANCINO=/etc/arancino - - ARANCINOCONF=/etc/arancino/config - - ARANCINOLOG=/var/log/arancino - - ARANCINOENV=PROD - - FLASK_ENV=production - volumes: - # - '/srv/arancino/etc/config:/etc/arancino/config' - - './srv/arancino/var/log/arancino:/var/log/arancino' - - '/dev:/dev' - # - '/dev/bus:/dev/bus:ro' - # - '/dev/serial:/dev/serial:ro' - depends_on: - - redis-volatile - - redis-persistent - - rediseen-volatile - - rediseen-persistent - ports: - - '1475:1475' - networks: - - 'default' - - mosquitto: - container_name: mosquitto-arancino - restart: always - image: smartmeio/eclipse-mosquitto:1.0.0 - volumes: - - 'mosquitto_conf:/mosquitto/config' - - 'mosquitto_data:/mosquitto/data' - - 'mosquitto_log:/mosquitto/log' - ports: - - 1883:1883 - - 8883:8883 - - 9001:9001 - networks: - - 'default' - - node-red: - container_name: node-red-arancino - restart: always - image: nodered/node-red:2.2.0-14 - volumes: - - node_red_data:/data - ports: - - 1880:1880 - networks: - - 'default' - -volumes: - node_red_data: - name: node_red_data - mosquitto_conf: - name: mosquitto_conf - mosquitto_data: - name: mosquitto_data - mosquitto_log: - name: mosquitto_log - -networks: - default: - name: arancino-network - driver: 'bridge' \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 8b22eb4..8819951 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,105 +1,52 @@ -############################################## -# # -# docker-compose.yml for Arancino Ecosystem # -# # -############################################## +############################################################ +# # +# docker-compose.yml for Arancino Ecosystem (Alpine Linux) # +# # +############################################################ version: '3.7' services: lrod: - container_name: lrod restart: always privileged: true - build: - context: . - dockerfile: dockerfiles/Dockerfile-lrod.dockerfile - image: smartmeio/lrod:0.5.0 - command: startLR + image: smartmeio/lrod:0.5.0-alpine volumes: - # - '/srv/lrod/etc/iotronic:/etc/iotronic' - - './srv/lrod/var/log/iotronic:/var/log/iotronic' - # - '/srv/lrod/var/lib/iotronic:/var/lib/iotronic' - network_mode: host + - "lr_conf:/etc/iotronic" + #- "lr_log:/var/log/iotronic" + - "lr_var:/var/lib/iotronic" + - "lr_nginx:/etc/nginx" + - "lr_le:/etc/letsencrypt" + ports: + - "127.0.0.1:${LRPORT}:1474" + networks: + - "arancino_net" - redis-volatile: - container_name: redis-volatile-arancino + redis-volatile-arancino: restart: always privileged: true - build: - context: . - dockerfile: dockerfiles/Dockerfile-redis-volatile.dockerfile - image: smartmeio/redis-volatile:6.0.16 + image: smartmeio/redis-volatile:6.0.16-alpine command: redis-server /etc/redis/redis-volatile.conf environment: - REDIS_REPLICATION_MODE=master - volumes: - - './srv/redis-volatile/redis-data:/var/lib/redis' - ports: - - '6379:6379' networks: - - 'default' + - "arancino_net" - redis-persistent: - container_name: redis-persistent-arancino + redis-persistent-arancino: restart: always privileged: true - build: - context: . - dockerfile: dockerfiles/Dockerfile-redis-persistent.dockerfile - image: smartmeio/redis-persistent:6.0.16 + image: smartmeio/redis-persistent:6.0.16-alpine command: redis-server /etc/redis/redis-persistent.conf environment: - REDIS_REPLICATION_MODE=master volumes: - - './srv/redis-persistent/redis-data:/var/lib/redis' - ports: - - '6380:6380' - networks: - - 'default' - - rediseen-volatile: - container_name: rediseen-volatile-arancino - restart: always - privileged: true - image: smartmeio/rediseen:2.4.0 - environment: - - REDISEEN_REDIS_URI=redis://:@redis-volatile-arancino:6379 - - REDISEEN_DB_EXPOSED=0-5 - - REDISEEN_KEY_PATTERN_EXPOSE_ALL=true - - REDISEEN_HOST=0.0.0.0 - depends_on: - - redis-volatile - ports: - - '8000:8000' - networks: - - 'default' - - rediseen-persistent: - container_name: rediseen-persistent-arancino - restart: always - privileged: true - image: smartmeio/rediseen:2.4.0 - environment: - - REDISEEN_REDIS_URI=redis://:@redis-persistent-arancino:6380 - - REDISEEN_DB_EXPOSED=0-5 - - REDISEEN_KEY_PATTERN_EXPOSE_ALL=true - - REDISEEN_HOST=0.0.0.0 - - REDISEEN_PORT=8001 - depends_on: - - redis-persistent - ports: - - '8001:8001' + - "redis-data:/var/lib/redis" networks: - - 'default' + - "arancino_net" arancino: - container_name: arancino restart: always privileged: true - build: - context: . - dockerfile: dockerfiles/Dockerfile-arancino.dockerfile - image: smartmeio/arancino:2.4.0 + image: smartmeio/arancino:2.4.0-alpine command: /bin/bash -c 'gunicorn -c "/etc/arancino/config/gunicorn.cfg.py" arancino.ArancinoStart:app' environment: - ARANCINO=/etc/arancino @@ -108,58 +55,56 @@ services: - ARANCINOENV=PROD - FLASK_ENV=production volumes: - # - '/srv/arancino/etc/config:/etc/arancino/config' - - './srv/arancino/var/log/arancino:/var/log/arancino' - - '/dev:/dev' - # - '/dev/bus:/dev/bus:ro' - # - '/dev/serial:/dev/serial:ro' + - "arancino_conf:/etc/arancino/config" + - "arancino_log:/var/log/arancino" + - "/dev:/dev" depends_on: - - redis-volatile - - redis-persistent - - rediseen-volatile - - rediseen-persistent + - redis-volatile-arancino + - redis-persistent-arancino ports: - - '1475:1475' + - "127.0.0.1:${ARPORT}:1475" networks: - - 'default' + - "arancino_net" mosquitto: - container_name: mosquitto-arancino restart: always image: smartmeio/eclipse-mosquitto:1.0.0 volumes: - - 'mosquitto_conf:/mosquitto/config' - - 'mosquitto_data:/mosquitto/data' - - 'mosquitto_log:/mosquitto/log' + - "mosquitto_conf:/mosquitto/config" + - "mosquitto_data:/mosquitto/data" + - "mosquitto_log:/mosquitto/log" ports: - - 1883:1883 - - 8883:8883 - - 9001:9001 + - 127.0.0.1:${MPORT}:1883 + - 127.0.0.1:${MSPORT}:8883 + - 127.0.0.1:${MWSPORT}:9001 networks: - - 'default' + - "arancino_net" node-red: - container_name: node-red-arancino restart: always image: nodered/node-red:2.2.0-14 volumes: - node_red_data:/data ports: - - 1880:1880 + - 127.0.0.1:${REDPORT}:1880 networks: - - 'default' + - "arancino_net" volumes: node_red_data: - name: node_red_data mosquitto_conf: - name: mosquitto_conf mosquitto_data: - name: mosquitto_data mosquitto_log: - name: mosquitto_log + redis-data: + lr_conf: + #lr_log: + lr_var: + lr_nginx: + lr_le: + arancino_conf: + arancino_log: networks: - default: - name: arancino-network - driver: 'bridge' \ No newline at end of file + arancino_net: + driver: "bridge" + diff --git a/dockerfiles-alpine/Dockerfile-lrod-alpine.dockerfile b/dockerfiles-alpine/Dockerfile-lrod-alpine.dockerfile index fa5c505..067215b 100644 --- a/dockerfiles-alpine/Dockerfile-lrod-alpine.dockerfile +++ b/dockerfiles-alpine/Dockerfile-lrod-alpine.dockerfile @@ -36,6 +36,7 @@ RUN : \ && mkdir -p /etc/nginx/conf.d/ \ && mkdir -p /etc/nginx/sites-available/ \ && mkdir -p /etc/nginx/sites-enabled/ \ + && mkdir -p /var/www/html \ && : COPY ./files/nginx-alpine-default.conf /etc/nginx/nginx.conf @@ -63,8 +64,9 @@ RUN wget -qO- https://bootstrap.pypa.io/pip/get-pip.py | python3 COPY ./files/pip.conf /etc/pip.conf -RUN pip3 install -v --no-cache-dir certbot==0.31 certbot-nginx==0.31 \ - acme==0.31 cryptography==3.4.8 pyOpenSSL==21.0.0 iotronic-lightningrod==0.5.0 +RUN pip3 install -v --no-cache-dir certbot==0.31 certbot-nginx==0.31 autobahn==21.11.1 \ + txaio==21.2.1 acme==0.31 cryptography==3.4.8 pyOpenSSL==21.0.0 httplib2==0.20.2 \ + Flask==2.0.2 Werkzeug==2.0.2 iotronic-lightningrod==0.5.0 COPY ./files/lr_install.py /usr/local/bin/lr_install @@ -73,6 +75,10 @@ RUN chmod +x /usr/local/bin/lr_install && lr_install COPY ./files/startLR-alpine.sh /usr/local/bin/startLR RUN chmod +x /usr/local/bin/startLR +# tweak to check nginx status on alpine linux +RUN PYDIR=$(python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])') \ + && sed -i '71,/running/ s/running/started/' $PYDIR/iotronic_lightningrod/modules/proxies/nginx.py + COPY files/lrod-alpine.service /etc/init.d/lrod RUN chmod +x /etc/init.d/lrod \ && rc-update add lrod diff --git a/dockerfiles-alpine/Dockerfile-redis-persistent-alpine.dockerfile b/dockerfiles-alpine/Dockerfile-redis-persistent-alpine.dockerfile index 418d05c..56bfa1d 100644 --- a/dockerfiles-alpine/Dockerfile-redis-persistent-alpine.dockerfile +++ b/dockerfiles-alpine/Dockerfile-redis-persistent-alpine.dockerfile @@ -1,24 +1,50 @@ -FROM redis:6.0.16-alpine +########################################################### +# Timeseries builder Section # +########################################################### +FROM redis:6.0.16-alpine3.16 as tsbuilder -ARG TS_VERSION="1.4.10" -ARG DOWN_URL="https://packages.smartme.io/repository/arancino-download/redistimeseries/musl" +ARG TS_VERSION="1.6.13" + +RUN echo "cross-build-start-timeseries" + +RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing/" >> /etc/apk/repositories + +RUN apk update \ + && apk add git gcc g++ musl-dev make automake libtool vim nano lcov patch \ + autoconf m4 make file openssl-dev bash libffi-dev yaml-dev python3 python3-dev \ + && ln -s /usr/bin/python3 /usr/bin/python + +COPY ./files/alpine-ts-comp.patch /tmp/ + +RUN git clone https://github.com/RedisTimeSeries/RedisTimeSeries.git /RedisTimeSeries -b v${TS_VERSION} \ + && cd /RedisTimeSeries \ + && patch -p1 < /tmp/alpine-ts-comp.patch \ + && git submodule update --init --recursive \ + && make setup \ + && make -j3 \ + && make pack + +RUN echo "cross-build-end-ts" +################################################################### + +FROM redis:6.0.16-alpine3.16 + +RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing/" >> /etc/apk/repositories RUN mkdir -p /etc/redis && chown redis:redis /etc/redis \ && mkdir -p /etc/redis/cwd && chown redis:redis /etc/redis/cwd \ && mkdir -p /var/lib/redis && chown redis:redis /var/lib/redis \ && mkdir -p /lib/redis/plugins/ +RUN apk update \ + && apk add --no-cache libstdc++ + COPY ./files/redis-persistent.conf /etc/redis COPY ./files/docker-entrypoint-aof-alpine.sh /usr/local/bin/ ENTRYPOINT ["docker-entrypoint-aof-alpine.sh"] -# ADD ./files/redistimeseries.Linux-x86_64-musl.1.6.0.tar.gz /lib/redis/plugins/ - -RUN wget ${DOWN_URL}/redistimeseries.Linux-$(uname -m).${TS_VERSION}-musl.zip -P /tmp \ - && cd /tmp \ - && unzip redistimeseries.Linux-$(uname -m).${TS_VERSION}-musl.zip -d /lib/redis/plugins/ \ - && rm -rf /tmp/* +COPY --from=tsbuilder /RedisTimeSeries/bin/*-release/redistimeseries.so /lib/redis/plugins/ EXPOSE 6380 CMD ["redis-server"] diff --git a/dockerfiles-alpine/Dockerfile-redis-volatile-alpine.dockerfile b/dockerfiles-alpine/Dockerfile-redis-volatile-alpine.dockerfile index 7609ab7..91e8541 100644 --- a/dockerfiles-alpine/Dockerfile-redis-volatile-alpine.dockerfile +++ b/dockerfiles-alpine/Dockerfile-redis-volatile-alpine.dockerfile @@ -1,18 +1,44 @@ -FROM redis:6.0.16-alpine +########################################################### +# Timeseries builder Section # +########################################################### +FROM redis:6.0.16-alpine3.16 as tsbuilder -ARG TS_VERSION="1.4.10" -ARG DOWN_URL="https://packages.smartme.io/repository/arancino-download/redistimeseries/musl" +ARG TS_VERSION="1.6.13" + +RUN echo "cross-build-start-timeseries" + +RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing/" >> /etc/apk/repositories + +RUN apk update \ + && apk add git gcc g++ musl-dev make automake libtool vim nano lcov patch \ + autoconf m4 make file openssl-dev bash libffi-dev yaml-dev python3 python3-dev \ + && ln -s /usr/bin/python3 /usr/bin/python + +COPY ./files/alpine-ts-comp.patch /tmp/ + +RUN git clone https://github.com/RedisTimeSeries/RedisTimeSeries.git /RedisTimeSeries -b v${TS_VERSION} \ + && cd /RedisTimeSeries \ + && patch -p1 < /tmp/alpine-ts-comp.patch \ + && git submodule update --init --recursive \ + && make setup \ + && make -j3 \ + && make pack + +RUN echo "cross-build-end-ts" +################################################################### + +FROM redis:6.0.16-alpine3.16 + +RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing/" >> /etc/apk/repositories RUN mkdir -p /etc/redis && chown redis:redis /etc/redis \ && mkdir -p /etc/redis/cwd && chown redis:redis /etc/redis/cwd \ && mkdir -p /var/lib/redis && chown redis:redis /var/lib/redis \ && mkdir -p /lib/redis/plugins/ -# ADD ./files/redistimeseries.Linux-x86_64-musl.1.6.0.tar.gz /lib/redis/plugins/ +RUN apk update \ + && apk add --no-cache libstdc++ COPY ./files/redis-volatile.conf /etc/redis -RUN wget ${DOWN_URL}/redistimeseries.Linux-$(uname -m).${TS_VERSION}-musl.zip -P /tmp \ - && cd /tmp \ - && unzip redistimeseries.Linux-$(uname -m).${TS_VERSION}-musl.zip -d /lib/redis/plugins/ \ - && rm -rf /tmp/* \ No newline at end of file +COPY --from=tsbuilder /RedisTimeSeries/bin/*-release/redistimeseries.so /lib/redis/plugins/ \ No newline at end of file diff --git a/dockerfiles/Dockerfile-arancino-systemd.dockerfile b/dockerfiles/Dockerfile-arancino-systemd.dockerfile index 3fe0653..9bf142a 100644 --- a/dockerfiles/Dockerfile-arancino-systemd.dockerfile +++ b/dockerfiles/Dockerfile-arancino-systemd.dockerfile @@ -77,7 +77,5 @@ VOLUME $ARANCINO_HOME WORKDIR $ARANCINO_HOME EXPOSE 1475 -EXPOSE 6379 -EXPOSE 6380 CMD ["/lib/systemd/systemd"] \ No newline at end of file diff --git a/dockerfiles/Dockerfile-arancino.dockerfile b/dockerfiles/Dockerfile-arancino.dockerfile index a947f9b..6e867cf 100644 --- a/dockerfiles/Dockerfile-arancino.dockerfile +++ b/dockerfiles/Dockerfile-arancino.dockerfile @@ -76,6 +76,4 @@ VOLUME $ARANCINO_HOME WORKDIR $ARANCINO_HOME -EXPOSE 1475 -EXPOSE 6379 -EXPOSE 6380 \ No newline at end of file +EXPOSE 1475 \ No newline at end of file diff --git a/dockerfiles/Dockerfile-lrod.dockerfile b/dockerfiles/Dockerfile-lrod.dockerfile index d3cbfec..253306e 100644 --- a/dockerfiles/Dockerfile-lrod.dockerfile +++ b/dockerfiles/Dockerfile-lrod.dockerfile @@ -19,7 +19,7 @@ RUN : \ sudo net-tools telnet procps coreutils psmisc \ systemd systemd-sysv bash-completion apt-utils \ dsniff git ntpdate lsof screen libffi-dev libyaml-dev \ - git subversion psutils nginx dialog libssl-dev \ + git subversion psutils nginx dialog libssl-dev \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ && : @@ -39,10 +39,10 @@ RUN if [ $(dpkg --print-architecture) = "amd64" ]; then \ fi \ && wget https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${nodearch}.tar.gz -P /tmp \ && tar xvf /tmp/node-v${NODE_VERSION}-linux-${nodearch}.tar.gz --strip-components=1 -C /usr \ - && npm install -g npm@7 \ - && npm config set loglevel http \ - && npm config set unsafe-perm true \ - && npm install -g --unsafe @mdslab/wstun@1.1.0 && npm cache --force clean \ + && npm install -g npm@7 \ + && npm config set loglevel http \ + && npm config set unsafe-perm true \ + && npm install -g --unsafe @mdslab/wstun@1.1.0 && npm cache --force clean \ && rm -rf /tmp/node-v${NODE_VERSION}-linux-${nodearch}.tar.gz # setting up nginx @@ -77,9 +77,9 @@ COPY ./files/pip.conf /etc/pip.conf # && cat /etc/pip.conf # installing lightning-rod -RUN pip3 install -v --no-cache-dir acme==0.31 certbot==0.31 \ - certbot-nginx==0.31 pyOpenSSL==21.0.0 cryptography==3.4.8 \ - iotronic-lightningrod==0.5.0 \ +RUN pip3 install -v --no-cache-dir acme==0.31 certbot==0.31 autobahn==21.11.1 \ + txaio==21.2.1 certbot-nginx==0.31 pyOpenSSL==21.0.0 cryptography==3.4.8 \ + Flask==2.0.2 Werkzeug==2.0.2 httplib2==0.20.2 iotronic-lightningrod==0.5.0 \ && ln -sf /usr/local/bin/certbot /usr/bin/certbot \ && ln -sf /usr/local/bin/python3 /usr/bin/python3 COPY ./files/lr_install.py /usr/local/bin/lr_install diff --git a/dockerfiles/Dockerfile-redis-persistent.dockerfile b/dockerfiles/Dockerfile-redis-persistent.dockerfile index 6593651..01769f7 100644 --- a/dockerfiles/Dockerfile-redis-persistent.dockerfile +++ b/dockerfiles/Dockerfile-redis-persistent.dockerfile @@ -1,13 +1,41 @@ -FROM redis:6.0.16-buster +########################################################### +# Timeseries builder Section # +########################################################### +FROM redis:6.0.16-buster as tsbuilder + +ARG TS_VERSION="1.6.13" -ARG TS_VERSION="1.6.0" -ARG DOWN_URL="https://packages.smartme.io/repository/arancino-download/redistimeseries/glibc" +RUN echo "cross-build-start-timeseries" RUN : \ && apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - software-properties-common vim wget nano curl bash-completion apt-utils \ - zip unzip tar \ + vim wget nano curl bash-completion git zip unzip tar ca-certificates build-essential \ + libssl-dev libssl-dev autoconf m4 libtool libtool-bin libyaml-dev python-all \ + python-all-dev python3-all python3-all-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ + && : + +RUN : \ + && git clone https://github.com/RedisTimeSeries/RedisTimeSeries.git /RedisTimeSeries -b v${TS_VERSION} \ + && cd /RedisTimeSeries \ + && git submodule update --init --recursive \ + && sed -i /getgcc/d system-setup.py \ + && make setup \ + && make -j3 \ + && make pack \ + && : + +RUN echo "cross-build-end-ts" +################################################################### + +FROM redis:6.0.16-buster + +RUN : \ + && apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + vim wget nano curl bash-completion apt-utils zip unzip tar \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ && : @@ -22,13 +50,7 @@ COPY ./files/redis-persistent.conf /etc/redis COPY ./files/docker-entrypoint-aof.sh /usr/local/bin/ ENTRYPOINT ["docker-entrypoint-aof.sh"] -# ADD ./files/redistimeseries.Linux-x86_64.1.6.0.zip /lib/redis/plugins/ - -RUN wget ${DOWN_URL}/redistimeseries.Linux-$(uname -m).${TS_VERSION}.zip -P /tmp \ - && cd /tmp \ - && unzip redistimeseries.Linux-$(uname -m).${TS_VERSION}.zip -d /lib/redis/plugins/ \ - && rm -rf /tmp/* - +COPY --from=tsbuilder /RedisTimeSeries/bin/*-release/redistimeseries.so /lib/redis/plugins/ EXPOSE 6380 CMD ["redis-server"] \ No newline at end of file diff --git a/dockerfiles/Dockerfile-redis-volatile.dockerfile b/dockerfiles/Dockerfile-redis-volatile.dockerfile index 3de80ee..a87d008 100644 --- a/dockerfiles/Dockerfile-redis-volatile.dockerfile +++ b/dockerfiles/Dockerfile-redis-volatile.dockerfile @@ -1,13 +1,41 @@ -FROM redis:6.0.16-buster +########################################################### +# Timeseries builder Section # +########################################################### +FROM redis:6.0.16-buster as tsbuilder + +ARG TS_VERSION="1.6.13" + +RUN echo "cross-build-start-timeseries" + +RUN : \ + && apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + vim wget nano curl bash-completion git zip unzip tar ca-certificates build-essential \ + libssl-dev libssl-dev autoconf m4 libtool libtool-bin libyaml-dev python-all \ + python-all-dev python3-all python3-all-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ + && : + +RUN : \ + && git clone https://github.com/RedisTimeSeries/RedisTimeSeries.git /RedisTimeSeries -b v${TS_VERSION} \ + && cd /RedisTimeSeries \ + && git submodule update --init --recursive \ + && sed -i /getgcc/d system-setup.py \ + && make setup \ + && make -j3 \ + && make pack \ + && : + +RUN echo "cross-build-end-ts" +################################################################### -ARG TS_VERSION="1.6.0" -ARG DOWN_URL="https://packages.smartme.io/repository/arancino-download/redistimeseries/glibc" +FROM redis:6.0.16-buster RUN : \ && apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - software-properties-common vim wget nano curl bash-completion apt-utils \ - zip unzip tar \ + vim wget nano curl bash-completion apt-utils zip unzip tar \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ && : @@ -17,11 +45,6 @@ RUN mkdir -p /etc/redis && chown redis:redis /etc/redis \ && mkdir -p /var/lib/redis && chown redis:redis /var/lib/redis \ && mkdir -p /lib/redis/plugins/ -# ADD ./files/redistimeseries.Linux-x86_64.1.6.0.zip /lib/redis/plugins/ - -RUN wget ${DOWN_URL}/redistimeseries.Linux-$(uname -m).${TS_VERSION}.zip -P /tmp \ - && cd /tmp \ - && unzip redistimeseries.Linux-$(uname -m).${TS_VERSION}.zip -d /lib/redis/plugins/ \ - && rm -rf /tmp/* +COPY --from=tsbuilder /RedisTimeSeries/bin/*-release/redistimeseries.so /lib/redis/plugins/ COPY ./files/redis-volatile.conf /etc/redis \ No newline at end of file diff --git a/env_template b/env_template new file mode 100644 index 0000000..9a3a2ed --- /dev/null +++ b/env_template @@ -0,0 +1,6 @@ +LRPORT=1474 +ARPORT=1475 +MPORT=1883 +MSPORT=8883 +MWSPORT=9001 +REDPORT=1880 \ No newline at end of file diff --git a/files/alpine-ts-comp.patch b/files/alpine-ts-comp.patch new file mode 100644 index 0000000..7161e57 --- /dev/null +++ b/files/alpine-ts-comp.patch @@ -0,0 +1,25 @@ +diff --git a/sbin/getver b/sbin/getver +index 6feafc0..946fbb0 100755 +--- a/sbin/getver ++++ b/sbin/getver +@@ -2,7 +2,8 @@ + + HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" + +-getver_c=$(mktemp "${TMPDIR:-/tmp}/getver-XXXXXXX.c") ++# getver_c=$(mktemp "${TMPDIR:-/tmp}/getver-XXXXXXX.c") ++getver_c=/root/getver_source.c + if [[ $NUMERIC != 1 ]]; then + cat <<- EOF > $getver_c + #include +@@ -26,7 +27,8 @@ else + } + EOF + fi +-prog=$(mktemp "${TMPDIR:-/tmp}/getver.XXXXXXX") ++# prog=$(mktemp "${TMPDIR:-/tmp}/getver.XXXXXXX") ++prog=/root/getver_bin + gcc -I$HERE/.. -o $prog $getver_c + ver=`$prog` + rm -f $prog $getver_c + diff --git a/files/arancino.cfg b/files/arancino.cfg index 42ae0c9..8d3a2eb 100644 --- a/files/arancino.cfg +++ b/files/arancino.cfg @@ -80,7 +80,7 @@ datastore_tag_db = 2 firmware_path = /tmp/arancino/firmware # allowed file extensions for firmware -firmware_file_types = ["bin", "hex", "uf2"] +firmware_file_types = ["bin", "hex", "uf2", "zip"] # reset port on connection reset_on_connect = True diff --git a/files/arancino.dev.cfg b/files/arancino.dev.cfg index 530f1ab..f3edb69 100644 --- a/files/arancino.dev.cfg +++ b/files/arancino.dev.cfg @@ -80,7 +80,7 @@ datastore_tag_db = 2 firmware_path = /tmp/arancino/firmware # allowed file extensions for firmware -firmware_file_types = ["bin", "hex", "uf2"] +firmware_file_types = ["bin", "hex", "uf2", "zip"] # reset port on connection reset_on_connect = True diff --git a/files/run-arancino-adafruit-nrfutil.sh b/files/run-arancino-adafruit-nrfutil.sh index 8dc5050..8ff9330 100644 --- a/files/run-arancino-adafruit-nrfutil.sh +++ b/files/run-arancino-adafruit-nrfutil.sh @@ -14,6 +14,10 @@ elif [[ "${2##*.}" = "zip" ]]; then mv $2 /tmp/sketch.zip fi +# LOCALES +export LC_ALL=C.UTF-8 +export LANG=C.UTF-8 + # echo out > /sys/class/gpio/gpio25/direction # echo 1 > /sys/class/gpio/gpio25/value @@ -25,13 +29,13 @@ sleep 3 port=${1} -# bossac actual upload +# nRF52 actual upload echo "upload port is $1" adafruit-nrfutil --verbose dfu serial -pkg "/tmp/sketch.zip" -p ${port} -b 115200 --singlebank rc=$? -rm /tmp/sketch.bin +rm /tmp/sketch.zip # echo in > /sys/class/gpio/gpio25/direction diff --git a/files/run-arancino-arduinoSTM32load.sh b/files/run-arancino-arduinoSTM32load.sh index b23fadf..dae114d 100644 --- a/files/run-arancino-arduinoSTM32load.sh +++ b/files/run-arancino-arduinoSTM32load.sh @@ -23,7 +23,7 @@ sleep 3 port=${1} -# bossac actual upload +# STM32 actual upload echo "upload port is $1" arduinoSTM32load -dfu /usr/bin/ -bin "/tmp/sketch.bin" -port=${port} -v diff --git a/files/startLR-alpine.sh b/files/startLR-alpine.sh index e759736..71f29ef 100644 --- a/files/startLR-alpine.sh +++ b/files/startLR-alpine.sh @@ -14,6 +14,7 @@ fi # Start the first process mkdir -p /run/nginx +mkdir -p /var/www/html # /usr/sbin/nginx rc-update add nginx service nginx restart