ddev / ddev-gitpod-launcher

Launch any DDEV project with Gitpod
https://ddev.github.io/ddev-gitpod-launcher/
Apache License 2.0
12 stars 8 forks source link

Add my own script after launch #21

Closed MisterH001 closed 2 years ago

MisterH001 commented 2 years ago

Hi Randy I was wondering if it is possible to add something to my repo (ideally a bash script) which will be automatically run on start/launch - while still using your launcher UI? This is so I can run a bash script to update the base urls for a Magento 2 project. Thank you!

rfay commented 2 years ago

How about a pre-start exec-host hook that runs the script (or does the job itself?)

MisterH001 commented 2 years ago

Thanks Randy, that's a great idea. So would I just create an empty .ddev folder with a basic config.yaml file that would only contain that info? e.g.:

hooks:
  post-start:
    - exec: "simple command expression"
    - exec: "ls >/dev/null && touch /var/www/html/somefile.txt"
    - exec-host: "simple command expression"
  post-import-db:
    - exec: "drush uli"

Would that conflict with the automatically generated .ddev/config.yaml file? Thanks!

rfay commented 2 years ago

Don't forget that you can do anything you want with your own project. When you're working with a project that is already configured you don't need to use the launcher at all. Item 1 in https://ddev.readthedocs.io/en/latest/users/topics/gitpod/ gives this alternative.

But I would expect that your new config.yaml would work out fine and not conflict. But if I were working with a project that I already knew I wanted to use on gitpod, I'd just add a minor .gitpod.yml (very minor) and configure it to do what I wanted.

Note that most teams check in the .ddev file anyway.

MisterH001 commented 2 years ago

Thanks Randy I think I'm nearly there now. But one issue I have is that the web url (e.g. https://8080-drud-ddevgitpodlaunch-1234345565.ws-eu51.gitpod.io/ when visited redirects back to the workspace url (https://drud-ddevgitpodlaunch-1234345565.ws-eu51.gitpod.io/) (it strips the "8080-" port part off) Have you seen this before? Thanks!

MisterH001 commented 2 years ago

Please ignore me! I was adding the Magento 2 url in the db without the 8080- prefix. I corrected this and now it is working. :-) Thanks!

rfay commented 2 years ago

Yay, glad it's working for you. I'll close this, but happy to continue the conversation here or elsewhere.