Giter VIP home page Giter VIP logo

cloud-run-shell's Introduction

Warning

You have to use this api carefully or it would be serious risky

Prerequisite

Some tools are required

  • Google Cloud project enabled billing
  • Docker engine(Recommended: Docker CE)
  • make
  • jq
  • envsubst

You may encounter something wrong if you use M1 Mac.
Consider working on other architecture, such as Cloud Shell.

Make container image repository of Artifact Registry

Prepare a repo for your containers for the first time,

make repo

Edit config of Cloud Run service

Configure cloudrun.yaml that will be used by Cloud Run you deploy.

Deploy

Build two containers, push them to Artifact Registry and then deploy its service.

Set some envs,

export GEN=gen1 # or gen2, choose the generation of platform
export SERVICE_NAME=<your service name>

Just type this,

make all

If you want to deploy another one using the same image, do again this part.

Notice
If you want your service not to require ID Token,

make expose

It means the same as option '--allow-unauthenticated'.

Usage

Prepare to use in common

export SECRET=<your secret>
export URL=<url of Cloud Run service>

If the Cloud Run sevice requires ID Token, run as below,

export TOKEN=$(gcloud auth print-identity-token)

You need to run it again because it will expire in 60 mins.

With CLI

1. Build it to make client as 'client/shell' once.

make client

Change directory to 'client'.

cd client/

You're ready to run something on your Cloud Run service.

2. Just Run it

Run it with your any command.

./shell ps aux

You may see output formatted JSON as below.

JSON_MODE=1 ./shell ps aux

Option: Simple pseudo shell without typing client command

After this, You should input command you want in one liner.

xargs -L1 ./client/shell

Like this,

$ xargs -L1 ./client/shell
ls -l
total 44
-rw-r--r-- 1 root root  1109 Sep 30 02:31 Dockerfile
-rw-r--r-- 1 root root    31 Sep 15 14:06 Procfile
drwxr-xr-x 2 root root     0 Sep 30 02:33 byte-unixbench
-rw-r--r-- 1 root root   321 Sep 15 14:06 deploy.sh
drwxr-xr-x 2 root root    80 Sep 30 02:49 google-cloud-sdk
-rw-r--r-- 1 root root  2472 Sep 27 09:51 main.py
-rw-r--r-- 1 root root 39332 Sep 15 14:06 poetry.lock
-rw-r--r-- 1 root root   444 Sep 15 14:06 pyproject.toml

gcloud storage cp gs://shingo-ar-test0729/testvideo.mp4 /tmp

ls /tmp/
cloudsql-proxy-tmp
testvideo.mp4

cd /tmp; ffmpeg -i testvideo.mp4 testvideo.mov

ls -l /tmp/testvideo.mov
-rw-r--r-- 1 root root 29605125 Sep 30 02:54 /tmp/testvideo.mov

cloud-run-shell's People

Contributors

shin5ok avatar

Watchers

 avatar  avatar

cloud-run-shell's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.