Unable to connect to service (running GitHub Actions runner) via SSH

2 months ago

Hi Team, delighted to see that SSH is now available!

I've been experimenting with it and noticed it works well with my Django server; however, I have an Empty Service running the GitHub Actions runner application which keeps dropping the SSH connection with Error: Session error or Error: Could not establish SSH connection to application.

The service uses the ghcr.io/actions/actions-runner:2.322.0 image and deploys and registers the runner with no issues, and I can see it as successfully registered under my repo in GitHub.com. Notionally, all I need to do is SSH into the service to run the command ./run.sh to ensure that the runner is online and listening for jobs, but this is where I get blocked.

Totally understand that this feature has only been around for one day and so things are still very new, but let me know if you have any advice on getting SSH working in this use-case.

FWIW, I've noticed that there are no issues SSHing into app servers (tried Rails, Next, and Django so far), only for services built from Docker images on the Empty Service resource.

Awaiting User Response

3 Replies

2 months ago

Hello,

Currently the service you linked has a status of COMPLETED - meaning nothing is running, if no container is running there is nothing to SSH into.

The error given by the CLI could definitely be better here, and it will get better, since like you said, very new feature.

But either way, this is not something you would want to be using SSH for, you want to have Railway run that script when it deploys the image, and for that, you would use a start command, found in the service settings.

Otherwise, assuming you made it stay active, you would need to SSH in every single time you redeploy it, it's just not the correct way to go about this.

Hope this helped!

Best,
Brody


Status changed to Awaiting User Response railway[bot] 2 months ago


2 months ago

Hmmm, interesting. So I tried throwing the ./config.sh and ./run.sh commands into the Custom Start Command option, but the result was the same as before: it'll be ACTIVE for around 10 secs or so, then change to COMPLETED.

The next thing I tried was to to use the alpine docker image in an empty service to effectively create a basic Linux VM, then add the full self-hosted Actions runner set up commands (i.e. mkdir actions-runner && cd actions-runner && curl -o actions-runner-linux-x64-2.322.0.tar.gz etc. etc.) in the start up commands. As before, the runner would register successfully, be ACTIVE for around 10 secs, but would then just sit with COMPLETED status.

Another thing (admittedly a shot in the dark) was to create a NodeJS server from the template available, deploy, and then run those runner setup commands in the server's startup commands. The results were similar in that it would download and extract the runner application, but then registering and running it would throw Must not run with sudo.

The only things that come to mind is to have an option to persist any changes made via the SSH console, and the ability to run as a superuser (although I appreciate that's a big ask)


Status changed to Awaiting Railway Response railway[bot] 2 months ago


2 months ago

That means run.sh is for whatever reason exiting, something you would need to debug further.

> The only things that come to mind is to have an option to persist any changes made via the SSH console

This is simply not possible, the deployments are ephemeral containers, and changes made to the running processes or filesystem cannot be persisted.

> and the ability to run as a superuser

This is already the case, the shell is started as the root user.


Status changed to Awaiting User Response railway[bot] 2 months ago