I had not heard of hatamiarash7/Memcached-Admin before today, and got nerdsniped by someone telling me they had trouble setting it up for their local development with SilverStripe. So, here's a recipe.
name: test
services:
memcached:
type: memcached
memcacheadmin:
type: compose
app_mount: false
services:
image: hatamiarash7/memcached-admin:latest
command: docker-php-entrypoint apache2-foreground
ports:
- 80
environment:
# This needs configuring to the hostname shown from `lando info`
MEMCACHED_HOST: "memcached.test.internal"
This will bring up a small Lando stack with only memcached and memcached-admin, and the only URL output will be for the admin interface. This example is mostly for lifting into an existing project, and as an example of how to utilise a Docker image as part of a Lando stack using a compose
service.
Note that MEMCACHED_HOST
contains the name of the project in the hostname - this will need updating to match the project it's being dropped into.
Oh and another thing
I also want to give a shout out to how you can overlay configs in Lando, so I can add .lando.local.yml
to .gitignore
, and then put the "extras" into the local file only. This means I can have a regular project .lando.yml
:
.lando.yml
:
# Lots of project specific config here.
name: whatever
type: lamp
And then isolate whatever whimsical things I'm doing - eg test out services or tooling in a local sandbox - without it showing up in the main configuration.
.lando.local.yml
:
# Stuff I'm messing with and don't want to track in git.
services:
memcached:
type: memcached
memcacheadmin:
type: compose
app_mount: false
services:
image: hatamiarash7/memcached-admin:latest
command: docker-php-entrypoint apache2-foreground
ports:
- 80
environment:
# This needs configuring to the hostname shown from `lando info`
MEMCACHED_HOST: "memcached.whatever.internal"
# Random example tooling made up to demo adding that as well.
tooling:
install-netcat:
service: memcached
cmd:
- apt -y update
- apt -y install netcat
user: root
query-memcache:
service: memcached
cmd:
- echo "version" | nc memcached.test.internal 11211
- nc memcached.test.internal 11211
This to me is a tidy way to stash things in a file that means I can retain a modification locally while hopping between branches. I can copy the day's tooling or services into the main .lando.yml
when the time is right.