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
Go Web ApplicationをHerokuにデプロイ #herokujp
Search
taichi nakashima
May 22, 2014
Technology
3.9k
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Go Web ApplicationをHerokuにデプロイ #herokujp
http://herokujp.doorkeeper.jp/events/10902
taichi nakashima
May 22, 2014
More Decks by taichi nakashima
See All by taichi nakashima
Platform Engineering at Mercari (Platform Engineering Kaigi 2024)
tcnksm
6
5.6k
Platform Engineering at Mercari
tcnksm
8
5.8k
Embedded SRE at Mercari
tcnksm
0
1.6k
How We Harden Platform Security at Mercari
tcnksm
2
1.9k
SRE Practices in Mercari Microservices
tcnksm
11
15k
開発者向けの基盤をつくる
tcnksm
38
12k
How We Structure Our Work At Mercari Microservices Platform Team
tcnksm
11
23k
Microservices Platform on Kubernetes at Mercari
tcnksm
16
17k
Introduction to Mercari Micorservices Platform Team
tcnksm
5
3.7k
Other Decks in Technology
See All in Technology
DevOps Agentで始めるAWS運用 〜フロンティアエージェントが変える運用の現場〜
nyankotaro
1
340
AIソロプレナー時代に2ヶ月で20人増員した事業創造会社の開発組織の話
miyatakoji
0
270
個人の発見を、組織の知恵に 〜生成AI活用を"探索"から"組織の仕組み"へ〜
kintotechdev
3
1.1k
社内 AI エージェント Synapse と セマンティックレイヤーの育て方
hiroakis
1
1.1k
MIERUNE JCT 発表資料「宇宙から伊能忠敬ごっこ」
syuchimu
0
200
データ基盤をDataformで整えた話 〜 開発環境を添えて 〜
takapy
0
130
非エンジニアがClaudeと挑んだ「1ヶ月間プロダクト30本ノック」
askokc
0
150
作って終わりにしない タイミーのセマンティックレイヤー育成の現在地
chanyou0311
3
1.7k
AI フレンドリーなエラー監視を TypeScript で実現する
shinyaigeek
2
280
10倍の生産性を実現するAI駆動並列エージェントのすべて
kumaiu
4
1.2k
LLMにもCAP定理があるという話
harukasakihara
0
270
NAB Show 2026 動画技術関連レポート / NAB Show 2026 Report
cyberagentdevelopers
PRO
0
130
Featured
See All Featured
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
We Are The Robots
honzajavorek
0
240
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.2k
Abbi's Birthday
coloredviolet
2
8k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
What's in a price? How to price your products and services
michaelherold
247
13k
Practical Orchestrator
shlominoach
191
11k
HDC tutorial
michielstock
2
700
BBQ
matthewcrist
89
10k
Utilizing Notion as your number one productivity tool
mfonobong
4
320
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
150
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.6k
Transcript
Deploy Golang Web Application to Heroku
I’m Taichi Nakashima twitter ID is @deeeet
http://deeeet.com/writing
Marniti Λ͔ͭͬͨ Golang Web Application Λ Heroku ʹσϓϩΠ͢Δ
• GoͷܰྔWebϑϨʔϜϫʔΫ • SinatraExpressͷӨڹ • MiddlewareʹΑΔ֦ு Martini.
sinatra require 'sinatra' ! get '/' do "Hello!" end
Martini. package main ! import "github.com/go-martini/martini" ! func main() {
m := martini.Classic() m.Get("/", func() string { return "Hello!" }) m.Run() }
• ґଘύοέʔδͷཧ • Procfileͷ४උ • Buildpackͷ४උ How?
$ go get github.com/kr/godep $ godep save $ gem install
bundler $ bundle install Dependency
Procfile web: bundle exec rackup config.ru -p $PORT $ echo
"web: $(basename `pwd`)" > Procfile
Buildpack $ heroku create $ heroku create -b https://github.com/kr/ heroku-buildpack-go.git
Deploy $ git push heroku master
Heroku on Docker Build a Docker container for app using
Heroku Buildpacks
! • ContainerܕԾԽιϑτ ΣΞ • VMͱൺͯΦʔόϔου͕ গͳ͘ߴʹಈ࡞ • OSXͰܰྔVMΛ্ཱͪ͛ Ε͑Δ
• CenturyLinkLabs࡞ • BuildpackΛͬͨDocker container Λ࡞ • ϩʔΧϧʹHerokuͱಉ͡ ڥΛؾܰʹ࡞Γ͍ͨΛ࣮ݱ •
Rails, Node, Golang Building
Prepare on OSX $ brew install docker boot2docker $ boot2docker
init $ boot2docker up
Prepare $ gem install building
Run building $ cd your-application $ building -p 3000 tcnksm/goapp
Run building $ building -p 3000 tcnksm/goapp create Dockerfile building
docker build -t tcnksm/goapp:latest . Step 0 : FROM ctlc/buildstep:ubuntu13.10 ---> a5432f93c775 Step 1 : ADD . /app ---> ef908258208c Step 2 : RUN /build/builder ---> Running in afd1b5565e3c Go app detected -----> Installing go1.2.1... done -----> Running: godep go install -tags heroku ./... -----> Discovering process types Procfile declares types -> web ---> 1d4265dcac7 running docker run -d -p 3000 -e "PORT=3000" tcnksm/goapp
Conclusion • GolangͷWeb ApplicationΛHerokuʹDeploy • Heroku on Docker