ddev / ddev-platformsh

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

ddev get ddev/ddev-platformsh ends with Syntax Error (Ibexa) #107

Closed ibexa-yuna closed 1 year ago

ibexa-yuna commented 1 year ago

Hi,

I'm using my project that's already running on Platform.sh. This is my .platform.app.yaml.

The error I'm getting is:

$ ddev get ddev/ddev-platformsh

Installing project-level components: 
👍 web-build/Dockerfile.platformsh 
👍 homeadditions/.bashrc.d/platformsh-environment.sh 
👍 platformsh/.gitignore 
👍 platformsh/generate_db_relationship.sh 
👍 platformsh/generate_elasticsearch_relationship.sh 
👍 platformsh/generate_memcached_relationship.sh 
👍 platformsh/generate_redis_relationship.sh 

Installing global components: 
👍 commands/web/platform 

Executing post-install actions: 
👍 Support composer and python3 dependencies 
👍  Install .environment file into web-entrypoint.d if needed 
BASE64_ENCODE=base64
Running 'ddev get ddev/ddev-redis'
Downloading https://api.github.com/repos/ddev/ddev-redis/tarball/v1.0.5
v1.0.5_4220337423.tar.gz 7.93 KiB / ? [------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------=---]  81.24% 0s 

Installing project-level components:
👍 docker-compose.redis.yaml
👍 redis/scripts/settings.ddev.redis.php
👍 redis/scripts/setup-drupal-settings.sh
👍 redis/redis.conf
👍 commands/redis/redis-cli

Executing post-install actions:
👍 Install redis settings for Drupal 9+ if applicable

Installed DDEV add-on ddev/ddev-redis, use `ddev restart` to enable.
Please read instructions for this addon at the source repo at
https://github.com/ddev/ddev-redis
Please file issues and create pull requests there to improve it.
bash: -c: line 105: syntax error near unexpected token `]]'

👎 Installing dependencies and generating needed environment variables 
could not process post-install action (3) 'Installing dependencies and generating needed environment variables' 

If I try installing ddev-redis manually it's installing without a problem, which leads me to believe that the problem is in ddev-platformsh.

If I run the installation with -v then I can see definitely something wrong with bash in regards to schema.xml:

  # echo service_def=map[configuration:map[configsets:map[mainconfig:configsets/solr6] cores:map[collection1:map[core_properties:configSet=mainconfig
schema=schema.xml
]] endpoints:map[collection1:map[core:collection1]]] disk:412 fulltype:solr:7.7 type:solr version:7.7]

This schema.xml reference is coming from my services.yaml.

Steps to reproduce:

  1. Install Ibexa DXP on Platform.sh (OSS version should be fine) with SOLR configuration from Commerce edition. https://github.com/ibexa/post-install/tree/4.4/resources/platformsh/ibexa-commerce/4.4/.platform
  2. Clone to local
  3. Run ddev get ddev/ddev-platform.sh, answer script questions, observe the error
rfay commented 1 year ago

Thanks for reporting this!

rfay commented 1 year ago

The only place I can find that uses the newer bash syntax [[ and ]] is in ddev-redis; it's not used in ddev-platformsh:

if [[ $DDEV_PROJECT_TYPE != drupal* ]] || [[ $DDEV_PROJECT_TYPE =~ ^drupal(6|7)$ ]] ;
then
  exit 0
fi

https://github.com/ddev/ddev-redis/blob/29151def441a5a5d3a1deb92516dd612d8e2d463/redis/scripts/setup-drupal-settings.sh#L5

And I haven't figured out why that would fail, but I can recreate your situation.

ibexa-yuna commented 1 year ago

I was able to track and "fix" it, looks like it's a problem of data sanitation during output:

https://github.com/ibexa-yuna/ddev-platformsh/commit/c8951cf3462a9446e2de4ae5aacd28ff0e0b7560

rfay commented 1 year ago

Just removing a comment fixes it? And then... why does this work so many other places and not with your .platform.app.yaml. I think we've on the verge of finding out!

PR is welcome! Also, we could add the ibexa type to tests if you'd like.

ibexa-yuna commented 1 year ago

not with your .platform.app.yaml

Due to: https://github.com/ibexa/post-install/blob/main/resources/platformsh/ibexa-commerce/4.6/.platform/services.yaml#L60-L73

SOLR p.sh service requires some multiline input string as parameters, which is what we can see during the error:

# echo service_def=map[configuration:map[configsets:map[mainconfig:configsets/solr6] cores:map[collection1:map[core_properties:configSet=mainconfig
schema=schema.xml
]] endpoints:map[collection1:map[core:collection1]]] disk:412 fulltype:solr:7.7 type:solr version:7.7]
ibexa-yuna commented 1 year ago

Hey @rfay

Would you like me to submit a PR or this is something that can be fixed on your end in a more elegant way, than just cutting comments out?

rfay commented 1 year ago

A PR removing the "comment" would be fine, or fixing the comment would be fine as well. If you're able to provide a trivial example that breaks this that would be helpful as well.

IIRC the "comment" is actually documentation in the generated config, so it only appears to be a comment in this context. But I'm also sure we can live without it.

Thanks so much!

ibexa-yuna commented 1 year ago

Hi Randy,

I've created a PR for this: https://github.com/ddev/ddev-platformsh/pull/108

rfay commented 1 year ago

Thanks!