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
Deployment and Others Tutorial
Search
andikan
May 15, 2014
Programming
1
660
Deployment and Others Tutorial
2014/05/15 @ NTU CCSP
andikan
May 15, 2014
Tweet
Share
More Decks by andikan
See All by andikan
MongoDB and Mongoose Tutorial
andikan
1
1.4k
Other Decks in Programming
See All in Programming
明示と暗黙 ー PHPとGoの インターフェイスの違いを知る
shimabox
2
510
ISUCON研修おかわり会 講義スライド
arfes0e2b3c
1
450
レベル1の開発生産性向上に取り組む − 日々の作業の効率化・自動化を通じた改善活動
kesoji
0
220
第9回 情シス転職ミートアップ 株式会社IVRy(アイブリー)の紹介
ivry_presentationmaterials
1
320
なんとなくわかった気になるブロックテーマ入門/contents.nagoya 2025 6.28
chiilog
1
270
なぜ「共通化」を考え、失敗を繰り返すのか
rinchoku
1
650
NPOでのDevinの活用
codeforeveryone
0
840
すべてのコンテキストを、 ユーザー価値に変える
applism118
3
1.3k
Node-RED を(HTTP で)つなげる MCP サーバーを作ってみた
highu
0
120
イベントストーミング図からコードへの変換手順 / Procedure for Converting Event Storming Diagrams to Code
nrslib
2
830
脱Riverpod?fqueryで考える、TanStack Queryライクなアーキテクチャの可能性
ostk0069
0
150
MDN Web Docs に日本語翻訳でコントリビュートしたくなる
ohmori_yusuke
1
120
Featured
See All Featured
Six Lessons from altMBA
skipperchong
28
3.9k
Code Reviewing Like a Champion
maltzj
524
40k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.8k
Testing 201, or: Great Expectations
jmmastey
43
7.6k
Practical Orchestrator
shlominoach
189
11k
Music & Morning Musume
bryan
46
6.6k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.5k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
126
53k
Stop Working from a Prison Cell
hatefulcrawdad
271
21k
Docker and Python
trallard
44
3.5k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
161
15k
Transcript
Cloud Computing-Based Service Design and Programming Andy Kuo @andikan Deployment
and Others
➡ Trello ➡ User Authentication ➡ Heroku ➡ MongoLab ➡
Files Upload to S3 ➡ Github Page
https://trello.com/
Kanban Board
More about Trello • Introductions - http://blog.fogcreek.com/how-we-make-trello/ - http://csswizardry.com/2014/05/my-trello-workflow/ •
Trello Tech Stack - http://blog.fogcreek.com/the-trello-tech-stack/ • Node.js wrapper for Trello’s API - https://github.com/adunkman/node-trello • Phaser app : simple kanban board - http://phaserapp.com/
Passport.js Simple, unobtrusive authentication for Node.js $ npm install passport
http://passportjs.org/
Passport.js Single Sign-on using an OAuth provider such as Facebook
Token-based credentials to protect access $ npm install passport-facebook http://passportjs.org/guide/facebook/
Runing Node.js App on Heroku https://www.heroku.com/ Heroku
SaaS PaaS IaaS Software as a Service Platform as a
Service Infrastructure as a Service
FTP http://www.slideshare.net/lkiral/git-34157836 Using Git push
Cedar The celadon cedar stack Default runtime stack and is
a flexible, polyglot environment https://devcenter.heroku.com/articles/stack https://devcenter.heroku.com/articles/cedar
Dyno A lightweight container running a single user-specified command Web
processes, worker processes and any process types declared in the app’s Procfile https://devcenter.heroku.com/articles/dynos
Procfile What commands are run by your app’s dyno on
the Heroku A text file named Procfile web: node app.js https://devcenter.heroku.com/articles/procfile
Getting Started with Node.js on Heroku https://devcenter.heroku.com/articles/getting-started-with-nodejs
Heroku user account Signup is free ! https://signup.heroku.com/signup/dc step0
Install Heroku Toolbelt Heroku command line tool https://toolbelt.heroku.com/ step0
Login Heroku $ heroku login You can login in any
directory step1
Declare process type with Procfile web: node app.js Declare the
command to start a web dyno step2
Start your app locally using Foreman $ foreman start Try
using foreman to run your server locally step3
Store in Git $ git init $ git add .
$ git commit -m “commit message” step4
Create a Heroku app $ heroku create $ heroku create
your-app-name Automatically add a git remote named “heroku” pointing at your Heroku app remote git repository URL $ git remote -v step5
None
Deploy your code $ git push heroku master After Heroku
detects Node.js app and install dependencies with npm, it will launch the process declared in Procfile step6
Ensure the dyno $ heroku ps:scale web=1 Ensure we have
one dyno running the web process type step7
Check state of dynos $ heroku ps List the running
dynos of your application step8
Visit your app $ heroku open Visit the app in
the browser step9
View the logs $ heroku logs $ heroku logs -n
200 Heroku only stores the last 1500 lines of log history
Server console $ heroku run node This console has nothing
loaded other than the Node.js standard library
Habits of a Happy Node Hacker https://blog.heroku.com/archives/2014/3/11/node-habits
Keep dependencies out of source control $ echo node_modules >>
.gitignore Ignoring the node_modules directory using git ignore
Keep track of outdated dependencies $ npm outdated Figure out
which of your app’s dependencies have fallen behind and need to be updated
Staging Server ?
Development Staging Production Environments This environment runs virtually identical to
production, but on a backup of the production database Developing and run the local server This environment run for real users
MongoLab https://mongolab.com/
DaaS Database as a Service MongoDB hosting platform Hosting on
Amazon, Google, Rackspace, Windows Azure Automated backups, web-based tools, monitoring and support
Heroku Add-ons Add powerful functionality to your apps with ease
https://addons.heroku.com/
https://addons.heroku.com/
Using Heroku MongoLab Add-on $ heroku addons: add mongolab By
default, add free Sandbox plan
Get MongoLab connection URI $ heroku config | grep MONGOLAB_URI
The connection URI to connect to MongoDB hosting on the MongoLab
Connect to MongoLab URI
Connect to MongoLab URI
MongoLab’s admin GUI for MongoDB $ heroku addons:open mongolab
None
Files upload to Heroku
Uploaded Files on Heroku are lost ? Each time you
push a new change to your Heroku application, your application is recreated and all uploaded data in /public directory is lost
Uploading directly to Amazon S3 Each time you push a
new change to your Heroku application, your application is recreated and all uploaded data in /public directory is lost
Amazon S3 bucket Create a AWS account Create a S3
bucket Edit S3 bucket permission property
Setup AWS credentials in Heroku $ heroku config:set AWS_ACCESS_KEY_ID=xxx $
heroku config:set AWS_SECRET_ACCESS_KEY=yyy $ heroku config:set S3_BUCKET=zzz
Uploading directly to Amazon S3 https://devcenter.heroku.com/articles/s3-upload-node https://github.com/d1b1/heroku-nodejs-s3-demo
https://www.inkfilepicker.com/ https://addons.heroku.com/filepicker https://devcenter.heroku.com/articles/filepicker
Github Pages
Github Pages Hosted directly from your Github repository User or
organization page / Project page https://pages.github.com/
Creating Project Pages $ git checkout --orphan gh-pages create a
branch named ‘gh-pages’ without any parents $ git rm -rf . https://help.github.com/articles/creating-project-pages-manually
Creating Project Pages create index.html file $ git add index.html
$ git commit -am “First pages commit” $ git push origin gh-pages username.github.io/projectname https://help.github.com/articles/creating-project-pages-manually
Socket.io http://socket.io/
Socket.io $ npm install socket.io http://socket.io/#how-to-use
None
Redis http://redis.io/
Using Heroku Redis To Go Add-on $ heroku addons: add
redistogo https://devcenter.heroku.com/articles/redistogo#using-with-node-js https://addons.heroku.com/redistogo
Kue $ npm install kue Delayed jobs Jobs priority https://github.com/learnboost/kue
http://learnboost.github.io/kue/
Redis Pub/Sub Publish and Subscribe to the channel https://github.com/louischatriot/node-redis-pubsub http://redis.io/topics/pubsub
Cloud Computing-Based Service Design and Programming Andy Kuo @andikan Thanks