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

workspace-mysql slows down bash startup, hence .gitpod.yml task execution #946

Open
axonasif opened this issue Oct 11, 2022 · 3 comments
Open
Labels

Comments

@axonasif
Copy link
Member

Bug description

.gitpod.yml task(s) shell-commands starts to execute very late. Some .bashrc.d script that is included with tool-mysql chunk is probably slowing it down.

Steps to reproduce

  • Use the following .gitpod.yml contents:
image: gitpod/workspace-mysql:latest

tasks:
  - name: tailscaled
    command: |
      if [ -n "${TAILSCALE_STATE_GITPOD_TESTREPO}" ]; then
        # restore the tailscale state from gitpod user's env vars
        sudo mkdir -p /var/lib/tailscale
        echo "${TAILSCALE_STATE_GITPOD_TESTREPO}" | sudo tee /var/lib/tailscale/tailscaled.state > /dev/null
      fi
      sudo tailscaled
- name: tailscale
    command: |
      if [ -n "${TAILSCALE_STATE_GITPOD_TESTREPO}" ]; then
        sudo -E tailscale up
      else
        sudo -E tailscale up --hostname "gitpod-${GITPOD_GIT_USER_NAME// /-}-$(echo ${GITPOD_WORKSPACE_CONTEXT} | jq -r .repository.name)"
        # store the tailscale state into gitpod user
        gp env TAILSCALE_STATE_GITPOD_TESTREPO="$(sudo cat /var/lib/tailscale/tailscaled.state)"
      fi
- name: Start application
    before: |
      if [ ! -f ".env" ]; then
        cp .env.gitpod .env
      fi
init: |
      eval $(gp env -e)
      npm install
command: |
      API_BASE_URL=3000-$GITPOD_WORKSPACE_ID.$GITPOD_WORKSPACE_CLUSTER_HOST npm run start:dev
  • Observe that the task(s) shell-commands are being executed late.

Expected behavior

  • bash shell startup should be fast.

Example repository

Open in Gitpod: https://gitlab.com/damiendawreck/gitpod-testrepo/-/commit/c6c02421f74b6a7d880e61901bae959ec57c79b6

Anything else?

@damieneichhorn
Copy link

Clarification to the actual bug:
If everything started a little slower, it wouldn't be a problem, but it is unpredictable which tasks start slower and which don't.
For instance with tailscale, the tailscale up command might run, while the tailscale daemon hasn't started yet, causing the tailscale up command to fail.
Same as with an application that uses tailscale status to get an ip. When the application runs before tailscale has initialized, it will fail to do tailscale status.

@damieneichhorn
Copy link

damieneichhorn commented Oct 12, 2022

A thought that I just got, could it be due to the fact that it tries to initialize the mysql daemon in all the task terminals? causing it to succeed in one, but retrying it in the other, until it fails?

In this screenshot, I had two bash terminals open up. The first one was relatively quick, but the second one took quite a while before showing those last 4 lines.

@axonasif

Screenshot 2022-10-12 at 15 40 32

@shyim
Copy link
Contributor

shyim commented Oct 29, 2022

I always start mysql using docker. Is there any reason why this must be embedded into that base image? 🤔
Works also with prebuilds just have to call docker ps to wake up docker daemon after prebuilt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: No status
Development

No branches or pull requests

3 participants