Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add-on shouldn't use jq, base64, perl, etc without some notice or requirement #46

Closed
flovntp opened this issue Oct 27, 2022 · 9 comments

Comments

@flovntp
Copy link
Collaborator

flovntp commented Oct 27, 2022

Hi @rfay
i can't get my Symfony project to be configured using ddev addon.
This is what i get from the command line :

flovntp@VNTP-Book-2 PlatformSH % platform get 4qqp5j5vtvnom    
Selected environment: Main (main) (type: production) (by default)
Directory (default: sfcon-bigfoot-workshop): sfcon2022-workshop-ddev
Downloading project SFCon - Bigfoot - workshop (4qqp5j5vtvnom)
  Cloning into '/Users/flovntp/Sites/Customers/PlatformSH/sfcon2022-workshop-ddev'...
  remote: counting objects: 1710, done.        
Receiving objects: 100% (1710/1710), 3.64 MiB | 6.90 MiB/s, done.
  Resolving deltas: 100% (1014/1014), done.

The project SFCon - Bigfoot - workshop (4qqp5j5vtvnom) was successfully downloaded to: sfcon2022-workshop-ddev

You can build the project with: 
    cd sfcon2022-workshop-ddev
    platform build
flovntp@VNTP-Book-2 PlatformSH % cd sfcon2022-workshop-ddev 
flovntp@VNTP-Book-2 sfcon2022-workshop-ddev % ddev start 
Failed to get project(s): could not find a project in /Users/flovntp/Sites/Customers/PlatformSH/sfcon2022-workshop-ddev. Have you run 'ddev config'? Please specify a project name or change directories: no .ddev/config.yaml file was found in this directory or any parent
flovntp@VNTP-Book-2 sfcon2022-workshop-ddev % ddev get platformsh/ddev-platformsh
Unable to get project(s) [platformsh/ddev-platformsh]: could not find a project in /Users/flovntp/Sites/Customers/PlatformSH/sfcon2022-workshop-ddev. Have you run 'ddev config'? Please specify a project name or change directories: no .ddev/config.yaml file was found in this directory or any parent

Let me know if you need me to grant you access to this project, it's the SFCon workshop that we will handle with Sylvain.

note: ddev start is just a fail try, to be sure that ddev can't start as it is.

@flovntp
Copy link
Collaborator Author

flovntp commented Oct 27, 2022

Hi @rfay
thanks to @lolautruche, i understand what i was missing and maybe i misunderstood the starting point of this addon, which is : "having a project already configure for using ddev (aka. ddev config already executed)"
and the addon permit to copy/duplicate the existing PSH provisioning".

So, if i recap :

  • first step is to download PSH project, using platform get <IDProject>
  • run ddev config
  • then we can use the command ddev get platformsh/ddev-platformsh and it will read PSH provisioning and create docker containers.

so, as a suggestion, maybe next steps for this addons should/could be :

  • if ddev get platformsh/ddev-platformsh and there is no config.yaml file --> ask to user if we need to execute it?
  • if config.yaml exists but no sources exists in the current folder (no .platform.app.yaml file) --> ask the user to download the project using platform get <ProjectID> (or ideally, ddev run it for him with: PSH login, then user choose a project in the list of existing PSH projects and run platform get <choosenProjectId))...

My 2 cents

ps: you can close the issue :P

@flovntp
Copy link
Collaborator Author

flovntp commented Oct 27, 2022

ok,
so now, my Symfony project seems to be configured but with an error at the end, while getting DATABASE infos

flovntp@VNTP-Book-2 sfcon2022-workshop-ddev % ddev get platformsh/ddev-platformsh
Downloading https://api.github.com/repos/platformsh/ddev-platformsh/tarball/v0.4.3 
v0.4.3_3495880585.tar.gz 96.44 KiB / ? [------------------------------------------------=------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------] 987.51% 0s 
Please enter your platform.sh token:  
XXXXXXXXX-XXXX-XXXX-XXXX-XXXXdbd638
Global configuration:
instrumentation-opt-in=true
omit-containers=[]
web-environment=[BLACKFIRE_CLIENT_ID=XXXX,BLACKFIRE_CLIENT_TOKEN=XXXX,BLACKFIRE_SERVER_ID=XXXX,BLACKFIRE_SERVER_TOKEN=XXXX,PLATFORMSH_CLI_TOKEN=XXXXXXXXX-XXXX-XXXX-XXXX-XXXXdbd638]
mutagen-enabled=false
nfs-mount-enabled=false
router-bind-all-interfaces=false
internet-detection-timeout-ms=3000
disable-http2=false
use-letsencrypt=false
letsencrypt-email=
table-style=default
simple-formatting=false
auto-restart-containers=false
use-hardened-images=false
fail-on-hook-fail=false
required-docker-compose-version=
use-docker-compose-from-path=false
no-bind-mounts=false
project-tld=
PLATFORMSH_CLI_TOKEN set globally
 
Please enter your platform.sh project ID (like '6k4ypl5iendqd'):  
4qqp5j5vtvnom

platform_project = '4qqp5j5vtvnom'
You are reconfiguring the project at /Users/flovntp/Sites/Customers/PlatformSH/sfcon2022-workshop-ddev.
The existing configuration will be updated and replaced.
Configuring unrecognized codebase as project type 'php' at /Users/flovntp/Sites/Customers/PlatformSH/sfcon2022-workshop-ddev/_www
v1.21.3: Pulling from drud/ddev-webserver
e54debc59c92: Pulling fs layer
e54debc59c92: Download complete
e54debc59c92: Pull complete
Digest: sha256:XXXXXXXXX
Status: Downloaded newer image for drud/ddev-webserver:v1.21.3
docker.io/drud/ddev-webserver:v1.21.3
Configuration complete. You may now run 'ddev start'.
PLATFORM_PROJECT set to 4qqp5j5vtvnom
 
You are reconfiguring the project at /Users/flovntp/Sites/Customers/PlatformSH/sfcon2022-workshop-ddev.
The existing configuration will be updated and replaced.
Configuring unrecognized codebase as project type 'php' at /Users/flovntp/Sites/Customers/PlatformSH/sfcon2022-workshop-ddev/_www
Configuration complete. You may now run 'ddev start'.
 
Please enter your platform.sh project environment (like 'main'):  
You are reconfiguring the project at /Users/flovntp/Sites/Customers/PlatformSH/sfcon2022-workshop-ddev.
The existing configuration will be updated and replaced.
Configuring unrecognized codebase as project type 'php' at /Users/flovntp/Sites/Customers/PlatformSH/sfcon2022-workshop-ddev/_www
Configuration complete. You may now run 'ddev start'.
 
Installed file /Users/flovntp/Sites/Customers/PlatformSH/sfcon2022-workshop-ddev/.ddev/web-build/Dockerfile.platformsh 
Installed file /Users/flovntp/Sites/Customers/PlatformSH/sfcon2022-workshop-ddev/.ddev/homeadditions/.bashrc.d/platformsh-environment.sh 
Installed file /Users/flovntp/Sites/Customers/PlatformSH/sfcon2022-workshop-ddev/.ddev/providers/platform.yaml 
Installed file /Users/flovntp/.ddev/commands/web/platform 
could not process post-install action '#ddev-nodisplay
cd ..
unset DDEV_DEBUG
project_type=$(ddev describe -j | jq -r .raw.type)
case $project_type in 
  laravel)
    # TODO: This depends on perl, but we can't start the project unless these are created
    # so can't use ddev exec yet. 
    perl -p -e 's/DB_(HOST|DATABASE|USERNAME|PASSWORD)=(.*)/DB_\1=db/g' .env.example >.env
    perl -pi.bak -e "s#APP_URL=.*#APP_URL=${DDEV_PRIMARY_URL}#g" .env
    ;;
  drupal9)
    mkdir -p .drush
    ;;
esac
': Unable to run action set -eu -o pipefail
#ddev-nodisplay
cd ..
unset DDEV_DEBUG
project_type=$(ddev describe -j | jq -r .raw.type)
case $project_type in 
  laravel)
    # TODO: This depends on perl, but we can't start the project unless these are created
    # so can't use ddev exec yet. 
    perl -p -e 's/DB_(HOST|DATABASE|USERNAME|PASSWORD)=(.*)/DB_\1=db/g' .env.example >.env
    perl -pi.bak -e "s#APP_URL=.*#APP_URL=${DDEV_PRIMARY_URL}#g" .env
    ;;
  drupal9)
    mkdir -p .drush
    ;;
esac
: exit status 127, output=bash: line 4: jq: command not found

So i guess it is the step where you try to find in the environment variable, all info about DATABASE_* ?
Let me know, i could help on this part.

@lolautruche
Copy link
Contributor

It's probably because you don't have jq locally. Can you please try to install it?
brew install jq

@flovntp
Copy link
Collaborator Author

flovntp commented Oct 27, 2022

you're right, now it's fine :

... 
Installed file /Users/flovntp/.ddev/commands/web/platform 
Downloaded add-on platformsh/ddev-platformsh, use `ddev restart` to enable. 
Please read instructions for this addon at the source repo at
https://github.com/platformsh/ddev-platformsh
Please file issues and create pull requests there to improve it. 

@lolautruche
Copy link
Contributor

However, I didn't know that DDEV required jq, and if so, it should be marked as a dependency in the Homebrew formula. Did you install it (DDEV itself) with Homebrew or using another way?

@flovntp
Copy link
Collaborator Author

flovntp commented Oct 27, 2022

homebrew

@lolautruche
Copy link
Contributor

Could you please report an issue about this on DDEV Homebrew tap?
https://github.com/drud/homebrew-ddev/issues

@rfay
Copy link
Member

rfay commented Oct 27, 2022

I didn't think there was anything in the current release of this add-on that required jq, but there is.

There's nothing about ddev that requires jq, it's just that this add-on uses it one place. That's a mistake. So no need to fiddle with homebrew tap

@rfay rfay changed the title Symfony Project : can't "ddevify" it Add-on shouldn't use jq without some notice or requirement Oct 27, 2022
@rfay rfay changed the title Add-on shouldn't use jq without some notice or requirement Add-on shouldn't use jq, base64, etc without some notice or requirement Oct 28, 2022
@rfay
Copy link
Member

rfay commented Nov 9, 2022

This is important to solve, both because we don't want to depend on user configuration, but also because base64, for example, behaves differently on macOS than on Linux. So we'll need a small docker image or something.

@rfay rfay changed the title Add-on shouldn't use jq, base64, etc without some notice or requirement Add-on shouldn't use jq, base64, perl, etc without some notice or requirement Dec 1, 2022
rfay added a commit to rfay/ddev-platformsh that referenced this issue Dec 9, 2022
lolautruche added a commit to lolautruche/ddev-platformsh that referenced this issue Dec 12, 2022
@rfay rfay closed this as completed in 3c3d5e9 Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants