Redis

An example deploying a Swarm application with templated configuration

This content is associated with a legacy version of the Replicated product. For the current Replicated product documentation, see docs.replicated.com.

Redis Example

This is an example of Redis setup with templated configuration. This example will insert some configuration values into the Redis config via templating.

# kind: replicated

replicated_api_version: 2.9.2
name: "Redis"

properties:
  console_title: "Redis"

config:
- name: redis
  title: Redis Configuration
  description: Redis Configuration Items
  items:
  - name: redis_timeout
    title: Timeout
    type: text
    required: true

swarm:
  configs:
  - name: redis_config
    value: |
      bind 127.0.0.1
      port 6379
      timeout {{repl ConfigOption "redis_timeout" }}

---
# kind: scheduler-swarm
version: '3.3'
services:
  redis:
    image: redis:3.2-alpine
    command: "redis-server /usr/local/etc/redis/redis.conf"
    configs:
    - source: redis_config
      target: /usr/local/etc/redis/redis.conf

configs:
  redis_config:
    external: true