Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memcached process not started once container running #1827

Closed
johangant opened this issue Oct 17, 2019 · 10 comments
Closed

Memcached process not started once container running #1827

johangant opened this issue Oct 17, 2019 · 10 comments
Assignees
Labels
bug Something aint working right!
Milestone

Comments

@johangant
Copy link

johangant commented Oct 17, 2019

Tell us about your setup

Lando version: v3.0.0-rc.22
Operating system: macOS 10.14.6

Tell us about your .lando.yml

name: my-lando-app
recipe: drupal8
config:
  webroot: .
services:
  memcached:
    type: memcached
    portforward: true

Tell us about the command you were running

lando init
# ? From where should we get your app's codebase? current working directory
# ? What recipe do you want to use? drupal8
# ? Where is your webroot relative to the init destination? ./
# ? What do you want to call this app? my-lando-app
lando start
lando ssh -s appserver --user=root
apt update
apt install telnet
telnet memcached 11211

Tell us about the error you got

Running the above steps should give you a refused connection from the memcached container which, although reported as healthy, has no running memcached service inside it so refuses connections from applications or other tools.

What I've noticed is that if you run these commands, you can get it to connect:

lando ssh -s memcached
/opt/bitnami/memcached/bin/memcached &
# exit ssh
lando ssh -s appserver --user=root
telnet memcached 11211
# Should now connect

Tell us generally about your bug

If I run the docker image with docker exec -it memcached /bin/bash it has a working memcached process running.

I'm a little unclear whether it's the lando helper scripts that might need adjusting or if it's an upstream change that might have caused a fault.

Some output from lando logs -s memcached which may be relevant:

Attaching to mylandoapp_memcached_1
memcached_1     | mkdir: cannot create directory '/etc/ssh': Permission denied
memcached_1     | Running command /bin/sh -c chmod +x /launch.sh && /launch.sh
memcached_1     | /bin/sh: 1: /launch.sh: Permission denied
memcached_1     | mkdir: cannot create directory '/etc/ssh': Permission denied
memcached_1     | Running command /bin/sh -c chmod +x /launch.sh && /launch.sh
memcached_1     | /bin/sh: 1: /launch.sh: Permission denied
memcached_1     | Scanning /lando/keys for keys...
memcached_1     | Found keys
memcached_1     | Scanning /user/.ssh for keys...
memcached_1     | Found keys /user/.ssh/id_rsa
memcached_1     | Ensuring permissions and ownership of /user/.ssh/id_rsa...
memcached_1     | Checking whether /user/.ssh/id_rsa is a private key...
memcached_1     | Scanning /var/www/.ssh for keys...
memcached_1     | Found keys
memcached_1     | Using the following keys: /user/.ssh/id_rsa
memcached_1     | chmod: changing permissions of '/etc/ssh/ssh_config': Operation not permitted
memcached_1     | Running command /bin/sh -c chmod +x /launch.sh && /launch.sh
memcached_1     | /bin/sh: 1: /launch.sh: Permission denied
@johangant johangant added the bug Something aint working right! label Oct 17, 2019
@craigwillis85
Copy link

I can confirm that I am also seeing this in rc22 (also rc21)

The hack that @johangant mentioned does seem to allow my app to connect to memcached

@brunodbo
Copy link

Also seeing this in rc22. Starting memcached manually as mentioned by @johangant works for me too.

This is the output of lando logs -s cache, right after rebuilding:

Attaching to textillia_cache_1
cache_1       | chmod: changing permissions of '/helpers/add-cert.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/auth.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/binding.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/generate-key.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/get-remote-url.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/lando-entrypoint.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/load-keys.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/mounter.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/pantheon.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/pull.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/push.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/refresh-certs.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/setup-ca.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/sql-export.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/sql-import.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/switch.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/user-perm-helpers.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/user-perms.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/user-perms.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/scripts/load-keys.sh': Operation not permitted
cache_1       | mkdir: cannot create directory '/etc/ssh': Permission denied
cache_1       | Running command /bin/sh -c chmod +x /launch.sh && /launch.sh
cache_1       | chmod: changing permissions of '/launch.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/add-cert.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/auth.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/binding.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/generate-key.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/get-remote-url.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/lando-entrypoint.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/load-keys.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/mounter.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/pantheon.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/pull.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/push.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/refresh-certs.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/setup-ca.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/sql-export.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/sql-import.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/switch.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/user-perm-helpers.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/user-perms.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/user-perms.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/scripts/load-keys.sh': Operation not permitted
cache_1       | mkdir: cannot create directory '/etc/ssh': Permission denied
cache_1       | Running command /bin/sh -c chmod +x /launch.sh && /launch.sh
cache_1       | chmod: changing permissions of '/launch.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/add-cert.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/auth.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/binding.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/generate-key.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/get-remote-url.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/lando-entrypoint.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/load-keys.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/mounter.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/pantheon.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/pull.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/push.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/refresh-certs.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/setup-ca.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/sql-export.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/sql-import.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/switch.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/user-perm-helpers.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/user-perms.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/helpers/user-perms.sh': Operation not permitted
cache_1       | chmod: changing permissions of '/scripts/load-keys.sh': Operation not permitted
cache_1       | mkdir: cannot create directory '/etc/ssh': Permission denied
cache_1       | Running command /bin/sh -c chmod +x /launch.sh && /launch.sh
cache_1       | chmod: changing permissions of '/launch.sh': Operation not permitted

I tried starting memcached in the build/build_as_root step of the cache service, but that didn't help:

cache:
    type: memcached:1.5.12
    portforward: true
    mem: 64
    build_as_root:
      - /opt/bitnami/memcached/bin/memcached &

@andrebonon
Copy link

Starting memcache manually works for me too.
I got the same error as @brunodbo .

@edurenye
Copy link
Contributor

Looks like there are a lot of issues like this, that something happens with Bitnami and the container does not work anymore with Lando.
We should look for a way to prevent that from happening.

@tormi
Copy link
Contributor

tormi commented Jan 8, 2020

This is a workable memcached service setup based on the @johangant's solution:

services:
  memcached:
    type: memcached
    portforward: true
    run:
      - /bin/sh -c '/opt/bitnami/memcached/bin/memcached start -d'

JorisVanEijden pushed a commit to JorisVanEijden/lando that referenced this issue Jan 14, 2020
@hkirsman
Copy link

Why I didn't come here earlier. Was pulling my hair out with this. Well good thing is I have a bit alternative solution:

services:
  memcached:
    type: memcached
    run:
      - memcached -d

I'll add also my Drupal configuration needed to get this work:

<?php

$lando_info = json_decode(getenv('LANDO_INFO'), TRUE);

$settings['memcache']['servers'] = [$lando_info['memcached']['internal_connection']['host'] . ':' . $lando_info['memcached']['internal_connection']['port'] => 'default'];
$settings['memcache']['bins'] = ['default' => 'default'];
$settings['memcache']['key_prefix'] = '';
$settings['cache']['default'] = 'cache.backend.memcache';

@stale
Copy link

stale bot commented Feb 20, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions and please check out this if you are wondering why we auto close issues.

@stale stale bot added the stale Issue has been auto-flagged as stale label Feb 20, 2020
@hanoii
Copy link
Contributor

hanoii commented Feb 21, 2020

I'd think this is still worth fixing?

@stale stale bot removed the stale Issue has been auto-flagged as stale label Feb 21, 2020
@pirog pirog added this to the 3.0.0-aft.1 milestone Mar 3, 2020
@pirog pirog self-assigned this Mar 3, 2020
@pirog
Copy link
Member

pirog commented Mar 6, 2020

So it looks like the issue here is that the new launch.sh script was not being mounted correctly because the memcached configuration directory was set to null instead of its actual location.

When docker tries to mount a non-existent file it usually ends up creating an empty directory instead of the actual file. If you ssh into a memcache container and check out /launch.sh you can see that it is a directory.

This should be easy to fix by itself. we should also get better tests for memcached so regressions like ths are easier to catch.

@pirog
Copy link
Member

pirog commented Mar 6, 2020

Alright, this is merged into master and will be in the next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something aint working right!
Projects
None yet
Development

No branches or pull requests

9 participants