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
Takumasa Sakao
June 29, 2019
Technology
2.9k
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
AgentCoreで実践するハーネスエンジニアリング
yakumo
1
300
[AWS 秋のクラウドオペレーション祭り 2026]AWS DevOps Agentで変わるリリースと運用対応 ~リリース管理機能と Directed actions のご紹介~
furuton
4
1.2k
分析の民主化を支えるメタデータ整備の実践
kakehashi
PRO
4
1.3k
実践! SRE × AI - ABEMA における AIOps -
tetsuya28
7
2.9k
12 個 Tool と、 4,096 Token
hlum
0
130
Running Kotlin + Quarkus with Lambda
nealle
1
420
Essential architectural thinking (revised edition)
ufried
0
110
AI駆動開発の時代になったのでトヨタ生産方式から見直す
terurou
7
5.8k
DWH の限界突破! AI エージェント向け爆速リアルタイムデータ基盤 ClickHouse
jozono
1
390
ブラウザとサーバーから考えるAI時代のフロントエンド監視
shogo4131
3
850
生成AIと進める探索的データ分析(2026.10.03 第122回Tokyo.R勉強会)
tatamiya
2
1.5k
AI時代だからこそ推したい!Gitコマンド再入門
munakata
0
170
Featured
See All Featured
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8.1k
The SEO Collaboration Effect
kristinabergwall1
1
590
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
480
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
2
6.3k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.7k
Building Applications with DynamoDB
mza
96
7.2k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
330
The Cult of Friendly URLs
andyhume
79
7k
HDC tutorial
michielstock
2
950
Designing Experiences People Love
moore
143
24k
We Have a Design System, Now What?
morganepeng
55
8.4k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.8k
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にポストしたり ◦ 負荷試験するコンテナを整えて雑に大規模負荷試験をしたり
以上、ありがとうございました