ddev / ddev-platformsh

Add integration with Platform.sh hosting service
Apache License 2.0
9 stars 10 forks source link

interface conversion: interface {} is bool, not string #94

Closed BenEdgeContra closed 1 year ago

BenEdgeContra commented 1 year ago

When running: $ ddev get drud/ddev-platformsh I am getting the error:

Downloading https://api.github.com/repos/drud/ddev-platformsh/tarball/v0.6.4
v0.6.4_3935110338.tar.gz 99.83 KiB / 99.83 KiB [==============================================================================] 100.00% 0s
panic: interface conversion: interface {} is bool, not string

goroutine 1 [running]:
github.com/drud/ddev/pkg/util.YamlToDict({0x104ea6e40?, 0x1400007a870?})
    /home/runner/work/ddev/ddev/pkg/util/yamltools.go:33 +0x510
github.com/drud/ddev/pkg/util.YamlToDict({0x104ea6e40?, 0x1400007a630?})
    /home/runner/work/ddev/ddev/pkg/util/yamltools.go:38 +0x39c
github.com/drud/ddev/pkg/util.YamlToDict({0x104ea8a60?, 0x1400007a450?})
    /home/runner/work/ddev/ddev/pkg/util/yamltools.go:58 +0x6d4
github.com/drud/ddev/pkg/util.YamlToDict({0x104ea8a60?, 0x1400007a3f0?})
    /home/runner/work/ddev/ddev/pkg/util/yamltools.go:60 +0x61c
github.com/drud/ddev/cmd/ddev/cmd.glob..func29(0x1052e17a0?, {0x140000bc260?, 0x1, 0x2})
    /home/runner/work/ddev/ddev/cmd/ddev/cmd/get.go:190 +0xe48
github.com/spf13/cobra.(*Command).execute(0x1052e17a0, {0x140000bc240, 0x2, 0x2})
    /home/runner/work/ddev/ddev/vendor/github.com/spf13/cobra/command.go:860 +0x4ac
github.com/spf13/cobra.(*Command).ExecuteC(0x1052e4ea0)
    /home/runner/work/ddev/ddev/vendor/github.com/spf13/cobra/command.go:974 +0x354
github.com/spf13/cobra.(*Command).Execute(...)
    /home/runner/work/ddev/ddev/vendor/github.com/spf13/cobra/command.go:902
github.com/drud/ddev/cmd/ddev/cmd.Execute()
    /home/runner/work/ddev/ddev/cmd/ddev/cmd/root.go:143 +0x40
main.main()
    /home/runner/work/ddev/ddev/cmd/ddev/main.go:20 +0xac
lolautruche commented 1 year ago

Hi @BenEdgeContra and thank you for reporting this! This issue has been reported to the DDEV repository:

rfay commented 1 year ago

But @BenEdgeContra would you be willing to share you .platform.app.yaml to confirm that it's the exact same thing?

rfay commented 1 year ago

I'm pretty sure this is all fixed in

Closing this as duplicate, but would still love to test it against your .platform.app.yaml

rfay commented 1 year ago

And if you're willing to test that PR the artifacts/binaries are at https://github.com/drud/ddev/pull/4581#issuecomment-1405264524

BenEdgeContra commented 1 year ago

Thanks... Here it is:

# 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: 'drupal'

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

dependencies:
    php:
        composer/composer: '^2'
    nodejs:
        n: "*"

runtime:
    # Enable the redis extension so Drupal can communicate with the Redis cache.
    extensions:
        - redis
        - sodium
        - apcu

# 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: 17408

# 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'

variables:
    env:
        N_PREFIX: /app/.global

# Configuration of the build of this application.
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
        $PLATFORM_APP_DIR/platformsh_build.sh
    # 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
        $PLATFORM_APP_DIR/platformsh_deploy.sh

# 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: 4h

            # 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: 4h
            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 * * * *'
        commands: 
            start: 'cd web ; drush core-cron'
    snapshot:
        spec: '0 5 * * *'
        cmd: |
            if [ "$PLATFORM_BRANCH" = master ]; then
                platform snapshot:create --yes --no-wait
            fi

source:
  operations:
    auto-update:
      command: |
        curl -fsS https://raw.githubusercontent.com/platformsh/source-operations/main/setup.sh | { bash /dev/fd/3 sop-autoupdate; } 3<&0
rfay commented 1 year ago

Thanks, yeah it's

    nodejs:
        n: "*"

Apparently 'n' in yaml once meant false, and that's what was going on here. If you're interested in trying out the fix, there are artifacts at https://github.com/drud/ddev/pull/4581#issuecomment-1405264524 - And you can probably try changing it to "n": "*" as another option.