ddev / ddev-platformsh

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

Database type/version conflict on config->start->get #58

Open rfay opened 1 year ago

rfay commented 1 year ago

DDEV in recent versions checks on start and config to make sure the configured database type/version is the same as the actual database type (if one exists).

So if people create a project (or it already exists), perhaps with the default mariadb:10.4 type, and then do a ddev get and the .platform/services.yml provides a different type or version, then people get a fairly ugly message.

Failed to start WordPress-Composer-Template-Tester: Unable to start project WordPress-Composer-Template-Tester because the configured database type does not match the current actual database. Please change your database type back to mariadb:10.4 and start again, export, delete, and then change configuration and start. To get back to existing type use 'ddev config --database=mariadb:10.4' and then you might want to try 'ddev debug migrate-database mariadb:10.5', see docs at https://ddev.readthedocs.io/en/latest/users/extend/database_types/

Since that message is buried at the bottom of loads of incomprehensible complaints, it's annoying and difficult for a first-time user.

thewheat commented 1 year ago

I believe I ran into this issue as well

.services.yaml

db:
   type: mariadb:10.2
   disk: 2048
...

.ddev/config.yaml

...
database:
    type: mariadb
    version: "10.4"
...

I believe the workaroud is just to modify .ddev/config.yaml to the correct version as that is what the database config should be for https://ddev.readthedocs.io/en/latest/users/configuration/config/#database

And depending on what state the project is in, I needed to do a ddev delete as well.


I tried to replicate this again to get a clearer reproduction steps but am failing to get the error message but pasting my output that I had below and the steps that I did was as follows

$ ddev get drud/ddev-platformsh
Downloading https://api.github.com/repos/ddev/ddev-platformsh/tarball/v0.7.0 
v0.7.0_614027329.tar.gz 417.62 KiB / 417.62 KiB [=============================================================================================================================================] 100.00% 0s

Executing pre-install actions: 
πŸ‘ Checking DDEV version 
πŸ‘ Check for required tools base64, jq, perl 
Using existing PLATFORMSH_CLI_TOKEN.

πŸ‘ Setting PLATFORMSH_CLI_TOKEN 
Please enter your platform.sh project ID (like '6k4ypl5iendqd'):  
qqlugg2jush26
platform_project = 'qqlugg2jush26'
You are reconfiguring the project at ~/src/psh-test/php.
The existing configuration will be updated and replaced.
Configuring unrecognized codebase as project type 'php' at ~/src/psh-test/php/_www
Unable to configure project php with database type mariadb:10.2 because that database type does not match the current actual database. Please change your database type back to mariadb:10.2 and start again, export, delete, and then change configuration and start. To get back to existing type use 'ddev config --database=mariadb:10.2', and you can try a migration with 'ddev debug migrate-database mariadb:10.4' see docs at https://ddev.readthedocs.io/en/latest/users/extend/database-types/

πŸ‘Ž Set PLATFORM_PROJECT 
could not process pre-install action (5) 'Set PLATFORM_PROJECT'. For more detail use ddev get --verbose 

After modifying .ddev/config.yaml

ddev get drud/ddev-platformsh
Downloading https://api.github.com/repos/ddev/ddev-platformsh/tarball/v0.7.0 
v0.7.0_1881456197.tar.gz 417.62 KiB / 417.62 KiB [============================================================================================================================================] 100.00% 0s

Executing pre-install actions: 
πŸ‘ Checking DDEV version 
πŸ‘ Check for required tools base64, jq, perl 
Using existing PLATFORMSH_CLI_TOKEN.

πŸ‘ Setting PLATFORMSH_CLI_TOKEN 
Please enter your platform.sh project ID (like '6k4ypl5iendqd'):  
qqlugg2jush26
platform_project = 'qqlugg2jush26'
You are reconfiguring the project at ~/src/psh-test/php.
The existing configuration will be updated and replaced.
Configuring unrecognized codebase as project type 'php' at ~/src/psh-test/php/_www
Configuration complete. You may now run 'ddev start'.
PLATFORM_PROJECT set to qqlugg2jush26

πŸ‘ Set PLATFORM_PROJECT 
You are reconfiguring the project at ~/src/psh-test/php.
The existing configuration will be updated and replaced.
Configuring unrecognized codebase as project type 'php' at ~/src/psh-test/php/_www
Configuration complete. You may now run 'ddev start'.

πŸ‘ Setting PLATFORM_APPLICATION_NAME 
Please enter your platform.sh project environment (like 'main'):  
main
You are reconfiguring the project at ~/src/psh-test/php.
The existing configuration will be updated and replaced.
Configuring unrecognized codebase as project type 'php' at ~/src/psh-test/php/_www
Configuration complete. You may now run 'ddev start'.

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 -w 0

πŸ‘ Installing dependencies and generating needed environment variables 

Installed DDEV add-on drud/ddev-platformsh, use `ddev restart` to enable. 
Please read instructions for this addon at the source repo at
https://github.com/drud/ddev-platformsh
Please file issues and create pull requests there to improve it. 
rfay commented 1 year ago

If the database doesn't exist (if the project has never been started), there is nothing to do.

If the database already exists, then one can either ddev delete -Oy, which will destroy it to start out fresh, or migrate the database.

This is explained in the README notes