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

Redis service doesn't start properly on Apple Silicon #135

Open
jasonevines opened this issue Dec 13, 2021 · 12 comments
Open

Redis service doesn't start properly on Apple Silicon #135

jasonevines opened this issue Dec 13, 2021 · 12 comments
Labels
bug Something isn't working m1 Problems specific to arm64 support for Mac

Comments

@jasonevines
Copy link

The Redis service, corresponding to the Platform.sh Redis 6 image, doesn't start properly on my MacBook Pro M1 Max.

These errors keep repeating in the log:

runsv idmapd: fatal: unable to lock supervise/lock: temporary failure
runsv redis: fatal: unable to lock supervise/lock: temporary failure

@rtfm-47 rtfm-47 transferred this issue from lando/lando Dec 13, 2021
@reynoldsalec reynoldsalec added bug Something isn't working m1 Problems specific to arm64 support for Mac and removed Needs Triage labels Dec 15, 2021
@reynoldsalec
Copy link
Member

@jasonevines any chance the solution to #136 helped with this?

@jasonevines
Copy link
Author

I tried that, but it didn't help. This is still a problem.

@jasonevines
Copy link
Author

I've reached out to Platform.sh, and their engineers are placing responsibility for Apple Silicon problems on Lando.

Any chance progress has been made on this?

@reynoldsalec
Copy link
Member

reynoldsalec commented Feb 25, 2022

@jasonevines I think I've replicated your issue after talking with another user on the Lando Slack.

When I look at the logs for the appserver container on my install, I see these error messages which seem like the crux of the issue. If you open the logs for the appserver within Docker Desktop, do you see something similar on your failed start, particularly something like that Exception: Extension '{'configuration': {}, 'name': u'redis'}' is unknown. line?

2022-02-23 22:10:58,621 platformsh.agent ERROR Error in service config.py:

Traceback (most recent call last):

  File "/usr/lib/python2.7/dist-packages/platformsh/agent/__init__.py", line 33, in log_and_load

    yield load()

  File "/etc/platform/start", line 6, in <module>

    service.start()

  File "/usr/lib/python2.7/dist-packages/platformsh_app/service.py", line 410, in start

    self.generate_application_environment(app)

  File "/usr/lib/python2.7/dist-packages/platformsh_app/service.py", line 576, in generate_application_environment

    self.generate_application_configuration(app)

  File "/usr/lib/python2.7/dist-packages/platformsh_app_php/__init__.py", line 235, in generate_application_configuration

    extension = _validate_extension(extension)

  File "/usr/lib/python2.7/dist-packages/platformsh_app_php/__init__.py", line 208, in _validate_extension

    raise Exception("Extension '%s' is unknown." % extension)

Exception: Extension '{'configuration': {}, 'name': u'redis'}' is unknown.

Traceback (most recent call last):

  File "/etc/platform/start", line 6, in <module>

    service.start()

  File "/usr/lib/python2.7/dist-packages/platformsh_app/service.py", line 410, in start

    self.generate_application_environment(app)

  File "/usr/lib/python2.7/dist-packages/platformsh_app/service.py", line 576, in generate_application_environment

    self.generate_application_configuration(app)

  File "/usr/lib/python2.7/dist-packages/platformsh_app_php/__init__.py", line 235, in generate_application_configuration

    extension = _validate_extension(extension)

  File "/usr/lib/python2.7/dist-packages/platformsh_app_php/__init__.py", line 208, in _validate_extension

    raise Exception("Extension '%s' is unknown." % extension)

Exception: Extension '{'configuration': {}, 'name': u'redis'}' is unknown.

run-parts: /scripts/001-boot-platformsh exited with return code 1

Also note that the user I spoke to on Slack was on an Intel Mac, so I don't think this is actually an M1-specific issue.

Temporary Workaround

Disabling the redis extension on Lando will resolve this issue; obviously that means you won't have redis locally, but unless you're doing some special redis-specific things, that likely won't be a blocker. Add an overrides section to your .lando.yml that does not include redis. Here's a simple sample Landofile...in this case I'll be installing xdebug and overriding the extensions in my .platform.app.yaml:

name: platformsh-wordpress-vanilla
recipe: platformsh
tooling:
  wp:
    service: app
overrides:
  app:
    runtime:
      extensions:
        - xdebug

Relevant section in docs, read through that and it'll make sense: https://docs.lando.dev/config/platformsh.html#xdebug

@sgelliott
Copy link

sgelliott commented Feb 25, 2022

I'm on macOS Intel, Wordpress
Some additional information from my testing... when I have these extensions in my .platform.app.yml

runtime:
  extensions:
    - redis
    - imagick

The overrides in my .lando.yml don't seem to replace those extensions. So I still get errors when doing lando rebuild if either redis or imagick are enabled in the platformfile. If I disable those in the platformfile and include imagick in my Landofile overrides, I still get an error:

File "/usr/lib/python2.7/dist-packages/platformsh_app_php/__init__.py", line 208, in _validate_extension raise Exception("Extension '%s' is unknown." % extension)
Exception: Extension '{'configuration': {}, 'name': u'imagick'}' is unknown.

It seems like this issue might be related to the above #138

However, if I replace the imagick extensions in the Landofile overrides with xdebug as @reynoldsalec mentions above, it works fine (with the platformfile extensions disabled). Any time the platformfile extensions are enabled, it errors regardless of the landofile overrides.

Currently my only solution to use Lando locally is to comment out the extensions in the platformfile and run lando start - then make sure I don't commit those changes when pushing to Platform.sh.

@reynoldsalec Some new information after looking at #138 - When I change the type in .platform.app.yml from php:8.1 to php.7.4 everything works fine. So it seems like this has something to do with the image for php 8.x

And using php:8.1 results in issues for both redis and imagick but then php:8.0 works for redis and fails for imagick - so there are some unique issues depending on the php version and extension selected.

@reynoldsalec
Copy link
Member

Note to self: I should try this with the new P.sh images (see PRs for how to toggle those when running the plugin from source)...possible that they would solve the problem.

@reynoldsalec
Copy link
Member

Ok @sgelliott + @jasonevines, after trying it out, I think it's very possible that trying out the "stableTags" PR could solve these problems for users.

To test that out:

mkdir ~/.lando/plugins/@lando
cd ~/.lando/plugins/@lando
git clone [email protected]:lando/platformsh.git
cd platformsh
git checkout stableTag
yarn install

Then go to one of your sites using the P.sh recipe and lando rebuild it.

To make sure you're using the version of the P.sh Lando plugin from your plugins directory, run lando config and search for platformsh, you should see an entry for the plugin that shows the path to ~/.lando/plugins:

{ app: '/Users/alec/.lando/plugins/@lando/platformsh/app.js',
       dir: '/Users/alec/.lando/plugins/@lando/platformsh',
       name: '@lando/platformsh',
       path: '/Users/alec/.lando/plugins/@lando/platformsh/index.js',
       recipes: '/Users/alec/.lando/plugins/@lando/platformsh/recipes',
       scripts: '/Users/alec/.lando/plugins/@lando/platformsh/scripts',
       services: '/Users/alec/.lando/plugins/@lando/platformsh/services',
       types: '/Users/alec/.lando/plugins/@lando/platformsh/types' },

You should also see Lando downloading the stable images on rebuild:

Status: Downloaded newer image for docker.registry.platform.sh/redis-6.0:stable

Let me know if you have trouble trying things out; if you reach out on Slack I might be able to help you debug in realtime.

@reynoldsalec
Copy link
Member

...one thing to note if you try the stableTags PR is that some of the service versions don't work (this is why we haven't deployed any of those PRs). Notably, I had to downgrade my MariaDB to 10.2 to get things to work.

@sgelliott
Copy link

sgelliott commented Mar 16, 2022

Thank you, @reynoldsalec - I tried everything above. Here's what I got when using mariadb:10.4 in .platform/services.yml...

Warning: Undefined array key "password" in /app/wordpress/wp-config.php on line 134 Error establishing a database connection

After that, I changed to mariadb:10.2 as you suggested. And did another lando rebuild and got the same result. The password line is the one mentioned in the error. This is a new issue after doing what you outlined above.

if ($config->hasRelationship('redis') && extension_loaded('redis')) {
	$credentials = $config->credentials('redis');
	$redis_server = array(
		'host'     => $credentials['host'],
		'port'     => $credentials['port'],
		'auth'     => $credentials['password'],
	);
}

Extensions enabled when doing this...

runtime:
  extensions:
    - redis
    - imagick

Also, not sure if this is important, but when following this instruction mkdir ~/.lando/plugins/@lando - I did not have a plugins folder under ~/.lando/ - should that have been there already or is this introducing that folder as well?

All that being said, the errors mentioned above no longer exist when doing lando rebuild ( eg: Exception: Extension '{'configuration': {}, 'name': u'redis'}' is unknown. ). But the app does not function due to the DB connection error.

I'll reach out directly on Slack as a follow-up to this.

@reynoldsalec
Copy link
Member

@sgelliott yeah that sounds like a different issue probably specific to the way you're getting config credentials. If the app services built and started up correctly, then we're at least addressing the problems specific to this issue.

Guessing you have a working setup already, but these are the Lando docs on wp-config.php: https://docs.lando.dev/wordpress/config.html#wp-config-php

@sgelliott
Copy link

sgelliott commented Mar 16, 2022

@reynoldsalec Yeah, the configuration I have was working originally. The updates you shared above allowed the extensions to work, but the DB no longer connected. When I reverted the update above and rebuilt with the same configuration (extensions disabled) it works fine again (DB connects fine). So I don't think it's an issue with the wp-config.php. That configuration didn't change when using the new update above and also when reverting back to the original. But it worked with the original and not with the new plugin release above.

@magtak
Copy link

magtak commented Apr 25, 2023

I am trying to set up a local environment so I can work on my site using PHP 8.1 and I am also running into this:

ERROR ==> Exception: Extension '{'configuration': {}, 'name': u'redis'}' is unknown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working m1 Problems specific to arm64 support for Mac
Projects
None yet
Development

No branches or pull requests

5 participants