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

Platform.sh install fails #44

Open
pjoulot opened this issue Nov 10, 2020 · 5 comments
Open

Platform.sh install fails #44

pjoulot opened this issue Nov 10, 2020 · 5 comments

Comments

@pjoulot
Copy link

pjoulot commented Nov 10, 2020

Hello,

  1. Setup a website using platform.sh by following the steps:
    https://docs.lando.dev/config/platformsh.html#getting-started

My .lando.yml is very basic

name: mywebsite
recipe: platformsh
config:
  id: myid
  1. After lando init and lando start. Everything seems to have been ok in the console, but it seems it actually didn't. If you go to the URL, the website has a fatal error. The error doesn't even seem to show in the logs. But you can see previous errors than seemed to happen during the generation of the nginx config. The error seems to happen in platformsh-prepare.
app_1    | 2020-11-10 03:39:53,727 platformsh.agent.service ERROR Unable to render template /etc/nginx/nginx.conf: 
app_1    | 
app_1    | Traceback (most recent call last):
app_1    |   File "/usr/lib/python2.7/dist-packages/platformsh/agent/service.py", line 379, in generate_config_files
app_1    |     safe_write(path, template.render(**self.config), mode=output_mode)
app_1    |   File "/usr/lib/python2.7/dist-packages/mako/template.py", line 462, in render
app_1    |     return runtime._render(self, self.callable_, args, data)
app_1    |   File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 838, in _render
app_1    |     **_kwargs_for_callable(callable_, data))
app_1    |   File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 873, in _render_context
app_1    |     _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
app_1    |   File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 899, in _exec_template
app_1    |     callable_(context, *args, **kwargs)
app_1    |   File "/etc/nginx/nginx.conf.psh-tmpl", line 0, in render_body
app_1    |     
app_1    | NameError: 'nginx' is not defined
app_1    | Traceback (most recent call last):
app_1    |   File "/usr/lib/python2.7/dist-packages/platformsh/agent/service.py", line 379, in generate_config_files
app_1    |     safe_write(path, template.render(**self.config), mode=output_mode)
app_1    |   File "/usr/lib/python2.7/dist-packages/mako/template.py", line 462, in render
app_1    |     return runtime._render(self, self.callable_, args, data)
app_1    |   File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 838, in _render
app_1    |     **_kwargs_for_callable(callable_, data))
app_1    |   File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 873, in _render_context
app_1    |     _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
app_1    |   File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 899, in _exec_template
app_1    |     callable_(context, *args, **kwargs)
app_1    |   File "_etc_nginx_nginx_conf_psh_tmpl", line 113, in render_body
app_1    | NameError: 'nginx' is not defined
app_1    | 2020-11-10 03:39:53,752 platformsh.agent.service ERROR Unable to render template /etc/php/7.4-zts/fpm/php-fpm.conf: 
app_1    | 
app_1    | Traceback (most recent call last):
app_1    |   File "/usr/lib/python2.7/dist-packages/platformsh/agent/service.py", line 379, in generate_config_files
app_1    |     safe_write(path, template.render(**self.config), mode=output_mode)
app_1    |   File "/usr/lib/python2.7/dist-packages/mako/template.py", line 462, in render
app_1    |     return runtime._render(self, self.callable_, args, data)
app_1    |   File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 838, in _render
app_1    |     **_kwargs_for_callable(callable_, data))
app_1    |   File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 873, in _render_context
app_1    |     _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
app_1    |   File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 899, in _exec_template
app_1    |     callable_(context, *args, **kwargs)
app_1    |   File "/etc/php/7.4-zts/fpm/php-fpm.conf.psh-tmpl", line 0, in render_body
app_1    |     
app_1    | NameError: 'workers' is not defined
app_1    | Traceback (most recent call last):
app_1    |   File "/usr/lib/python2.7/dist-packages/platformsh/agent/service.py", line 379, in generate_config_files
app_1    |     safe_write(path, template.render(**self.config), mode=output_mode)
app_1    |   File "/usr/lib/python2.7/dist-packages/mako/template.py", line 462, in render
app_1    |     return runtime._render(self, self.callable_, args, data)
app_1    |   File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 838, in _render
app_1    |     **_kwargs_for_callable(callable_, data))
app_1    |   File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 873, in _render_context
app_1    |     _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
app_1    |   File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 899, in _exec_template
app_1    |     callable_(context, *args, **kwargs)
app_1    |   File "_etc_php_7_4_zts_fpm_php_fpm_conf_psh_tmpl", line 23, in render_body

My setup:

  • Ubuntu 18.04
  • Lando v3.0.18

My local database doesn't seem to work as well. If I run lando database.

lando database ERROR 2002 (HY000): Can't connect to MySQL server on 'db' (115)

I also put the .platform.app.yml which could maybe help.

# This file describes an application. You can have multiple applications
# in the same project.
#
# See https://docs.platform.sh/configuration/app.html

# The name of this app. Must be unique within a project.
name: 'app'

# The runtime the application uses.
type: 'php:7.4'

runtime:
    # Enable the redis extension so Drupal can communicate with the Redis cache.
    extensions:
        - redis
# The relationships of the application with services or other applications.
#
# The left-hand side is the name of the relationship as it will be exposed
# to the application in the PLATFORM_RELATIONSHIPS variable. The right-hand
# side is in the form `<service name>:<endpoint name>`.
relationships:
    database: 'db:mysql'
    redis: 'cache:redis'

# The size of the persistent disk of the application (in MB).
disk: 14336

# The 'mounts' describe writable, persistent filesystem mounts in the application.
mounts:
    # The default Drupal files directory.
    '/web/sites/default/files':
        source: local
        source_path: 'files'
    # Drupal gets its own dedicated tmp directory. The settings.platformsh.php
    # file will automatically configure Drupal to use this directory.
    '/tmp':
        source: local
        source_path: 'tmp'
    # Private file uploads are stored outside the web root. The settings.platformsh.php
    # file will automatically configure Drupal to use this directory.
    '/private':
        source: local
        source_path: 'private'
    # Drush needs a scratch space for its own caches.
    '/.drush':
        source: local
        source_path: 'drush'
    # Drush will try to save backups to this directory, so it must be
    # writeable even though you will almost never need to use it.
    '/drush-backups':
        source: local
        source_path: 'drush-backups'
    # Drupal Console will try to save backups to this directory, so it must be
    # writeable even though you will almost never need to use it.
    '/.console':
        source: local
        source_path: 'console'

# Configuration of the build of this application.
build:
    # Automatically run `composer install` on every build.
    flavor: composer

# The hooks executed at various points in the lifecycle of the application.
hooks:
    # The build hook runs after Composer to finish preparing up your code.
    # No services are available but the disk is writeable.
    build: |
        set -e
    # The deploy hook runs after your application has been deployed and started.
    # Code cannot be modified at this point but the database is available.
    # The site is not accepting requests while this script runs so keep it
    # fast.
    deploy: |
        set -e
        php ./drush/platformsh_generate_drush_yml.php
        cd web
        drush -y cache-rebuild
        drush -y updatedb

# The configuration of app when it is exposed to the web.
web:
    locations:
        # All requests not otherwise specified follow these rules.
        '/':
            # The folder from which to serve static assets, for this location.
            #
            # This is a filesystem path, relative to the application root.
            root: 'web'

            # How long to allow static assets from this location to be cached.
            #
            # Can be a time in seconds, or -1 for no caching. Times can be
            # suffixed with "s" (seconds), "m" (minutes), "h" (hours), "d"
            # (days), "w" (weeks), "M" (months, as 30 days) or "y" (years, as
            # 365 days).
            expires: 5m

            # Redirect any incoming request to Drupal's front controller.
            passthru: '/index.php'

            # Deny access to all static files, except those specifically allowed below.
            allow: false

            # Rules for specific URI patterns.
            rules:
                # Allow access to common static files.
                '\.(jpe?g|png|gif|svgz?|css|js|map|ico|bmp|eot|woff2?|otf|ttf)$':
                    allow: true
                '^/robots\.txt$':
                    allow: true
                '^/sitemap\.xml$':
                    allow: true

                # Deny direct access to configuration files.
                '^/sites/sites\.php$':
                    scripts: false
                '^/sites/[^/]+/settings.*?\.php$':
                    scripts: false

        # The files directory has its own special configuration rules.
        '/sites/default/files':
            # Allow access to all files in the public files directory.
            allow: true
            expires: 5m
            passthru: '/index.php'
            root: 'web/sites/default/files'

            # Do not execute PHP scripts from the writeable mount.
            scripts: false

            rules:
                # Provide a longer TTL (2 weeks) for aggregated CSS and JS files.
                '^/sites/default/files/(css|js)':
                    expires: 2w

crons:
    # Run Drupal's cron tasks every 19 minutes.
    drupal:
        spec: '*/19 * * * *'
        cmd: 'cd web ; drush core-cron'
@dustinleblanc
Copy link

Spinning up the Drupal 9 template from Platform I am able to reproduce an initial error, but running lando drush cr twice in a row brings the site back up.

THe error only showed up for me after the installer ran.

@AndreB-bot
Copy link

Was this ever resolved? I'm having the same issues.

@kwiechmann
Copy link

kwiechmann commented May 18, 2021

Any additional thoughts? Getting a similar issue with a different (and older) target environment when trying to clone a working Platform.sh instance to my local for development.

  • Drupal Core 7.67
  • PHP 7.2
  • Lando v3.1.4
  • Platform.sh CLI 3.66.0

Based on the error, have been leaning towards a permissions issue.

@JimmyHowe
Copy link

Getting same error, any more information on this?

@pjoulot
Copy link
Author

pjoulot commented Aug 31, 2022

I could solve the issue by editing my .platform/services.yaml and upgrading mariadb to 10.5

But using mariadb 10.4 is breaking the database connection for some reason.

db:
type: mariadb:10.5
disk: 2048

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants