Redis

Redis is an open source, in-memory and typed data structure store, used as a database, cache and message broker. You can easily add it to your Lando app by adding an entry to the services key in your app's .lando.yml.

Supported versions

Using patch versions

While Lando does not "officially" support specifying a patch version of this service you can try specifying one using overrides if you need to. This is not guaranteed to work so use at your own risk and take some care to make sure you are using a debian flavored patch version that also matches up with the major and minor versions of the service that we indicate above in "Supported versions".

Here are all the tags that are available for this service.

Here is an example of overriding the nginx service to use a patched version.

# The name of my app
name: patchversion

# Give me http://patchversion.lndo.site and https://patchversion.lndo.site
proxy:
  appserver:
    - patchversion.lndo.site

# Configure my services
services:

  # Create an nginx service called "appserver"
  appserver:

    # Set this to custom so we can override down the stream
    type: nginx:custom

    # SSL
    ssl: true

    # Override the image with the patch version
    # Note that this needs to be a correct namespace on the docker hub
    overrides:
      services:
        image: nginx:1.12.1

# Quick comamnd to check the nginx version
tooling:
  nginx:
    service: appserver

You can check out the full code for this example over here.

Example

# Redis example
name: redis

#
# You need to run `lando npm install` before you run `lando start` for this
# example to work
#

# Give me http://redis.lndo.site
proxy:
  appserver:
    - redis.lndo.site

# Spin up a basic nodes server with redis backend
services:

  # Spin up a redis container called "cache"
  # NOTE: "cache" is arbitrary, you could just as well call this "theboss" or "eljefe"
  cache:

    # Use version 3.2 of redis
    type: redis:3.2

    # Optionally allow access to the cache at localhost:6380
    # You will need to make sure port 6380 is open on your machine
    #
    # You can also set `portforward: true` to have Lando dynamically assign
    # a port. Unlike specifying an actual port setting this to true will give you
    # a different port every time you restart your app
    portforward: 6380

    # Optionally set the redis cache to persist
    persist: true

    # Optionally load in a custom redis.conf this is relative to your app root
    # directory
    # config:
    #  config: config/redis.conf

  # Spin up services to run a basic node server
  appserver:
    type: node:6.10
    command: npm start
    # run:
    #  - "cd $LANDO_MOUNT & npm install"

# Add some nice command routing
tooling:
  # Drop the user into a redis shell
  redis-cli:
    service: cache
  npm:
    service: appserver_cli
  node:
    service: appserver_cli

You will need to rebuild your app with lando rebuild to apply the changes to this file. You can check out the full code for this example over here.

Getting information

You can get connection and credential information about your redis instance by running lando info from inside your app.

# Navigate to the app
cd /path/to/app

# Get info (app needs to be running to get this)
lando info

{
  "cache": {
    "type": "redis",
    "version": "3.2",
    "internal_connection": {
      "host": "cache",
      "port": 6379
    },
    "external_connection": {
      "host": "localhost",
      "port": 6380
    }
  },
  "appserver": {
    "type": "node",
    "version": "6.10",
    "urls": [
      "http://localhost:32802",
      "http://redis.lndo.site"
    ]
  }
}

results matching ""

    No results matching ""