ddev / ddev-platformsh

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

Go template processing failing at install #13

Closed lolautruche closed 2 years ago

lolautruche commented 2 years ago

Using the latest HEAD version of DDEV, running ddev get platformsh/ddev-platformsh fails:

Error Details

template: processAction:10:84: executing "processAction" at <.services.dbmysql.type>: invalid value; expected string

Click to see the full error ``` could not process pre-install action '#ddev-nodisplay #todo: This simplistic approach doesn't work for postgres; volume name is different #and the database type file is different too if docker volume ls | grep ${DDEV_PROJECT}-mariadb; then export current_db_version="$(docker run --rm -w /db -v ${DDEV_PROJECT}-mariadb:/db busybox cat db_mariadb_version.txt)" if [ -z "${current_db_version}" ]; then echo "something went wrong, current_db_version is empty" && false fi export upstream_db="{{ regexReplaceAll "oracle-" (regexReplaceAll ":.*$" .services.dbmysql.type "") "" }}:{{ regexReplaceAll "^.*:" .services.dbmysql.type "" }}" echo "Current db is ${current_db_version/_/:} (${current_db_version})" echo "New db is ${upstream_db}" if [ "${current_db_version/_/:}" != "${upstream_db}" ]; then printf "There is an existing database in this project that doesn\'t match the upstream database type.\nPlease back up this database and then \"ddev delete\" so the new database can be created.\n" false else echo "database versions match: ${current_db_version/_/:}=${upstream_db}" fi fi ': could not parse/execute action 'set -eu -o pipefail #ddev-nodisplay #todo: This simplistic approach doesn't work for postgres; volume name is different #and the database type file is different too if docker volume ls | grep ${DDEV_PROJECT}-mariadb; then export current_db_version="$(docker run --rm -w /db -v ${DDEV_PROJECT}-mariadb:/db busybox cat db_mariadb_version.txt)" if [ -z "${current_db_version}" ]; then echo "something went wrong, current_db_version is empty" && false fi export upstream_db="{{ regexReplaceAll "oracle-" (regexReplaceAll ":.*$" .services.dbmysql.type "") "" }}:{{ regexReplaceAll "^.*:" .services.dbmysql.type "" }}" echo "Current db is ${current_db_version/_/:} (${current_db_version})" echo "New db is ${upstream_db}" if [ "${current_db_version/_/:}" != "${upstream_db}" ]; then printf "There is an existing database in this project that doesn\'t match the upstream database type.\nPlease back up this database and then \"ddev delete\" so the new database can be created.\n" false else echo "database versions match: ${current_db_version/_/:}=${upstream_db}" fi fi ': template: processAction:10:84: executing "processAction" at <.services.dbmysql.type>: invalid value; expected string ```

DDEV version info

{
  "level": "info",
  "raw": {
    "DDEV version": "vHEAD-ef00de8",
    "architecture": "arm64",
    "build info": "BUILDINFO should have new info",
    "db": "drud/ddev-dbserver-mariadb-10.3:v1.19.3",
    "dba": "phpmyadmin:5",
    "ddev-ssh-agent": "drud/ddev-ssh-agent:v1.19.0",
    "docker": "20.10.14",
    "docker-compose": "v2.5.1",
    "docker-platform": "docker-desktop",
    "mutagen": "0.14.0",
    "os": "darwin",
    "router": "drud/ddev-router:v1.19.3",
    "web": "drud/ddev-webserver:20220619_add_phpstorm_coverage_directory"
  },
  "time": "2022-06-23T10:35:05+02:00"
}

Platform files

platform_files.zip

rfay commented 2 years ago

Thanks so much! Please attach your .platform (zipball) and .platform.app.

lolautruche commented 2 years ago

@rfay I added them to the description

rfay commented 2 years ago

Shoot, your mariadb looks like this ("db"):

db:
    type: mariadb:10.4
    disk: 2048

whereas the one I was mostly working with was "dbmysql":

dbmysql:
    type: oracle-mysql:8.0
    disk: 2048

I see that postgres also has "db":

db:
  type: "postgresql:13"
  disk: 2048
rfay commented 2 years ago

It seems that in .platform.app the name of the database header is given in the name of the relationship:

relationships:
    database: 'dbmysql:mysql'

Completely useless behavior :(

I see that the key "dbmysql" is the key to what we're going to find in resources. I have no idea what the value "mysql" means. I guess we talked about this and maybe it means the name of the service. Seems that both mysql and mariadb have the value "mysql" and postgres has the value "postgresql".

lolautruche commented 2 years ago

The righthand side of the : is the "endpoint name", which can be ignored in our case AFAICT

lolautruche commented 2 years ago

This endpoint name is arbitrarily defined