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
EventBridge Connection
_kensh
5
700
protovalidate-es を導入してみた
bengo4com
0
180
10倍の生産性を実現するAI駆動並列エージェントのすべて
kumaiu
5
1.4k
AAIFに入ってみた ~内から見えるコミュニティ動向~
sato4
0
180
連合学習と機密コンピューティング
lycorptech_jp
PRO
0
110
気づかぬうちにセキュリティ負債を生むAPIキー運用
sgwrmctk
0
120
手塩にかけりゃいいってもんじゃない
ming_ayami
0
550
Claude Code の Sandbox 機能を Anthropic Sandbox Runtime(srt) で試そう!/lets-play-anthropic-sandbox-runtime
tomoki10
1
560
小さくはじめるSLI/SLO ~育てながら組織に定着させる実践知~ / Starting Small with SLI/SLOs: Building Adoption Through Continuous Growth
nari_ex
7
1.9k
非定型業務をAI slackbotで自動化する ~ 社内要望を自動壁打ちするbotを作った ~/automating-ad-hoc-work-with-ai-slackbot
shibayu36
0
630
エラーバジェットのアラートのタイミングを考える.pdf
kairim0
0
140
Oracle AI Database@Google Cloud:サービス概要のご紹介
oracle4engineer
PRO
6
1.5k
Featured
See All Featured
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
23k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.9k
Chasing Engaging Ingredients in Design
codingconduct
0
220
Navigating Weather and Climate Data
rabernat
0
220
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
1.7k
Between Models and Reality
mayunak
4
330
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.5k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.3k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
840
Paper Plane (Part 1)
katiecoart
PRO
0
8.8k
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