├── .dockerignore ├── .github ├── release-drafter-config.yml └── workflows │ └── release-drafter.yml ├── .gitignore ├── .gitmodules ├── LICENSE ├── Makefile ├── README.md ├── build └── snap │ ├── VERSION │ ├── local │ ├── assets │ │ └── 1_Redis-labs-logoRGB.png │ └── runtime-helpers │ │ └── bin │ │ └── push-config.sh │ └── snapcraft.yaml ├── docker-compose.debug.yml ├── docker-compose.yml ├── edge ├── Dockerfile ├── Dockerfile.arm ├── Dockerfile.jetson └── Makefile ├── pylibs ├── Dockerfile ├── Dockerfile.arm ├── Dockerfile.jetson ├── Makefile └── system-setup.py ├── redisedge.conf ├── versions └── vision ├── Dockerfile ├── Dockerfile.arm ├── Dockerfile.jetson ├── Makefile └── system-setup.py /.dockerignore: -------------------------------------------------------------------------------- 1 | Dockerfile* 2 | docker-compose* 3 | .dockerignore 4 | .git 5 | .gitignore 6 | README.md 7 | LICENSE 8 | /bin/ 9 | /[0-9]*/ 10 | -------------------------------------------------------------------------------- /.github/release-drafter-config.yml: -------------------------------------------------------------------------------- 1 | name-template: 'Version $NEXT_PATCH_VERSION' 2 | tag-template: 'v$NEXT_PATCH_VERSION' 3 | categories: 4 | - title: 'Features' 5 | labels: 6 | - 'feature' 7 | - 'enhancement' 8 | - title: 'Bug Fixes' 9 | labels: 10 | - 'fix' 11 | - 'bugfix' 12 | - 'bug' 13 | - title: 'Maintenance' 14 | label: 'chore' 15 | change-template: '- $TITLE (#$NUMBER)' 16 | exclude-labels: 17 | - 'skip-changelog' 18 | template: | 19 | ## Changes 20 | 21 | $CHANGES 22 | -------------------------------------------------------------------------------- /.github/workflows/release-drafter.yml: -------------------------------------------------------------------------------- 1 | name: Release Drafter 2 | 3 | on: 4 | push: 5 | # branches to consider in the event; optional, defaults to all 6 | branches: 7 | - master 8 | 9 | jobs: 10 | update_release_draft: 11 | runs-on: ubuntu-latest 12 | steps: 13 | # Drafts your next Release notes as Pull Requests are merged into "master" 14 | - uses: release-drafter/release-drafter@v5 15 | with: 16 | # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml 17 | config-name: release-drafter-config.yml 18 | env: 19 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | /[0-9]*/ 3 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "deps/readies"] 2 | path = deps/readies 3 | url = https://github.com/RedisLabsModules/readies.git 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | REDIS SOURCE AVAILABLE LICENSE AGREEMENT 2 | 3 | Version 1, February 21, 2019 4 | 5 | This Agreement sets forth the terms on which the Licensor makes available the Software. BY INSTALLING, DOWNLOADING, ACCESSING, USING OR DISTRIBUTING ANY OF THE SOFTWARE, YOU AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE TO SUCH TERMS AND CONDITIONS, YOU MUST NOT USE THE SOFTWARE. If you are receiving the Software on behalf of a legal entity, you represent and warrant that you have the actual authority to agree to the terms and conditions of this agreement on behalf of such entity. 6 | 7 | 8 | 0. DEFINITIONS 9 | 10 | The terms below have the meanings set forth below for purposes of this Agreement: 11 | 12 | Agreement: this Redis Source Available License Agreement. 13 | 14 | Database Product: any of the following products or services: (a) database; (b) caching engine; (c) stream processing engine; (d) search engine; (e) indexing engine; (f) machine learning or deep learning or artificial intelligence serving engine; 15 | (g) a product or service exposing the Redis API; (h) a product or service exposing the Redis Modules API; or 16 | (i) a product or service exposing the Software API. 17 | 18 | License: the Redis Source Available License described in Section 1. 19 | 20 | Licensor: Redis Labs Ltd. 21 | 22 | Modification: a modification of the Software made by You under the License, Section 1.1(c). 23 | 24 | Redis: the open source Redis software as described in redis.io. 25 | 26 | Software: certain software components designed to work with Redis and provided to you under this Agreement. 27 | 28 | You: the recipient of this Software, an individual, or the entity on whose behalf you are receiving the Software. 29 | 30 | Your Application: an application developed by or for You, where such application is not a Database Product. 31 | 32 | 1. LICENSE GRANT AND CONDITIONS 33 | 34 | 1.1 Subject to the terms and conditions of this Section 1, Licensor hereby grants to You a non-exclusive, royalty-free, worldwide, non-transferable license during the term of this Agreement to: 35 | (a) distribute or make available the Software or your Modifications under the terms of this Agreement, only as part of Your Application, so long as you include the following notice on any copy you distribute: "This software is subject to the terms of the Redis Source Available License Agreement". 36 | (b) use the Software, or your Modifications, only as part of Your Application, but not in connection with any Database Product that is distributed or otherwise made available by any third party. 37 | (c) modify the Software, provided that Modifications remain subject to the terms of this License. 38 | (d) reproduce the Software as necessary for the above. 39 | 40 | 1.2. Sublicensing. You may sublicense the right to use the Software fully embedded in Your Application as distributed by you in accordance with Section 1.1(a), pursuant to a written license that disclaims all warranties and liabilities on behalf of Licensor. 41 | 42 | 1.3. Notices. On all copies of the Software that you make, you must retain all copyright or other proprietary notices. 43 | 44 | 2. TERM AND TERMINATION. This Agreement will continue unless and until earlier terminated as set forth herein. If You breach any of its conditions or obligations under this Agreement, this Agreement will terminate automatically and the licenses granted herein will terminate automatically. 45 | 46 | 3. INTELLECTUAL PROPERTY. As between the parties, Licensor retains all right, title, and interest in the Software, and to Redis or other Licensor trademarks or service marks, and all intellectual property rights therein. Licensor hereby reserves all rights not expressly granted to You in this Agreement. 47 | 48 | 4. DISCLAIMER. TO THE EXTENT ALLOWABLE UNDER LAW, LICENSOR HEREBY DISCLAIMS ANY AND ALL WARRANTIES AND CONDITIONS, EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, AND SPECIFICALLY DISCLAIMS ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE SOFTWARE. Licensor has no obligation to support the Software. 49 | 50 | 5. LIMITATION OF LIABILITY. TO THE EXTENT ALLOWABLE UNDER LAW, LICENSOR WILL NOT BE LIABLE FOR ANY DAMAGES OF ANY KIND, INCLUDING BUT NOT LIMITED TO, LOST PROFITS OR ANY CONSEQUENTIAL, SPECIAL, INCIDENTAL, INDIRECT, OR DIRECT DAMAGES, ARISING OUT OF OR RELATING TO THIS AGREEMENT. 51 | 52 | 6. GENERAL. You are not authorized to assign Your rights under this Agreement to any third party. Licensor may freely assign its rights under this Agreement to any third party. This Agreement is the entire agreement between the parties on the subject matter hereof. No amendment or modification hereof will be valid or binding upon the parties unless made in writing and signed by the duly authorized representatives of both parties. In the event that any provision, including without limitation any condition, of this Agreement is held to be unenforceable, this Agreement and all licenses and rights granted hereunder will immediately terminate. Failure by Licensor to exercise any right hereunder will not be construed as a waiver of any subsequent breach of that right or as a waiver of any other right. This Agreement will be governed by and interpreted in accordance with the laws of the state of California, without reference to its conflict of laws principles. If You are located within the United States, all disputes arising out of this Agreement are subject to the exclusive jurisdiction of courts located in Santa Clara County, California. USA. If You are located outside of the United States, any dispute, controversy or claim arising out of or relating to this Agreement will be referred to and finally determined by arbitration in accordance with the JAMS before a single arbitrator in Santa Clara County, California. Judgment upon the award rendered by the arbitrator may be entered in any court having jurisdiction thereof. 53 | 54 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | 2 | .NOTPARALLEL: 3 | 4 | MAKEFLAGS += --no-builtin-rules --no-print-directory 5 | 6 | define HELP 7 | RedisEdge build operations 8 | 9 | make edge # build RedisEdge (AI, Gears, TimeSereis) 10 | JETSON=1 # build for 11 | make vision # build RedisEdge with ML Python libraries 12 | make pylibs # Build CPython with ML Python libraries 13 | 14 | make build # build RedisEdge and RedisEdgeVision 15 | make publish # Push Docker images for RedisEdge and RedisEdgeVision 16 | 17 | endef 18 | 19 | #---------------------------------------------------------------------------------------------- 20 | 21 | include versions 22 | 23 | ifeq ($(VERSION),) 24 | VERSION:=$(patsubst v%,%,$(shell git describe --tags `git rev-list --tags --max-count=1`)) 25 | endif 26 | ifeq ($(VERSION),) 27 | $(error Cannot determine version. Aborting.) 28 | endif 29 | 30 | all: build 31 | 32 | edge: 33 | @echo Building RedisEdge v$(VERSION) ... 34 | @$(MAKE) -C edge 35 | 36 | vision: 37 | @echo Building RedisEdgeVision v$(VERSION) ... 38 | @$(MAKE) -C vision 39 | 40 | pylibs: 41 | @echo Building RedisEdge Python Libraries v$(VERSION) ... 42 | @$(MAKE) -C pylibs 43 | 44 | build: 45 | @$(MAKE) -C edge build 46 | @$(MAKE) -C pylibs build 47 | @$(MAKE) -C vision build 48 | 49 | publish: 50 | @$(MAKE) -C edge publish PUSH_GENERAL=1 51 | @$(MAKE) -C pylibs publish PUSH_GENERAL=1 52 | @$(MAKE) -C vision publish PUSH_GENERAL=1 53 | 54 | .PHONY: all edge vision pylibs build publish help 55 | 56 | #---------------------------------------------------------------------------------------------- 57 | 58 | ifneq ($(HELP),) 59 | ifneq ($(filter help,$(MAKECMDGOALS)),) 60 | HELPFILE:=$(shell mktemp /tmp/make.help.XXXX) 61 | endif 62 | endif 63 | 64 | help: 65 | $(file >$(HELPFILE),$(HELP)) 66 | @echo 67 | @cat $(HELPFILE) 68 | @echo 69 | @-rm -f $(HELPFILE) 70 | 71 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![CircleCI](https://circleci.com/gh/RedisLabs/RedisEdge/tree/master.svg?style=svg)](https://circleci.com/gh/RedisLabs/RedisEdge/tree/master) 2 | [![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/redislabs/redisedge.svg)](https://hub.docker.com/r/redislabs/redisedge/builds/) 3 | 4 | # redisedge - a Docker image with select Redis Labs modules for the Edge 5 | 6 | This container image bundles together [Redis](https://redis.io) with Redis modules from [Redis Labs](https://redislabs.com) for Edge computing. 7 | 8 | # Quickstart 9 | 10 | ```text 11 | $ $ docker run -it -p 6379:6379 redisedge 12 | 1:C 22 May 2019 21:03:43.669 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 13 | 1:C 22 May 2019 21:03:43.669 # Redis version=5.0.5, bits=64, commit=00000000, modified=0, pid=1, just started 14 | 1:C 22 May 2019 21:03:43.669 # Configuration loaded 15 | ... 16 | 1:M 22 May 2019 21:03:43.789 * Module 'ai' loaded from /usr/lib/redis/modules/redisai.so 17 | loaded default MAX_SAMPLE_PER_CHUNK policy: 360 18 | 1:M 22 May 2019 21:03:43.789 * Module 'timeseries' loaded from /usr/lib/redis/modules/redistimeseries.so 19 | 1:M 22 May 2019 21:03:43.791 * RedisGears version 0.3.1, git_sha=be5c5fcdf2abaabe5ff62155d9c38e0ecaa97575 20 | 1:M 22 May 2019 21:03:43.791 * PythonHomeDir:/opt/redislabs/lib/modules/python3 21 | 1:M 22 May 2019 21:03:43.791 * MaxExecutions:1000 22 | 1:M 22 May 2019 21:03:43.791 * ProfileExecutions:0 23 | 1:M 22 May 2019 21:03:43.791 * PythonAttemptTraceback:1 24 | 1:M 22 May 2019 21:03:43.791 * RedisAI api loaded successfully. 25 | could not initialize RediSearch_CheckApiVersionCompatibility 26 | 1:M 22 May 2019 21:03:43.791 # could not initialize RediSearch api, running without Search support. 27 | 1:M 22 May 2019 21:03:43.804 * Initializing Python environment with: exec(open('/opt/redislabs/lib/modules/python3/.venv/bin/activate_this.py').read(), {'__file__': '/opt/redislabs/lib/modules/python3/.venv/bin/activate_this.py'}) 28 | 1:M 22 May 2019 21:03:43.840 * Module 'rg' loaded from /opt/redislabs/lib/modules/redisgears.so 29 | 1:M 22 May 2019 21:03:43.840 * Ready to accept connections 30 | ``` 31 | 32 | ## Modules included in the container 33 | 34 | * [RedisTimeSeries](https://oss.redislabs.com/redistimeseries/): a timeseries database 35 | * [RedisAI](https://oss.redislabs.com/redisai/): a tensor and deep learning graphs server 36 | * [RedisGears](https://oss.redislabs.com/redisgears/): a dynamic execution framework 37 | 38 | ## Configuring the Redis server 39 | 40 | This image is based on the [official image of Redis from Docker](https://hub.docker.com/_/redis/). By default, the container starts with Redis' default configuration and all included modules loaded. 41 | 42 | You can, of course, override the defaults. This can be done either by providing additional command line arguments to the `docker` command, or by providing your own [Redis configuration file](http://download.redis.io/redis-stable/redis.conf). 43 | 44 | ### Running the container with command line arguments 45 | 46 | You can provide Redis with configuration directives directly from the `docker` command. For example, the following will start the container, mount the host's `/home/user/data` volume to the container's `/data`, load the RedisAI module, and configure Redis' working directory to `/data` so that the data will actually be persisted there. 47 | 48 | ```text 49 | $ docker run \ 50 | -p 6379:6379 \ 51 | -v /home/user/data:/data \ 52 | redislabs/redisedge \ 53 | --loadmodule /usr/lib/redis/modules/redisai.so \ 54 | --dir /data 55 | ``` 56 | 57 | ### Running the container with a custom configuration file 58 | 59 | This image uses a custom configuration file (located at `/etc/redisedge.conf`. You can use that as a starting point for putting together your own and store it somewhere like `/home/user/myredisedge.conf`. You can then load the container with the custom configuration file likeso: 60 | 61 | ```text 62 | $ docker run \ 63 | -p 6379:6379 \ 64 | -v /home/user/data:/data \ 65 | -v /home/user/myredisedge.conf:/usr/local/etc/redisedge.conf \ 66 | redislabs/redisedge \ 67 | /usr/local/etc/redisedge.conf 68 | ``` 69 | 70 | ## License 71 | 72 | This Docker image is licensed under the [Redis Source Available License](https://github.com/RedisLabsModules/licenses/). 73 | 74 | -------------------------------------------------------------------------------- /build/snap/VERSION: -------------------------------------------------------------------------------- 1 | 1.0.0 2 | -------------------------------------------------------------------------------- /build/snap/local/assets/1_Redis-labs-logoRGB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedisLabsModules/RedisEdge/a48422aac348212d3cb9ec2de859365338d29a88/build/snap/local/assets/1_Redis-labs-logoRGB.png -------------------------------------------------------------------------------- /build/snap/local/runtime-helpers/bin/push-config.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # push the configuration files into consul 4 | "$SNAP/bin/config-seed" \ 5 | --cmd "$SNAP_DATA/config" \ 6 | -confdir "$SNAP_DATA/config/config-seed/res" \ 7 | --props "$SNAP_DATA/config/config-seed/res/properties" \ 8 | -overwrite 9 | 10 | # if no arguments were provided, then restart all services that are currently 11 | # running 12 | if [ $# -eq 0 ]; then 13 | # restart all active edgex services to ensure that they pick up their new 14 | # configuration from consul 15 | # for now, limit outselves to the core-*, export-*, support-*, device-*, 16 | # sys-mgmt-agent, and security-service helper services 17 | # this means if a user changes i.e. kong configuration they will need to 18 | # restart kong-daemon manually 19 | # TODO: maybe implement some kind of file hashing to determine which services 20 | # had their configs changed and only restart changed services? 21 | for svc in $(snapctl services | grep "core-*\|export-*\|support-*\|sys-mgmt-agent\|device-*\|vault-worker\|edgexproxy" | grep -v inactive | grep active | awk '{print $1}'); do 22 | snapctl restart "$svc" 23 | done 24 | fi 25 | 26 | # otherwise restart the args provided, assuming they are all names of 27 | # services in the snap 28 | set +e 29 | for svc in "$@"; do 30 | # check if it's a known service - if not fail 31 | SNAP_NAME_SVC="$SNAP_NAME.$svc" 32 | if ! snapctl services | grep -q "$SNAP_NAME_SVC" ; then 33 | echo "unknown service \"$svc\"" 34 | exit 1 35 | fi 36 | # check if it's running - if so restart 37 | if snapctl services | grep "$SNAP_NAME_SVC" | grep -q -v inactive; then 38 | snapctl restart "$SNAP_NAME_SVC" 39 | fi 40 | done 41 | -------------------------------------------------------------------------------- /build/snap/snapcraft.yaml: -------------------------------------------------------------------------------- 1 | name: redisedge 2 | base: core18 3 | adopt-info: version 4 | summary: The Edge Computing Data Service for the IoT Edge 5 | description: | 6 | RedisEdge from Redis Labs is a purpose-built, multi-model database for the demanding conditions at 7 | the Internet of Things (IoT) edge. It can ingest writes at speed with <1ms latency and 8 | a very small footprint (<5MB), so it easily resides in constrained compute environments. It can run 9 | on a variety of edge devices and sensors ranging from ARM32 to x64-based hardware. RedisEdge bundles 10 | open source Redis (version 5 with Redis Streams) with the RedisAI and RedisTimeSeries modules, along 11 | with RedisGears for inter-module communication. 12 | icon: build/snap/local/assets/1_Redis-labs-logoRGB.png 13 | 14 | epoch: 0 15 | 16 | # TODO: add armhf here when that's supported 17 | architectures: 18 | - build-on: amd64 19 | 20 | # for start-timeout, we need snapd 2.38 21 | # we need command-chain for the hooks too 22 | assumes: [snapd2.38, command-chain] 23 | 24 | # Ideally snapcraft would generate this command-chain spec for the hooks 25 | # automatically, but that doesn't currently work, see 26 | # https://bugs.launchpad.net/snapd/+bug/1824255 27 | # In the meantime, make sure that the snapcraft-runner gets generated by 28 | # the apps by specifying the full adapter in at least one of the apps, and 29 | # manually craft the command-chain for the configure hook here to passthrough 30 | # to the snap.yaml 31 | # All of this is necessary so we can use jq and other tools from inside the 32 | # snap in the configure and install hooks 33 | passthrough: 34 | hooks: 35 | configure: 36 | command-chain: 37 | - build/snap/command-chain/snapcraft-runner 38 | install: 39 | command-chain: 40 | - build/snap/command-chain/snapcraft-runner 41 | 42 | grade: stable 43 | confinement: strict 44 | 45 | apps: 46 | redis: 47 | adapter: full 48 | command: bin/redis-server --loadmodule /opt/redislabs/lib/modules/redistimeseries.so --loadmodule /opt/redislabs/lib/modules/redisgears.so $SNAP_DATA/redis/redis.conf 49 | daemon: simple 50 | plugs: [network, network-bind] 51 | 52 | # helper commands the snap exposes 53 | redis-cli: 54 | adapter: full 55 | command: bin/redis-cli 56 | plugs: [home, removable-media, network] 57 | curl: 58 | adapter: full 59 | command: usr/bin/curl 60 | plugs: [network] 61 | jq: 62 | adapter: full 63 | command: usr/bin/jq 64 | plugs: [home, removable-media] 65 | 66 | parts: 67 | version: 68 | plugin: nil 69 | source: . 70 | override-pull: | 71 | snapcraftctl set-version $(cat $SNAPCRAFT_PROJECT_DIR/build/snap/VERSION)-$(date +%Y%m%d)+$(git rev-parse --short HEAD) 72 | 73 | curl: 74 | plugin: nil 75 | # the default source for a part that doesn't specify one is ".", which 76 | # then means snapcraft will scan the full git directory here and determine 77 | # that if anything changed, i.e. the config-common parts with 78 | # actual scripts, etc. this part also gets marked out of date too and needs 79 | # rebuilding, even though this part really only depends on a stage-package 80 | # to resolve this we can just specify the source of something that changes 81 | # infrequently and will minimize unnecessary part re-building by snapcraft 82 | source: build/snap/local/build-helpers 83 | stage-packages: 84 | - curl 85 | 86 | jq: 87 | plugin: nil 88 | source: build/snap/local/build-helpers 89 | stage-packages: 90 | - jq 91 | 92 | config-common: 93 | plugin: dump 94 | source: build/snap/local/runtime-helpers 95 | 96 | redis: 97 | source: https://github.com/antirez/redis.git 98 | source-tag: "5.0.4" 99 | source-depth: 1 100 | plugin: make 101 | make-install-var: PREFIX 102 | build-packages: 103 | - build-essential 104 | override-build: | 105 | snapcraftctl build 106 | # process the config file to specify the working directory for redis 107 | # as $SNAP_DATA/redis 108 | cd $SNAPCRAFT_PART_SRC 109 | mkdir -p $SNAPCRAFT_PART_INSTALL/config/redis 110 | sed -e s@'dir ./'@'dir \$SNAP_DATA/redis'@ \ 111 | redis.conf > $SNAPCRAFT_PART_INSTALL/config/redis/redis.conf 112 | 113 | redistimeseries: 114 | source: https://github.com/RedisTimeSeries/RedisTimeSeries.git 115 | source-tag: v1.0.3 116 | source-depth: 1 117 | plugin: nil 118 | override-build: | 119 | cd $SNAPCRAFT_PART_SRC 120 | ./deps/readies/bin/getpy2 121 | ./system-setup.py 122 | make fetch 123 | make build 124 | install -DT "bin/linux-x64-release/redistimeseries.so" \ 125 | "$SNAPCRAFT_PART_INSTALL/opt/redislabs/lib/modules/redistimeseries.so" 126 | 127 | redisgears: 128 | source: https://github.com/RedisGears/RedisGears.git 129 | source-tag: v0.4.0 130 | source-depth: 1 131 | plugin: nil 132 | override-build: | 133 | cd $SNAPCRAFT_PART_SRC 134 | ./deps/readies/bin/getpy2 135 | ./system-setup.py 136 | make fetch 137 | make PATH=$PATH:/root/parts/redis/install/bin all 138 | install -DT "bin/linux-x64-release/redisgears.so" \ 139 | "$SNAPCRAFT_PART_INSTALL/opt/redislabs/lib/modules/redisgears.so" 140 | tar xzf ./artifacts/release/redisgears-dependencies.*.tgz -C $SNAPCRAFT_PART_INSTALL 141 | 142 | redisai: 143 | source: https://github.com/RedisAI/RedisAI.git 144 | source-tag: v0.3.2 145 | source-depth: 1 146 | plugin: nil 147 | build-attributes: [keep-execstack] 148 | override-build: | 149 | cd $SNAPCRAFT_PART_SRC 150 | ./opt/readies/bin/getpy 151 | ./opt/system-setup.py 152 | ./get_deps.sh cpu 153 | make -C opt build 154 | cd bin/linux-x64-cpu/install && \ 155 | find . -type f -exec install -DT {} /root/parts/redisai/install/opt/redislabs/lib/modules/{} \; 156 | stage-packages: 157 | - libgomp1 158 | 159 | -------------------------------------------------------------------------------- /docker-compose.debug.yml: -------------------------------------------------------------------------------- 1 | version: '2.1' 2 | 3 | services: 4 | redisedge: 5 | image: redisedge 6 | build: 7 | context: . 8 | dockerfile: Dockerfile 9 | ports: 10 | - 6379:6379 11 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2.1' 2 | 3 | services: 4 | redisedge: 5 | image: redisedge 6 | build: . 7 | ports: 8 | - 6379:6379 9 | -------------------------------------------------------------------------------- /edge/Dockerfile: -------------------------------------------------------------------------------- 1 | # BUILD redisfab/redisedge:${VERSION}-cpu-${ARCH}-${OSNICK} 2 | 3 | ARG VERSION=0.4.0 4 | 5 | # OSNICK=stretch|bionic|buster 6 | ARG OSNICK=bionic 7 | 8 | # ARCH=x64|arm64v8|arm32v7 9 | ARG ARCH=x64 10 | 11 | ARG REDISAI_VERSION=1.0.2 12 | ARG REDISTIMESERIES_VERSION=1.4.6 13 | ARG REDISGEARS_VERSION=1.0.2 14 | ARG REDIS_VER=6.2.1 15 | ARG DEVICE=cpu 16 | 17 | ARG DOCKER_ORG=redisfab 18 | 19 | # done to specifically allow for ease of optional override with --build-arg 20 | ARG REDISAI_DOCKERDEP=${REDISAI_VERSION}-${DEVICE}-${ARCH}-${OSNICK} 21 | ARG REDISTIMESERIES_DOCKERDEP=${REDISTIMESERIES_VERSION}-${ARCH}-${OSNICK} 22 | ARG REDISGEARS_DOCKERDEP=${REDISGEARS_VERSION}-${ARCH}-${OSNICK} 23 | ARG REDIS_DOCKERDEP=${REDIS_VER}-${ARCH}-${OSNICK} 24 | 25 | #---------------------------------------------------------------------------------------------- 26 | FROM ${DOCKER_ORG}/redisai:${REDISAI_DOCKERDEP} as ai 27 | FROM ${DOCKER_ORG}/redistimeseries:${REDISTIMESERIES_DOCKERDEP} as timeseries 28 | FROM ${DOCKER_ORG}/redisgears:${REDISGEARS_DOCKERDEP} as gears 29 | 30 | #---------------------------------------------------------------------------------------------- 31 | FROM redisfab/redis:${REDIS_DOCKERDEP} 32 | 33 | ARG OSNICK 34 | ARG ARCH 35 | ARG VERSION 36 | ARG REDISAI_VERSION 37 | ARG REDISTIMESERIES_VERSION 38 | ARG REDISGEARS_VERSION 39 | ARG REDIS_VER 40 | ARG REDISTIMESERIES_DOCKERDEP 41 | ARG REDISGEARS_DOCKERDEP 42 | ARG REDIS_DOCKERDEP 43 | ARG REDISAI_DOCKERDEP 44 | 45 | RUN echo "Building redisedge-${OSNICK}:${VERSION}-${DEVICE}-${ARCH} with:" ;\ 46 | echo " RedisAI=${REDISAI_DOCKERDEP}-${DEVICE}" ;\ 47 | echo " RedisTimeSeries=${REDISTIMESERIES_DOCKERDEP}" ;\ 48 | echo " RedisGears=${REDISGEARS_DOCKERDEP}" ;\ 49 | echo " Redis=${REDIS_DOCKERDEP}" 50 | 51 | RUN set -e; if [ ! -z $(command -v apt-get) ]; then apt-get -qq update; apt-get -q install -y libgomp1 git; fi 52 | RUN set -e; if [ ! -z $(command -v yum) ]; then yum install -y libgomp git; fi 53 | 54 | ENV LIBDIR /usr/lib/redis/modules 55 | ENV LD_LIBRARY_PATH $LIBDIR 56 | WORKDIR /data 57 | RUN mkdir -p ${LIBDIR} 58 | 59 | COPY --from=timeseries --chown=redis:redis ${LIBDIR}/*.so ${LIBDIR}/ 60 | COPY --from=ai --chown=redis:redis ${LIBDIR}/ ${LIBDIR}/ 61 | COPY --from=gears --chown=redis:redis /var/opt/redislabs/lib/modules/redisgears.so ${LIBDIR}/ 62 | COPY --from=gears --chown=redis:redis /var/opt/redislabs/modules/ /var/opt/redislabs/modules/ 63 | 64 | WORKDIR /var/opt/redislabs/modules/rg 65 | RUN ln -s python3 python3_`cat /var/opt/redislabs/artifacts/VERSION` 66 | 67 | ADD redisedge.conf /etc 68 | CMD ["/etc/redisedge.conf"] 69 | -------------------------------------------------------------------------------- /edge/Dockerfile.arm: -------------------------------------------------------------------------------- 1 | # BUILD redisfab/redisedge:${VERSION}-${ARCH}-${OSNICK} 2 | 3 | ARG VERSION=0.4.0 4 | 5 | # OSNICK=stretch|bionic|buster 6 | ARG OSNICK=bionic 7 | 8 | # ARCH=arm64v8|arm32v7 9 | ARG ARCH=arm64v8 10 | 11 | # DEVICE=cpu|gpu 12 | ARG DEVICE=cpu 13 | 14 | ARG REDISAI_VERSION=1.0.2 15 | ARG REDISTIMESERIES_VERSION=1.4.6 16 | ARG REDISGEARS_VERSION=1.0.2 17 | ARG REDIS_VER=6.0.9 18 | 19 | #---------------------------------------------------------------------------------------------- 20 | FROM redisfab/redisai:${REDISAI_VERSION}-${DEVICE}-${ARCH}-${OSNICK} as ai 21 | FROM redisfab/redistimeseries:${REDISTIMESERIES_VERSION}-${ARCH}-${OSNICK} as timeseries 22 | FROM redisfab/redisgears:${REDISGEARS_VERSION}-${ARCH}-${OSNICK} as gears 23 | 24 | #---------------------------------------------------------------------------------------------- 25 | FROM redisfab/redis-xbuild:${REDIS_VER}-${ARCH}-${OSNICK} 26 | 27 | RUN [ "cross-build-start" ] 28 | 29 | ARG OSNICK 30 | ARG ARCH 31 | ARG VERSION 32 | ARG REDISAI_VERSION 33 | ARG REDISTIMESERIES_VERSION 34 | ARG REDISGEARS_VERSION 35 | 36 | RUN echo "Building redisedge-${OSNICK}:${VERSION}-${ARCH} with:" ;\ 37 | echo " RedisAI=${REDISAI_VERSION}" ;\ 38 | echo " RedisTimeSeries=${REDISTIMESERIES_VERSION}" ;\ 39 | echo " RedisGears=${REDISGEARS_VERSION}" ;\ 40 | echo " Redis=${REDIS_VER}" 41 | 42 | RUN set -e; if [ ! -z $(command -v apt-get) ]; then apt-get -qq update; apt-get -q install -y libgomp1; fi 43 | RUN set -e; if [ ! -z $(command -v yum) ]; then yum install -y libgomp; fi 44 | 45 | ENV LIBDIR /usr/lib/redis/modules 46 | ENV LD_LIBRARY_PATH $LIBDIR 47 | WORKDIR /data 48 | RUN mkdir -p ${LIBDIR} 49 | 50 | COPY --from=timeseries ${LIBDIR}/*.so ${LIBDIR}/ 51 | COPY --from=ai ${LIBDIR}/ ${LIBDIR}/ 52 | COPY --from=gears /var/opt/redislabs/lib/modules/redisgears.so ${LIBDIR}/ 53 | COPY --from=gears /var/opt/redislabs/modules/ /var/opt/redislabs/modules/ 54 | 55 | ADD redisedge.conf /etc 56 | CMD ["/etc/redisedge.conf"] 57 | 58 | RUN [ "cross-build-end" ] 59 | -------------------------------------------------------------------------------- /edge/Dockerfile.jetson: -------------------------------------------------------------------------------- 1 | # BUILD redisfab/redisedge:${VERSION}-jetson-${ARCH}-${OSNICK} 2 | 3 | ARG VERSION=0.4.0 4 | 5 | # OSNICK=stretch|bionic|buster 6 | ARG OSNICK=bionic 7 | 8 | # ARCH=x64|arm64v8|arm32v7 9 | ARG ARCH=arm64v8 10 | 11 | # DEVICE=cpu|gpu|jetson10.2|cuda10.2-jetson 12 | ARG DEVICE=gpu 13 | 14 | ARG REDIS_VER=6.0.9 15 | 16 | ARG REDISAI_VERSION=1.0.2 17 | ARG REDISTIMESERIES_VERSION=1.4.6 18 | ARG REDISGEARS_VERSION=1.0.2 19 | 20 | #---------------------------------------------------------------------------------------------- 21 | FROM redisfab/redisai:${REDISAI_VERSION}-jetson-${ARCH}-${OSNICK} as ai 22 | FROM redisfab/redistimeseries:${REDISTIMESERIES_VERSION}-${ARCH}-${OSNICK} as timeseries 23 | FROM redisfab/redisgears:${REDISGEARS_VERSION}-${ARCH}-${OSNICK} as gears 24 | 25 | #---------------------------------------------------------------------------------------------- 26 | FROM redisfab/redis:${REDIS_VER}-${ARCH}-${OSNICK} as redis 27 | FROM redisfab/jetpack:4.4.1-arm64v8-l4t 28 | 29 | ARG OSNICK 30 | ARG ARCH 31 | ARG VERSION 32 | ARG REDISAI_VERSION 33 | ARG REDISTIMESERIES_VERSION 34 | ARG REDISGEARS_VERSION 35 | ARG REDIS_VER 36 | 37 | RUN echo "Building redisedge:${VERSION}-jetson-${ARCH}-${OSNICK} with:" ;\ 38 | echo " RedisAI=${REDISAI_VERSION}" ;\ 39 | echo " RedisTimeSeries=${REDISTIMESERIES_VERSION}" ;\ 40 | echo " RedisGears=${REDISGEARS_VERSION}" ;\ 41 | echo " Redis=${REDIS_VER}" 42 | 43 | RUN set -e; if [ ! -z $(command -v apt-get) ]; then apt-get -qq update; apt-get -q install -y libgomp1; fi 44 | RUN set -e; if [ ! -z $(command -v yum) ]; then yum install -y libgomp; fi 45 | 46 | WORKDIR /data 47 | 48 | ENV REDISMODULES_LIBS /usr/lib/redis/modules 49 | ENV LD_LIBRARY_PATH ${REDISMODULES_LIBS}:${LD_LIBRARY_PATH} 50 | RUN mkdir -p ${REDISMODULES_LIBS} 51 | 52 | COPY --from=redis /usr/local/ /usr/local/ 53 | COPY --from=timeseries ${REDISMODULES_LIBS}/*.so ${REDISMODULES_LIBS}/ 54 | COPY --from=ai ${REDISMODULES_LIBS}/ ${REDISMODULES_LIBS}/ 55 | COPY --from=gears /var/opt/redislabs/lib/modules/redisgears.so ${REDISMODULES_LIBS}/ 56 | COPY --from=gears /var/opt/redislabs/modules/ /var/opt/redislabs/modules/ 57 | 58 | RUN set -e ;\ 59 | mkdir -p /var/opt/redislabs/modules/rg/python3/lib/python3.7/site-packages ;\ 60 | mkdir -p /var/opt/redislabs/modules/rg/python3/.venv/lib/python3.7/site-packages ;\ 61 | echo /usr/local/lib/python3.7/site-packages > /var/opt/redislabs/modules/rg/python3/lib/python3.7/site-packages/local.pth ;\ 62 | echo /usr/local/lib/python3.7/site-packages > /var/opt/redislabs/modules/rg/python3/.venv/lib/python3.7/site-packages/local.pth 63 | 64 | ADD redisedge.conf /etc 65 | ENTRYPOINT [ "/usr/local/bin/redis-server" ] 66 | CMD ["/etc/redisedge.conf"] 67 | 68 | -------------------------------------------------------------------------------- /edge/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ROOT=.. 3 | MK.pyver:=3 4 | include $(ROOT)/deps/readies/mk/main 5 | 6 | # OSNICK=buster|stretch|bionic 7 | OSNICK ?= bionic # buster 8 | 9 | REPO=redisedge 10 | 11 | ifeq ($(JETSON),1) 12 | DOCKER_SUFFIX=.jetson 13 | endif 14 | 15 | DOCKERFILE_STEM=$(ROOT)/edge/Dockerfile$(DOCKER_SUFFIX) 16 | 17 | include ../versions 18 | 19 | DOCKER_BUILD_ARGS += \ 20 | REDISAI_VERSION=$(REDISAI_VERSION) \ 21 | REDISTIMESERIES_VERSION=$(REDISTIMESERIES_VERSION) \ 22 | REDISGEARS_VERSION=$(REDISGEARS_VERSION) 23 | 24 | # override defines for the case 25 | ifdef REDISGEARS_DOCKERDEP 26 | DOCKER_BUILD_ARGS += \ 27 | VERSION=edge \ 28 | REDISGEARS_DOCKERDEP=$(REDISGEARS_DOCKERDEP) 29 | endif 30 | 31 | ifdef REDISAI_DOCKERDEP 32 | DOCKER_BUILD_ARGS += \ 33 | REDISAI_DOCKERDEP=$(REDISAI_DOCKERDEP) 34 | endif 35 | 36 | ifdef REDISTIMESERIES_DOCKERDEP 37 | DOCKER_BUILD_ARGS += \ 38 | REDISTIMESERIES_DOCKERDEP=$(REDISTIMESERIES_DOCKERDEP) 39 | endif 40 | 41 | ifdef REDIS_DOCKERDEP 42 | DOCKER_BUILD_ARGS += \ 43 | REDIS_DOCKERDEP=$(REDIS_DOCKERDEP) 44 | endif 45 | 46 | ifdef DOCKER_ORG 47 | DOCKER_BUILD_ARGS += \ 48 | DOCKER_ORG=$(DOCKER_ORG) 49 | endif 50 | 51 | 52 | 53 | include $(MK)/docker.native 54 | -------------------------------------------------------------------------------- /pylibs/Dockerfile: -------------------------------------------------------------------------------- 1 | # BUILD redisfab/redisedge-pylibs:${VERSION}-${ARCH}-${OSNICK} 2 | 3 | ARG VERSION=0.4.0 4 | 5 | # OS=debian:buster-slim|debian:stretch-slim|ubuntu:bionic|ubuntu:focal 6 | ARG OS=ubuntu:bionic 7 | 8 | # OSNICK=stretch|bionic|buster 9 | ARG OSNICK=bionic 10 | 11 | # ARCH=x64|arm64v8 12 | ARG ARCH=x64 13 | 14 | ARG PY_VER=3.7.2 15 | 16 | #---------------------------------------------------------------------------------------------- 17 | FROM redisfab/python:${PY_VER}-${ARCH}-${OSNICK} as builder 18 | 19 | ARG OSNICK 20 | ARG ARCH 21 | ARG PY_VER 22 | 23 | # The Python distribution is installed into /usr/local/bin. 24 | # The Python interpreter uses libpython3.7m.so.1.0, which is installed into /usr/local/lib. 25 | # Any libraries built and installed here are installed into /usr/local/lib. 26 | 27 | SHELL ["/bin/bash", "-c"] 28 | 29 | # ENV OPENCV_VERSION="4.4.0" 30 | 31 | WORKDIR /build 32 | 33 | ADD pylibs/system-setup.py /build 34 | 35 | COPY deps/ deps/ 36 | RUN python3 system-setup.py 37 | 38 | #---------------------------------------------------------------------------------------------- 39 | 40 | RUN python3 -m pip install numpy 41 | 42 | #---------------------------------------------------------------------------------------------- 43 | 44 | RUN git clone https://github.com/skvark/opencv-python.git 45 | 46 | WORKDIR /build/opencv-python 47 | 48 | RUN CMAKE_ARGS="\ 49 | -DBUILD_EXAMPLES=OFF \ 50 | -DBUILD_opencv_python2=OFF \ 51 | -DBUILD_opencv_python3=ON \ 52 | -DCMAKE_BUILD_TYPE=RELEASE \ 53 | -DCMAKE_INSTALL_PREFIX=~/.local \ 54 | -DCUDA_ARCH_BIN=5.3,6.2,7.2 \ 55 | -DCUDA_ARCH_PTX= \ 56 | -DCUDA_FAST_MATH=ON \ 57 | -DCUDNN_VERSION='8.0' \ 58 | -DEIGEN_INCLUDE_PATH=/usr/include/eigen3 \ 59 | -DENABLE_NEON=OFF \ 60 | -DOPENCV_DNN_CUDA=OFF \ 61 | -DOPENCV_ENABLE_NONFREE=ON \ 62 | -DOPENCV_EXTRA_MODULES_PATH=/tmp/build_opencv/opencv_contrib/modules \ 63 | -DOPENCV_GENERATE_PKGCONFIG=ON \ 64 | -DWITH_CUBLAS=ON \ 65 | -DWITH_CUDA=OFF \ 66 | -DWITH_CUDNN=OFF \ 67 | -DWITH_GSTREAMER=ON \ 68 | -DWITH_LIBV4L=ON \ 69 | -DWITH_OPENGL=ON \ 70 | " ;\ 71 | python3 -m pip install --no-binary opencv-python --progress-bar off opencv-python 72 | 73 | #---------------------------------------------------------------------------------------------- 74 | 75 | RUN set -ex ;\ 76 | python3 -m pip install Pillow ;\ 77 | python3 -m pip install imageio 78 | 79 | #---------------------------------------------------------------------------------------------- 80 | FROM redisfab/python:${PY_VER}-${ARCH}-${OSNICK} 81 | 82 | ARG OSNICK 83 | ARG ARCH 84 | ARG PY_VER 85 | 86 | COPY --from=builder /usr/local /usr/local 87 | 88 | ENTRYPOINT ["/usr/local/bin/python3"] 89 | -------------------------------------------------------------------------------- /pylibs/Dockerfile.arm: -------------------------------------------------------------------------------- 1 | # BUILD redisfab/redisedge-pylibs:${VERSION}-${ARCH}-${OSNICK} 2 | 3 | ARG VERSION=0.4.0 4 | 5 | # OS=debian:buster-slim|debian:stretch-slim|ubuntu:bionic|ubuntu:focal 6 | ARG OS=ubuntu:bionic 7 | 8 | # OSNICK=stretch|bionic|buster 9 | ARG OSNICK=bionic 10 | 11 | # ARCH=arm64v8|arm32v7 12 | ARG ARCH=arm64v8 13 | 14 | ARG PY_VER=3.7.2 15 | 16 | #---------------------------------------------------------------------------------------------- 17 | FROM redisfab/python:${PY_VER}-${ARCH}-${OSNICK} as builder 18 | 19 | ARG OSNICK 20 | ARG ARCH 21 | ARG PY_VER 22 | 23 | # The Python distribution is installed into /usr/local/bin. 24 | # The Python interpreter uses libpython3.7m.so.1.0, which is installed into /usr/local/lib. 25 | # Any libraries built and installed here are installed into /usr/local/lib. 26 | 27 | RUN [ "cross-build-start" ] 28 | 29 | # SHELL ["/bin/bash", "-c"] 30 | 31 | # ENV OPENCV_VERSION="4.4.0" 32 | 33 | WORKDIR /build 34 | 35 | ADD pylibs/system-setup.py /build 36 | 37 | COPY deps/ deps/ 38 | RUN python3 system-setup.py 39 | 40 | #---------------------------------------------------------------------------------------------- 41 | 42 | RUN python3 -m pip install numpy 43 | 44 | #---------------------------------------------------------------------------------------------- 45 | 46 | RUN git clone https://github.com/skvark/opencv-python.git 47 | 48 | WORKDIR /build/opencv-python 49 | 50 | RUN CMAKE_ARGS="\ 51 | -DBUILD_EXAMPLES=OFF \ 52 | -DBUILD_opencv_python2=ON \ 53 | -DBUILD_opencv_python3=ON \ 54 | -DCMAKE_BUILD_TYPE=RELEASE \ 55 | -DCMAKE_INSTALL_PREFIX=~/.local \ 56 | -DCUDA_ARCH_BIN=5.3,6.2,7.2 \ 57 | -DCUDA_ARCH_PTX= \ 58 | -DCUDA_FAST_MATH=ON \ 59 | -DCUDNN_VERSION='8.0' \ 60 | -DEIGEN_INCLUDE_PATH=/usr/include/eigen3 \ 61 | -DENABLE_NEON=ON \ 62 | -DOPENCV_DNN_CUDA=ON \ 63 | -DOPENCV_ENABLE_NONFREE=ON \ 64 | -DOPENCV_EXTRA_MODULES_PATH=/tmp/build_opencv/opencv_contrib/modules \ 65 | -DOPENCV_GENERATE_PKGCONFIG=ON \ 66 | -DWITH_CUBLAS=ON \ 67 | -DWITH_CUDA=ON \ 68 | -DWITH_CUDNN=ON \ 69 | -DWITH_GSTREAMER=ON \ 70 | -DWITH_LIBV4L=ON \ 71 | -DWITH_OPENGL=ON \ 72 | " ;\ 73 | python3 -m pip install --no-binary opencv-python --progress-bar off opencv-python 74 | 75 | #---------------------------------------------------------------------------------------------- 76 | 77 | RUN set -ex ;\ 78 | python3 -m pip install Pillow ;\ 79 | python3 -m pip install imageio 80 | 81 | RUN [ "cross-build-end" ] 82 | -------------------------------------------------------------------------------- /pylibs/Dockerfile.jetson: -------------------------------------------------------------------------------- 1 | # BUILD redisfab/redisedge-pylibs:${VERSION}-${ARCH}-${OSNICK} 2 | 3 | ARG VERSION=0.4.0 4 | 5 | # OS=debian:buster-slim|debian:stretch-slim|ubuntu:bionic|ubuntu:focal 6 | ARG OS=ubuntu:bionic 7 | 8 | # OSNICK=stretch|bionic|buster 9 | ARG OSNICK=bionic 10 | 11 | # ARCH=arm64v8 12 | ARG ARCH=arm64v8 13 | 14 | ARG PY_VER=3.7.2 15 | 16 | #---------------------------------------------------------------------------------------------- 17 | FROM redisfab/python:${PY_VER}-${ARCH}-${OSNICK} as python 18 | FROM redisfab/jetpack:4.4.1-arm64v8-l4t as builder 19 | 20 | ARG OSNICK 21 | ARG ARCH 22 | ARG PY_VER 23 | 24 | # The Python distribution is installed into /usr/local/bin. 25 | # The Python interpreter uses libpython3.7m.so.1.0, which is installed into /usr/local/lib. 26 | # Any libraries built and installed here are installed into /usr/local/lib. 27 | 28 | SHELL ["/bin/bash", "-c"] 29 | 30 | # ENV OPENCV_VERSION="4.5.0" 31 | 32 | WORKDIR /build 33 | 34 | ADD pylibs/system-setup.py /build 35 | 36 | COPY --from=python /usr/local/ /usr/local/ 37 | 38 | 39 | COPY deps/ deps/ 40 | RUN python3 system-setup.py 41 | 42 | #---------------------------------------------------------------------------------------------- 43 | 44 | RUN python3 -m pip install numpy 45 | 46 | #---------------------------------------------------------------------------------------------- 47 | 48 | RUN git clone https://github.com/skvark/opencv-python.git 49 | 50 | WORKDIR /build/opencv-python 51 | 52 | RUN CMAKE_ARGS="\ 53 | -DBUILD_EXAMPLES=OFF \ 54 | -DBUILD_opencv_python2=ON \ 55 | -DBUILD_opencv_python3=ON \ 56 | -DCMAKE_BUILD_TYPE=RELEASE \ 57 | -DCMAKE_INSTALL_PREFIX=~/.local \ 58 | -DCUDA_ARCH_BIN=5.3,6.2,7.2 \ 59 | -DCUDA_ARCH_PTX= \ 60 | -DCUDA_FAST_MATH=ON \ 61 | -DCUDNN_VERSION='8.0' \ 62 | -DEIGEN_INCLUDE_PATH=/usr/include/eigen3 \ 63 | -DENABLE_NEON=ON \ 64 | -DOPENCV_DNN_CUDA=ON \ 65 | -DOPENCV_ENABLE_NONFREE=ON \ 66 | -DOPENCV_EXTRA_MODULES_PATH=/tmp/build_opencv/opencv_contrib/modules \ 67 | -DOPENCV_GENERATE_PKGCONFIG=ON \ 68 | -DWITH_CUBLAS=ON \ 69 | -DWITH_CUDA=ON \ 70 | -DWITH_CUDNN=ON \ 71 | -DWITH_GSTREAMER=ON \ 72 | -DWITH_LIBV4L=ON \ 73 | -DWITH_OPENGL=ON \ 74 | " ;\ 75 | python3 -m pip install --no-binary opencv-python --progress-bar off opencv-python 76 | 77 | #---------------------------------------------------------------------------------------------- 78 | 79 | RUN set -ex ;\ 80 | python3 -m pip install Pillow ;\ 81 | python3 -m pip install imageio 82 | 83 | #---------------------------------------------------------------------------------------------- 84 | FROM redisfab/python:${PY_VER}-${ARCH}-${OSNICK} 85 | 86 | ARG OSNICK 87 | ARG ARCH 88 | ARG PY_VER 89 | 90 | COPY --from=builder /usr/local/bin /usr/local/bin 91 | COPY --from=builder /usr/local/include /usr/local/include 92 | COPY --from=builder /usr/local/lib /usr/local/lib 93 | COPY --from=builder /usr/local/man /usr/local/man 94 | COPY --from=builder /usr/local/share /usr/local/share 95 | 96 | ENTRYPOINT ["/usr/local/bin/python3"] 97 | -------------------------------------------------------------------------------- /pylibs/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ROOT=.. 3 | MK.pyver:=3 4 | include $(ROOT)/deps/readies/mk/main 5 | 6 | # OSNICK=buster|stretch|bionic 7 | OSNICK ?= bionic 8 | 9 | REPO=redisedge-pylibs 10 | 11 | ifeq ($(JETSON),1) 12 | DOCKER_SUFFIX=.jetson 13 | endif 14 | 15 | DOCKERFILE_STEM=$(ROOT)/pylibs/Dockerfile$(DOCKER_SUFFIX) 16 | 17 | include ../versions 18 | 19 | DOCKER_BUILD_ARGS += \ 20 | VERSION=$(VERSION) 21 | 22 | include $(MK)/docker.native 23 | -------------------------------------------------------------------------------- /pylibs/system-setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import sys 4 | import os 5 | import argparse 6 | 7 | # deps/readies in Docker filesystem terms 8 | HERE = ROOT = os.path.abspath(os.path.dirname(__file__)) 9 | READIES = os.path.join(ROOT, "deps/readies") 10 | sys.path.insert(0, READIES) 11 | import paella 12 | 13 | #---------------------------------------------------------------------------------------------- 14 | 15 | class RedisEdgeVisionLibsSetup(paella.Setup): 16 | def __init__(self, nop=False): 17 | paella.Setup.__init__(self, nop) 18 | 19 | def common_first(self): 20 | self.install("wget unzip git openssl") 21 | self.install("yasm") 22 | 23 | self.pip_install("wheel") 24 | self.pip_install("setuptools --upgrade") 25 | self.pip_install("virtualenv") 26 | 27 | def debian_compat(self): 28 | self.run("%s/bin/getgcc" % READIES) 29 | self.install("pkg-config") 30 | self.install("libtbb2 libtbb-dev") 31 | self.install("zlib1g-dev") 32 | self.install("libjpeg-dev libpng-dev libtiff-dev libavformat-dev libswscale-dev") 33 | # self.install("libpq-dev") 34 | 35 | def redhat_compat(self): 36 | pass 37 | 38 | def fedora(self): 39 | pass 40 | 41 | def macos(self): 42 | pass 43 | 44 | def common_last(self): 45 | self.run("%s/bin/getcmake" % READIES) 46 | # self.pip_install("numpy") 47 | 48 | #---------------------------------------------------------------------------------------------- 49 | 50 | parser = argparse.ArgumentParser(description='Set up system for RedisEdgeVisionLibs.') 51 | parser.add_argument('-n', '--nop', action="store_true", help='no operation') 52 | args = parser.parse_args() 53 | 54 | RedisEdgeVisionLibsSetup(nop = args.nop).setup() 55 | -------------------------------------------------------------------------------- /redisedge.conf: -------------------------------------------------------------------------------- 1 | # RedisEdge configuration file example. 2 | 3 | loadmodule /usr/lib/redis/modules/redisai.so 4 | loadmodule /usr/lib/redis/modules/redistimeseries.so 5 | loadmodule /usr/lib/redis/modules/redisgears.so PythonHomeDir /var/opt/redislabs/modules/rg/plugin/gears_python.so 6 | 7 | save 900 1 8 | save 300 10 9 | save 60 10000 10 | 11 | dir /data 12 | -------------------------------------------------------------------------------- /versions: -------------------------------------------------------------------------------- 1 | 2 | export VERSION=0.4.0 3 | 4 | export REDISAI_VERSION=1.0.2 5 | export REDISTIMESERIES_VERSION=1.4.6 6 | export REDISGEARS_VERSION=1.0.2 7 | export REDIS_VERSION=6.0.9 8 | 9 | # export REDISAI_VERSION=1.2.2 10 | # export REDISTIMESERIES_VERSION=1.4.8 11 | # export REDISGEARS_VERSION=1.2.1 12 | # export REDIS_VERSION=6.2.1 13 | -------------------------------------------------------------------------------- /vision/Dockerfile: -------------------------------------------------------------------------------- 1 | # BUILD redisfab/redisedgevision:${VERSION}-${ARCH}-${OSNICK} 2 | 3 | ARG VERSION=0.4.0 4 | 5 | # OSNICK=stretch|bionic|buster 6 | ARG OSNICK=bionic 7 | 8 | # ARCH=x64|arm64v8|arm32v7 9 | ARG ARCH=x64 10 | 11 | # DEVICE=cpu|gpu 12 | ARG DEVICE=cpu 13 | 14 | ARG REDISAI_VERSION=1.0.2 15 | ARG REDISTIMESERIES_VERSION=1.4.6 16 | ARG REDISGEARS_VERSION=1.0.2 17 | ARG REDIS_VER=6.2.1 18 | 19 | # done to specifically allow for ease of optional override with --build-arg 20 | ARG REDISAI_DOCKERDEP=${REDISAI_VERSION}-${DEVICE}-${ARCH}-${OSNICK} 21 | ARG REDISTIMESERIES_DOCKERDEP=${REDISTIMESERIES_VERSION}-${ARCH}-${OSNICK} 22 | ARG REDISGEARS_DOCKERDEP=${REDISGEARS_VERSION}-${ARCH}-${OSNICK} 23 | ARG REDIS_DOCKERDEP=${REDIS_VER}-${ARCH}-${OSNICK} 24 | 25 | #---------------------------------------------------------------------------------------------- 26 | FROM redisfab/redisai:${REDISAI_DOCKERDEP} as ai 27 | FROM redisfab/redistimeseries:${REDISTIMESERIES_DOCKERDEP} as timeseries 28 | FROM redisfab/redisgears:${REDISGEARS_DOCKERDEP} as gears 29 | 30 | #---------------------------------------------------------------------------------------------- 31 | FROM redisfab/redisedge-pylibs:${VERSION}-${ARCH}-${OSNICK} as pylibs 32 | FROM redisfab/redis:${REDIS_DOCKERDEP} 33 | 34 | ARG OSNICK 35 | ARG ARCH 36 | ARG VERSION 37 | ARG REDISAI_DOCKERDEP 38 | ARG REDISTIMESERIES_DOCKERDEP 39 | ARG REDISGEARS_DOCKERDEP 40 | ARG REDIS_DOCKERDEP 41 | 42 | RUN echo "Building redisedgevision:${VERSION}-${ARCH}-${OSNICK} with:" ;\ 43 | echo " RedisAI=${REDISAI_DOCKERDEP}" ;\ 44 | echo " RedisTimeSeries=${REDISTIMESERIES_DOCKERDEP}" ;\ 45 | echo " RedisGears=${REDISGEARS_DOCKERDEP}" ;\ 46 | echo " Redis=${REDIS_DOCKERDEP}" 47 | 48 | 49 | COPY --from=pylibs /usr/local/ /usr/local/ 50 | 51 | WORKDIR /tmp 52 | 53 | COPY deps/ deps/ 54 | ADD vision/system-setup.py . 55 | 56 | RUN ./deps/readies/bin/getpy3 57 | RUN ./system-setup.py 58 | 59 | WORKDIR /data 60 | 61 | ENV REDISMODULES_LIBS /usr/lib/redis/modules 62 | ENV LD_LIBRARY_PATH ${REDISMODULES_LIBS}:${LD_LIBRARY_PATH} 63 | RUN mkdir -p ${REDISMODULES_LIBS} 64 | 65 | COPY --from=timeseries ${REDISMODULES_LIBS}/*.so ${REDISMODULES_LIBS}/ 66 | COPY --from=ai ${REDISMODULES_LIBS}/ ${REDISMODULES_LIBS}/ 67 | COPY --from=gears /var/opt/redislabs/lib/modules/redisgears.so ${REDISMODULES_LIBS}/ 68 | COPY --from=gears /var/opt/redislabs/modules/ /var/opt/redislabs/modules/ 69 | 70 | # RUN set -e ;\ 71 | # mkdir -p /var/opt/redislabs/modules/rg/python3/.venv/lib/python3.7/site-packages ;\ 72 | # echo /usr/lib/python3/dist-packages > /var/opt/redislabs/modules/rg/python3/.venv/lib/python3.7/site-packages/global.pth 73 | 74 | RUN set -e ;\ 75 | mkdir -p /var/opt/redislabs/modules/rg/python3/lib/python3.7/site-packages ;\ 76 | mkdir -p /var/opt/redislabs/modules/rg/python3/.venv/lib/python3.7/site-packages ;\ 77 | echo /usr/local/lib/python3.7/site-packages > /var/opt/redislabs/modules/rg/python3/lib/python3.7/site-packages/local.pth ;\ 78 | echo /usr/local/lib/python3.7/site-packages > /var/opt/redislabs/modules/rg/python3/.venv/lib/python3.7/site-packages/local.pth 79 | 80 | ADD redisedge.conf /etc 81 | ENTRYPOINT [ "/usr/local/bin/redis-server" ] 82 | CMD ["/etc/redisedge.conf"] 83 | -------------------------------------------------------------------------------- /vision/Dockerfile.arm: -------------------------------------------------------------------------------- 1 | # BUILD redisfab/redisedgevision:${VERSION}-${ARCH}-${OSNICK} 2 | 3 | ARG VERSION=0.4.0 4 | 5 | # OSNICK=stretch|bionic|buster 6 | ARG OSNICK=buster 7 | 8 | # ARCH=arm64v8|arm32v7 9 | ARG ARCH=arm64v8 10 | 11 | # DEVICE=cpu|gpu 12 | ARG DEVICE=cpu 13 | 14 | ARG REDISAI_VERSION=1.0.2 15 | ARG REDISTIMESERIES_VERSION=1.4.6 16 | ARG REDISGEARS_VERSION=1.0.2 17 | ARG REDIS_VER=6.0.9 18 | 19 | #---------------------------------------------------------------------------------------------- 20 | FROM redisfab/redisai:${REDISAI_VERSION}-${DEVICE}-${ARCH}-${OSNICK} as ai 21 | FROM redisfab/redistimeseries:${REDISTIMESERIES_VERSION}-${ARCH}-${OSNICK} as timeseries 22 | FROM redisfab/redisgears:${REDISGEARS_VERSION}-${ARCH}-${OSNICK} as gears 23 | # FROM redisfab/redisedgevisionlibs-${OSNICK}:${REDISEDGEVISIONLIBS_VERSION}-${ARCH} as visionlibs 24 | 25 | #---------------------------------------------------------------------------------------------- 26 | FROM redisfab/redis-xbuild:${REDIS_VER}-${ARCH}-${OSNICK} 27 | 28 | RUN [ "cross-build-start" ] 29 | 30 | ARG OSNICK 31 | ARG ARCH 32 | ARG VERSION 33 | ARG REDISAI_VERSION 34 | ARG REDISTIMESERIES_VERSION 35 | ARG REDISGEARS_VERSION 36 | 37 | RUN echo "Building redisedgevision-${OSNICK}:${VERSION}-${ARCH} with:" ;\ 38 | echo " RedisAI=${REDISAI_VERSION}" ;\ 39 | echo " RedisTimeSeries=${REDISTIMESERIES_VERSION}" ;\ 40 | echo " RedisGears=${REDISGEARS_VERSION}" ;\ 41 | echo " Redis=${REDIS_VER}" 42 | 43 | WORKDIR /tmp 44 | 45 | COPY deps/ deps/ 46 | ADD vision/system-setup.py . 47 | 48 | RUN ./deps/readies/bin/getpy3 49 | RUN ./system-setup.py 50 | 51 | WORKDIR /data 52 | 53 | ENV REDISMODULES_LIBS /usr/lib/redis/modules 54 | ENV LD_LIBRARY_PATH ${REDISMODULES_LIBS}:${LD_LIBRARY_PATH} 55 | RUN mkdir -p ${REDISMODULES_LIBS} 56 | 57 | COPY --from=timeseries ${REDISMODULES_LIBS}/*.so ${REDISMODULES_LIBS}/ 58 | COPY --from=ai ${REDISMODULES_LIBS}/ ${REDISMODULES_LIBS}/ 59 | COPY --from=gears /var/opt/redislabs/lib/modules/redisgears.so ${REDISMODULES_LIBS}/ 60 | COPY --from=gears /var/opt/redislabs/modules/ /var/opt/redislabs/modules/ 61 | # COPY --from=visionlibs /usr/local/ /usr/local/ 62 | 63 | RUN set -e ;\ 64 | mkdir -p /var/opt/redislabs/modules/rg/python3/.venv/lib/python3.7/site-packages ;\ 65 | echo /usr/lib/python3/dist-packages > /var/opt/redislabs/modules/rg/python3/.venv/lib/python3.7/site-packages/global.pth 66 | 67 | ADD redisedge.conf /etc 68 | CMD ["/etc/redisedge.conf"] 69 | 70 | RUN [ "cross-build-end" ] 71 | -------------------------------------------------------------------------------- /vision/Dockerfile.jetson: -------------------------------------------------------------------------------- 1 | # BUILD redisfab/redisedgevision:${VERSION}-jetson-${ARCH}-${OSNICK} 2 | 3 | ARG VERSION=0.4.0 4 | 5 | # OSNICK=stretch|bionic|buster 6 | ARG OSNICK=bionic 7 | 8 | # ARCH=x64|arm64v8|arm32v7 9 | ARG ARCH=arm64v8 10 | 11 | # DEVICE=cpu|gpu|jetson10.2|cuda10.2-jetson 12 | ARG DEVICE=gpu 13 | 14 | ARG REDISAI_VERSION=1.0.2 15 | ARG REDISTIMESERIES_VERSION=1.4.6 16 | ARG REDISGEARS_VERSION=1.0.2 17 | ARG REDIS_VER=6.2.1 18 | 19 | # JETSON_MODEL=nano|xavier 20 | ARG JETSON_MODEL=nano 21 | 22 | ARG JETSON_JETPACK_VER=4.4.1 23 | 24 | #---------------------------------------------------------------------------------------------- 25 | FROM redisfab/redisai:${REDISAI_VERSION}-jetson-${ARCH}-${OSNICK} as ai 26 | FROM redisfab/redistimeseries:${REDISTIMESERIES_VERSION}-${ARCH}-${OSNICK} as timeseries 27 | FROM redisfab/redisgears:${REDISGEARS_VERSION}-${ARCH}-${OSNICK} as gears 28 | 29 | #---------------------------------------------------------------------------------------------- 30 | FROM redisfab/redisedge-pylibs:${VERSION}-${ARCH}-${OSNICK} as pylibs 31 | FROM redisfab/redis:${REDIS_VER}-${ARCH}-${OSNICK} as redis 32 | FROM redisfab/jetson-jetpack:${JETSON_JETPACK_VER}-${ARCH}-${JETSON_MODEL} 33 | 34 | ARG OSNICK 35 | ARG ARCH 36 | ARG VERSION 37 | ARG REDISAI_VERSION 38 | ARG REDISTIMESERIES_VERSION 39 | ARG REDISGEARS_VERSION 40 | ARG REDIS_VER 41 | ARG JETSON_JETPACK_VER 42 | ARG JETSON_MODEL 43 | 44 | RUN echo "Building redisedgevision:${VERSION}-jetson-${ARCH}-${OSNICK} with:" ;\ 45 | echo " RedisAI=${REDISAI_VERSION}" ;\ 46 | echo " RedisTimeSeries=${REDISTIMESERIES_VERSION}" ;\ 47 | echo " RedisGears=${REDISGEARS_VERSION}" ;\ 48 | echo " Redis=${REDIS_VER}" ;\ 49 | echo " Jetson=jetpack${JETSON_JETPACK_VER}-${JETSON_MODEL}" 50 | 51 | COPY --from=pylibs /usr/local/ /usr/local/ 52 | 53 | WORKDIR /tmp 54 | 55 | COPY deps/ deps/ 56 | ADD vision/system-setup.py . 57 | 58 | # RUN ./deps/readies/bin/getpy3 59 | RUN python3 ./system-setup.py 60 | 61 | WORKDIR /data 62 | 63 | ENV REDISMODULES_LIBS /usr/lib/redis/modules 64 | ENV LD_LIBRARY_PATH ${REDISMODULES_LIBS}:${LD_LIBRARY_PATH} 65 | RUN mkdir -p ${REDISMODULES_LIBS} 66 | 67 | COPY --from=redis /usr/local/ /usr/local/ 68 | COPY --from=timeseries ${REDISMODULES_LIBS}/*.so ${REDISMODULES_LIBS}/ 69 | COPY --from=ai ${REDISMODULES_LIBS}/ ${REDISMODULES_LIBS}/ 70 | COPY --from=gears /var/opt/redislabs/lib/modules/redisgears.so ${REDISMODULES_LIBS}/ 71 | COPY --from=gears /var/opt/redislabs/modules/ /var/opt/redislabs/modules/ 72 | 73 | # RUN set -e ;\ 74 | # mkdir -p /var/opt/redislabs/modules/rg/python3/.venv/lib/python3.7/site-packages ;\ 75 | # echo /usr/lib/python3/dist-packages > /var/opt/redislabs/modules/rg/python3/.venv/lib/python3.7/site-packages/global.pth 76 | 77 | RUN set -e ;\ 78 | mkdir -p /var/opt/redislabs/modules/rg/python3/lib/python3.7/site-packages ;\ 79 | mkdir -p /var/opt/redislabs/modules/rg/python3/.venv/lib/python3.7/site-packages ;\ 80 | echo /usr/local/lib/python3.7/site-packages > /var/opt/redislabs/modules/rg/python3/lib/python3.7/site-packages/local.pth ;\ 81 | echo /usr/local/lib/python3.7/site-packages > /var/opt/redislabs/modules/rg/python3/.venv/lib/python3.7/site-packages/local.pth 82 | 83 | ADD redisedge.conf /etc 84 | ENTRYPOINT [ "/usr/local/bin/redis-server" ] 85 | CMD ["/etc/redisedge.conf"] 86 | -------------------------------------------------------------------------------- /vision/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ROOT=.. 3 | MK.pyver:=3 4 | include $(ROOT)/deps/readies/mk/main 5 | 6 | # OSNICK=buster|stretch|bionic 7 | OSNICK ?= bionic 8 | 9 | REPO=redisedgevision 10 | 11 | ifeq ($(JETSON),1) 12 | DOCKER_SUFFIX=.jetson 13 | endif 14 | 15 | DOCKERFILE_STEM=$(ROOT)/vision/Dockerfile$(DOCKER_SUFFIX) 16 | 17 | include ../versions 18 | 19 | DOCKER_BUILD_ARGS += \ 20 | REDISAI_VERSION=$(REDISAI_VERSION) \ 21 | REDISTIMESERIES_VERSION=$(REDISTIMESERIES_VERSION) \ 22 | REDISGEARS_VERSION=$(REDISGEARS_VERSION) 23 | 24 | ifdef REDISGEARS_DOCKERDEP 25 | DOCKER_BUILD_ARGS += \ 26 | REDISGEARS_DOCKERDEP=$(REDISGEARS_DOCKERDEP) 27 | endif 28 | 29 | ifdef REDISAI_DOCKERDEP 30 | DOCKER_BUILD_ARGS += \ 31 | REDISAI_DOCKERDEP=$(REDISAI_DOCKERDEP) 32 | endif 33 | 34 | ifdef REDISTIMESERIES_DOCKERDEP 35 | DOCKER_BUILD_ARGS += \ 36 | REDISTIMESERIES_DOCKERDEP=$(REDISTIMESERIES_DOCKERDEP) 37 | endif 38 | 39 | ifdef REDIS_DOCKERDEP 40 | DOCKER_BUILD_ARGS += \ 41 | REDIS_DOCKERDEP=$(REDIS_DOCKERDEP) 42 | endif 43 | 44 | 45 | include $(MK)/docker.native 46 | -------------------------------------------------------------------------------- /vision/system-setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import sys 4 | import os 5 | import argparse 6 | 7 | # deps/readies in Docker filesystem terms 8 | sys.path.insert(0, os.path.join(os.path.dirname(__file__), "deps/readies")) 9 | import paella 10 | 11 | #---------------------------------------------------------------------------------------------- 12 | 13 | class RedisEdgeVisionSetup(paella.Setup): 14 | def __init__(self, nop=False): 15 | paella.Setup.__init__(self, nop) 16 | 17 | def common_first(self): 18 | pass 19 | 20 | def debian_compat(self): 21 | # self.install("python3-numpy python3-opencv python3-pil python3-imageio") 22 | self.install("libtbb2 zlib1g libgomp1") 23 | self.install("libjpeg62 libpng16-16 libtiff5") 24 | # self.install("libswscale5 libjpeg62-turbo libpng16-16 libtiff5 libavformat58 libilmbase23 libopenexr23") 25 | 26 | def ubuntu(self): 27 | if self.osnick == 'focal': 28 | self.install("libswscale5 libavformat58 libilmbase24 libopenexr24") 29 | else: 30 | self.install("libswscale4 libavformat57 libilmbase12 libopenexr22") 31 | 32 | def redhat_compat(self): 33 | pass 34 | 35 | def fedora(self): 36 | pass 37 | 38 | def macos(self): 39 | pass 40 | 41 | def common_last(self): 42 | pass 43 | 44 | #---------------------------------------------------------------------------------------------- 45 | 46 | parser = argparse.ArgumentParser(description='Set up system for RedisEdgeVision.') 47 | parser.add_argument('-n', '--nop', action="store_true", help='no operation') 48 | args = parser.parse_args() 49 | 50 | RedisEdgeVisionSetup(nop = args.nop).setup() 51 | --------------------------------------------------------------------------------