ddev / ddev-platformsh

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

Allow arbitrary database type derived from .platform.app, fixes #13 #14

Closed rfay closed 2 years ago

rfay commented 2 years ago

It turns out that services.yml/.platform.app can use any random value for the db section; it has to be derived from the arbitrary value used in .platform.app. See #13

rfay commented 2 years ago

Tested on mariadb, mysql, and postgres with the Drupal template, but nothing else. Could you please give this a try @lolautruche, ddev get https://github.com/platformsh/ddev-platformsh/tarball/20220623_arbitrary_db_header - you'll want to do a ddev pull platform for full testing as well.

lolautruche commented 2 years ago
$ ddev restart
Failed to get project(s): /Users/lolautruche/workspace/blackfire/bigfoot-symfony/.ddev/config.yaml exists but cannot be read. It may be invalid due to a syntax error.: unable to load config file /Users/lolautruche/workspace/blackfire/bigfoot-symfony/.ddev/config.platformsh.yaml: invalid configuration in /Users/lolautruche/workspace/blackfire/bigfoot-symfony/.ddev/config.yaml: yaml: line 15: mapping values are not allowed in this context

Generated config.platformsh.yaml:

# #ddev-generated
# Generated configuration based on platform.sh project configuration

php_version: 8.1
database:
  type: mariadb
  version: 10.4

docroot: public

  - exec: set -x -e&&&&symfony-deploy
rfay commented 2 years ago

Thanks @lolautruche - Please attach the .platform.app and .platform as zipball, thanks.

lolautruche commented 2 years ago

@rfay it's the same than for #13

rfay commented 2 years ago

Ah, this is not a composer build, and the hooks statement was embedded in composer.

      {{ if eq .platformapp.build.flavor "composer" }}
      hooks:
        post-start:
        - composer: install
      {{ end }}
rfay commented 2 years ago

Thanks, please try again, rm .ddev/config.platformsh.yaml && ddev get https://github.com/platformsh/ddev-platformsh/tarball/20220623_arbitrary_db_header

The symfony post-start hook will fail I'm sure. Of course I don't have that script, whatever it is, so if you can either tell me how to generate a platform project that has it or share yours with me I can take a look. I imagine it will depend on weird environment variables.

Here's what my generated config.platform.yaml looks like using your stuff:

# #ddev-generated
# Generated configuration based on platform.sh project configuration

php_version: 8.1
database:
  type: mariadb
  version: 10.4

docroot: public
hooks:
  post-start:

  - exec: 'set -x -e && symfony-deploy'
lolautruche commented 2 years ago

Mmm still having the same issue. Maybe a cache problem downloading the tarball?

lolautruche commented 2 years ago
# #ddev-generated
# Generated configuration based on platform.sh project configuration

php_version: 8.1
database:
  type: mariadb
  version: 10.4

docroot: public

  - exec: set -x -e&&&&symfony-deploy
rfay commented 2 years ago

Silly me. I committed but failed to push. Sorry. I've been trying to use the IDE for git operations after doing everything git on the command line for more than a decade, and it doesn't come easily.

lolautruche commented 2 years ago

It works 🎉 !

The post-start script does indeed fail on symfony-deploy, which was expected. This is because the build hook script in my .platform.app.yaml was not executed in the first place:

hooks:
    build: |
        set -x -e

        curl -s https://get.symfony.com/cloud/configurator | bash
        symfony-build
    deploy: |
        set -x -e

        symfony-deploy
rfay commented 2 years ago

Thanks - I'll need access to a project that has the different kinds of hooks, I hadn't been exposed to the others before. Opened https://github.com/platformsh/ddev-platformsh/issues/16 for this, and of course we'll need more env vars to make that work.

Is the one you're testing just a standard template-based site? What kind? If I can make one I will, or maybe you should give me access to yours? Whatever way works.