Chisel only works successfully once. I have no idea why

This is my gitpod.Dockerfile

FROM gitpod/workspace-postgres

# default user is gitpod
# Run this url https://gitpod.io/#https://github.com/oppoin/eno-a3-django/tree/feature/1704

# apt update
RUN sudo apt-get update

# Install Redis.
RUN sudo apt-get install -y redis-server

# Install Dropbear SSH server for chisel to work
RUN sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq dropbear

# remove lists and tmp
RUN sudo rm -rf /var/lib/apt/lists/* /tmp/*

# apt clean
RUN sudo apt-get clean


# ENTRYPOINT doesn't work in gitpod dockerfiles
# ENV DATABASE_URL="postgresql://gitpod@localhost/postgres" is the most impt
# but we load this via init in the .gitpod.yml Python task

# need to run as root else curl and install won't work
USER root

RUN curl https://i.jpillora.com/chisel! | bash

# need to switch back to gitpod
USER gitpod

This is my gitpod.yml

image:
  file: .gitpod.Dockerfile

ports:
  - port: 8080
  - port: 5432
    onOpen: ignore
  - port: 6379
    onOpen: ignore
  - port: 8000
    onOpen: open-preview
  - port: 2222
    onOpen: ignore

tasks:
  - name: TCP Tunnel
    command: chisel server --socks5
  - name: SSH Server
    command: |
      [ -f /workspace/dropbear.hostkey ] || dropbearkey -t rsa -f /workspace/dropbear.hostkey
      dropbear -r /workspace/dropbear.hostkey -F -E -s -p 2222 -P ~/dropbear.pid
  - command: |
      mkdir -p ~/.ssh && open ~/.ssh/authorized_keys
      clear
      echo "=============="
      echo " INSTRUCTIONS "
      echo "=============="
      echo ""
      echo "1. Add your public SSH key to ~/.ssh/authorized_keys of this Gitpod workspace"
      echo ""
      echo "2. Install Chisel on your local machine, e.g. curl https://i.jpillora.com/chisel! | bash"
      echo "   see https://github.com/jpillora/chisel"
      echo ""
      echo "3. Connect via SSH from your local machine:"
      echo "   ssh -o ProxyCommand='chisel client $(gp url 8080) stdio:%h:%p' gitpod@localhost -p 2222"
      echo ""
  - name: Redis
    before: redis-server &
  - name: Python
    init: >
      pip install -r ./requirements/local.txt &&
      export $(egrep -v '^#' .envs/.local/.gitpod.postgres | xargs) &&
      export $(egrep -v '^#' .envs/.local/.django | xargs)
    command: >
      python manage.py migrate &&
      python manage.py runserver 0.0.0.0:8000
  - name: Frontend (Node.js)
    command: >
      printf "\nRunning 'npm login':\n\n" &&
      npm login &&
      npm install &&
      mkdir -p frontend/static/dist &&
      npm run build

I manage to get the chisel to work once

Then in a separate workspace but the same repo it didn’t work

I have re-tried so many times, but the chisel doesn’t seem to be installed except for that one workspace 7 days ago.

I have no idea why this is happening. Can somebody advise?

Deeply deeply frustrated :frowning:

Hi @kimstacks,

Could you provide a link to a minimal, reproducible example or at least to your repo?

It seems that chisel has not been installed in your workspace Docker container.

Cornelius

My repo is private, but here’s a public repo that’s a minimal reproducible example

and here’s the gitpod workspace of the same github repo

There seems to be a bug with the chisel intaller. The chisel bin is at /home/gitpod/chisel and not in /usr/local/bin.

What you can do is

  • to execute /home/gitpod/chisel instead of chisel until this has been fixed (and revert it afterwards) or
  • move the chisel bin to /usr/local/bin in your Docker file when it’s in /home/gitpod/chisel.

The chisel author has fixed this. Now, you need to change something in your Dockerfile (before or in the chisel installation line) so that Gitpod re-builds the workspace image. Then it should work again.

1 Like

:bowing_man: