gitpod-io / gitpod

The developer platform for on-demand cloud development environments to create software faster and more securely.
https://www.gitpod.io
GNU Affero General Public License v3.0
12.81k stars 1.23k forks source link

Gitpod ports await look also is the service available #13802

Open shyim opened 2 years ago

shyim commented 2 years ago

Is your feature request related to a problem? Please describe

When you start a MySQL server in Docker and you want to execute a MySQL command directly it's annoying as you have to wait for the right moment where the server is available

With gp ports await 3306 you get notified when the port is reachable. But port reachable is not the same as useable. You get then weird errors like `MySQL server has gone away'.

Describe the behaviour you'd like

Add an --type mysql to the command to try to connect to the MySQL server instead of just looking is the port open

Describe alternatives you've considered

until mysqladmin ping; do
          sleep 1
done

Works but for DX it would be better I guess when it would be easier to do that

Additional context

I would like to implement that also

Originally asked at Discord.

mustard-mh commented 1 year ago

Hey @shyim , you can use https://github.com/atkrad/wait4x instead now. (I used it before, and worked well)

You can put it inside dotfile if you use it everywhere

shyim commented 1 year ago

Do we want to install that, maybe by default into the workspace? Maybe we could also just import that package and call it in the gp of gitpod if the license allows that

mustard-mh commented 1 year ago

@loujaybee upvote to bring it in gp-cli

akosyakov commented 1 year ago

Where you will draw a line what should be built in and what should be on the top? Should we support each service out there via providing basic building blocks and let users to build on the top? Without a criteria we will simply bloat the cli.

akosyakov commented 1 year ago

We could consider for instance different design via .gitpod.yml:

- ports:
  - port: 3306
    probe: 
      cmd: mysqladmin ping;
shyim commented 1 year ago

In my case I used Docker. Maybe just wait for the health check of the docker container? So it's more generic solution?

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.