Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Cloud Run でシェルスクリプトを動かす
Search
Takumasa Sakao
June 29, 2019
Technology
0
2.8k
Cloud Run でシェルスクリプトを動かす
Takumasa Sakao
June 29, 2019
Tweet
Share
More Decks by Takumasa Sakao
See All by Takumasa Sakao
k9s のプラグイン機構とモダンな watch コマンド、viddy の紹介
sachaos
0
1.5k
GAE を利用したゲーム内通貨管理サービスの運用〜可用性を損なわないための工夫〜
sachaos
0
1.2k
Go の静的解析ツールの作成と活用
sachaos
0
3k
レイトレーシングとGoroutine
sachaos
2
1.2k
OSSを作っている時に 考えていること ーUNIX哲学を添えてー
sachaos
2
580
GCPをフル活用したゲームログ収集基盤の構築
sachaos
6
3.1k
Other Decks in Technology
See All in Technology
AIに視覚を与えモバイルアプリケーション開発をより円滑に行う
lycorptech_jp
PRO
1
800
自動テストが巻き起こした開発プロセス・チームの変化 / Impact of Automated Testing on Development Cycles and Team Dynamics
codmoninc
1
1.1k
Agentic Software Modernization - Back to the Roots (Zürich Agentic Coding and Architectures, März 2026)
feststelltaste
1
170
kintone開発のプラットフォームエンジニアの紹介
cybozuinsideout
PRO
0
820
パネルディスカッション資料 (at Tableau Now! - 2026-02-26)
yoshitakaarakawa
0
1.1k
Claude Codeの進化と各機能の活かし方
oikon48
11
3.2k
Contract One Engineering Unit 紹介資料
sansan33
PRO
0
14k
【SLO】"多様な期待値" と向き合ってみた
z63d
2
310
型を書かないRuby開発への挑戦
riseshia
0
190
大規模な組織におけるAI Agent活用の促進と課題
lycorptech_jp
PRO
6
7.8k
AIエンジニア Devin と歩む、自律型運用プロセスの構築
a2ito
0
690
生成AIの利用とセキュリティ /gen-ai-and-security
mizutani
1
1.2k
Featured
See All Featured
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
WENDY [Excerpt]
tessaabrams
9
36k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
230
Become a Pro
speakerdeck
PRO
31
5.8k
Deep Space Network (abreviated)
tonyrice
0
86
What does AI have to do with Human Rights?
axbom
PRO
1
2k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.8k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.8k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.1k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
380
Bash Introduction
62gerente
615
210k
Optimizing for Happiness
mojombo
378
71k
Transcript
Cloud Run で シェルスクリプトを動かす 株式会社アカツキ @sachaos
自己紹介 @sachaos 株式会社アカツキにてサーバーサイドエンジニア Go, GCPとか好き
Cloud Run とはなにか? • コンテナをサーバーレスで動かす Google Cloud Platform のサービス •
Cloud Run は マネージドの Cloud Run と Cloud Run on GKE がある ◦ 今日話すのは マネージドの Cloud Run だけ! • 現在 Beta バージョン • US リージョンのみ提供 • サーバーレス ◦ 使った分だけ費用が発生する ◦ オートスケールする ◦ 0 までスケールする ◦ つまり、全く使わなければ無料
Demo • Hello World するサーバーをデプロイしてみる gcloud beta run deploy hello
\ --image gcr.io/google-samples/hello-app:2.0 \ --region us-central1 \ --allow-unauthenticated
Cloud Run • Kubernetes 上でサーバーレス環境を構築する Knative というOSSをベースに作られている • PORT環境変数で指定されたポートでサーブする HTTPサーバのコンテナを用意すればそれをサーバーレスで動かせる
• コンテナを用意すればどんな言語で書かれたコード、バイナリでも動かすことができ る
Cloud Run で シェルスクリプト動かせたら 便利そうじゃない?
Cloud Run でシェルスクリプトを実行する • HTTP リクエストを受けたら 事前に渡されたシェルスクリプトを実行するようなものを雑に作ってみた • https://github.com/sachaos/cloud-exec
Cloud Exec cloud-exec ./echo.sh localhost:8080 ./echo.sh
GitHub の星の取得数を Slack に通知する 1. シェルスクリプトを書く a. https://github.com/yyx990803/starz の結果をごにょごにょして Slack
Webhook に POST 2. 使用するコマンドなど、依存をコンテナに詰める 3. Cloud Run にデプロイする 4. 定期的に叩くようにする こういうのをSlackに定期的に投げたい →
1. シェルスクリプトを書く
2. 依存をコンテナに詰める
3. Cloud Run にデプロイ
できた
4. 定期的に叩くようにする • Cloud Scheduler という GCP のマネージド cron サービスを使う
• 指定した時間に特定の HTTP リクエストを発行することが可能
まとめ • Cloud Run は簡単にデプロイして公開できるしオートスケールするし最高 • Cloud Run でシェルスクリプトを走らせる cloud-exec
を紹介しました • 安易バッチサーバとして 雑にスクリプトを走らせるようなことを行いました • 色々応用できそう ◦ 紹介したようにコマンドで得られる情報を定期的に Slackにポストしたり ◦ 負荷試験するコンテナを整えて雑に大規模負荷試験をしたり
以上、ありがとうございました