Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Cloud Run でシェルスクリプトを動かす
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Takumasa Sakao
June 29, 2019
Technology
2.8k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Cloud Run でシェルスクリプトを動かす
Takumasa Sakao
June 29, 2019
More Decks by Takumasa Sakao
See All by Takumasa Sakao
k9s のプラグイン機構とモダンな watch コマンド、viddy の紹介
sachaos
0
1.6k
GAE を利用したゲーム内通貨管理サービスの運用〜可用性を損なわないための工夫〜
sachaos
0
1.3k
Go の静的解析ツールの作成と活用
sachaos
0
3.2k
レイトレーシングとGoroutine
sachaos
2
1.3k
OSSを作っている時に 考えていること ーUNIX哲学を添えてー
sachaos
2
610
GCPをフル活用したゲームログ収集基盤の構築
sachaos
6
3.2k
Other Decks in Technology
See All in Technology
データ品質を壊しながらSnowflakeのAIに分析させてみた
kawanago
0
460
ミイダス株式会社 テックチームのご紹介 / MIIDAS Tech Team
miidas
0
110
私の推しは「聞いてから進む」AIです -AI-DLCに一人でアプリを作らせた話
yama3133
1
160
[2026-09-30]ロックンロールは鳴り止まないっ - 信頼性かまってちゃん - 「データ駆動を投げ捨ててまで。」追いかける信頼性改善に向けた取り組みの話
tosite
0
190
自律型 AI をセキュアに実装!Gemini と MIG で作る動的コード実行環境
recruitengineers
PRO
1
160
AI 時代の Azure エンジニアリング ~ 私たちは何を磨き、何を任せるのか ~
chack411
1
400
Deep Data Security 機能解説
oracle4engineer
PRO
2
650
20260930_Gemma4_Hands-on
tsho
0
210
「とりあえず動く」の先へ。 AI時代のチーム開発と内部設計/2026-slsdays
slsops
0
130
1万名の社員が使う認証基盤で どう信頼性を担保するか?
kairim0
0
180
20260929_AmazonGuardDutyの検出通知メールにAWS DevOpsAgentの調査結果を追加する
yhana
1
430
【データ横丁主催】AI Agentがコンテキストを使って仕事をした後、何が残るのか― 組織の経験を次の判断に引き継ぐ「Agent Memory」
shisyu_gaku
2
320
Featured
See All Featured
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
42k
How to make the Groovebox
asonas
2
2.5k
Building Adaptive Systems
keathley
44
3.2k
What's in a price? How to price your products and services
michaelherold
247
13k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.3k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
300
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
A Modern Web Designer's Workflow
chriscoyier
699
190k
Technical Leadership for Architectural Decision Making
baasie
3
590
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
340
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にポストしたり ◦ 負荷試験するコンテナを整えて雑に大規模負荷試験をしたり
以上、ありがとうございました