Changes between Version 5 and Version 6 of jazz/24-09-18


Ignore:
Timestamp:
Sep 19, 2024, 4:24:03 PM (2 months ago)
Author:
jazz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • jazz/24-09-18

    v5 v6  
    6060explorer shell:::{ED7BA470-8E54-465E-825C-99712043E01C}
    6161}}}
     62
     63== GCP Cloud Run ==
     64
     65- [https://www.varstack.com/2022/06/04/Cloud-Run-SSH/ Cloud Run SSH - computation power & on-demand]
     66Full working example
     67You can use this Dockerfile to generate a Cloud Run service to which you can SSH:
     68{{{
     69FROM alpine:latest
     70
     71RUN apk update && apk add websocat openssh &&             \
     72    ( echo 'root:root' | chpasswd ) &&                    \
     73    sed -i 's|#PermitRootLogin|PermitRootLogin yes\n\0|g' \
     74      /etc/ssh/sshd_config &&                             \
     75    cat /etc/ssh/sshd_config
     76
     77CMD ( cd /etc/ssh && ssh-keygen -A ) &&       \
     78    /usr/sbin/sshd -f /etc/ssh/sshd_config && \
     79    websocat --binary ws-l:0.0.0.0:8080 tcp:127.0.0.1:22
     80}}}
     81This Dockerfile uses a barebones alpine image, but you could use a beefy image with a lot of tools that you might need in your temporary computation machine. It installs websocat and openssh, enables root SSH login and sets the root password to root.
     82
     83Put this Dockerfile in an empty directory and deploy this using:
     84{{{
     85$ gcloud alpha run deploy alpine-ssh --platform managed \
     86  --execution-environment gen2 --source .
     87}}}
     88You can SSH to the resulting image using:
     89{{{
     90$ ssh -o ProxyCommand='websocat --binary wss://alpine-ssh-AAAAAAAAAA.a.run.app' root@host
     91}}}
     92(use root when prompted for password). SUCCESS!