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
為何我從heroku轉戰AWS Elastic Beanstalk
Search
blue chen
November 07, 2013
600
10
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
為何我從heroku轉戰AWS Elastic Beanstalk
blue chen
November 07, 2013
More Decks by blue chen
See All by blue chen
RelaJet Caption
iamblue
0
150
The future of hearing device - 聽覺領域新的機會及挑戰
iamblue
2
290
20180918-Digitime 導入MCU設計 催熟智慧語音辨識應用市場
iamblue
0
270
Pixnet hackthon - workshop
iamblue
0
150
AI 人工智慧學校分享
iamblue
0
450
Javascript -Full stack 物聯網開發
iamblue
0
170
MCS Lite 私有雲物聯網開發
iamblue
0
340
Blockchain for IoT 應用
iamblue
1
280
2017.01.16 Embedded system
iamblue
0
160
Featured
See All Featured
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
260
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
[SF Ruby Conf 2025] Rails X
palkan
2
1.1k
Darren the Foodie - Storyboard
khoart
PRO
3
3.4k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.3k
Git: the NoSQL Database
bkeepers
PRO
432
67k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.5k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Making the Leap to Tech Lead
cromwellryan
135
9.9k
The Language of Interfaces
destraynor
162
27k
Transcript
BEANSTALK 為何我從heroku轉戰beanstalk
YouMeb Senior Web Developer & AngularJS.tw Guru I am Blue
Html5&CSS3 AWS AngularJS NodeJS Sean Phil Blue Poying
1.⾏行銷企劃實習 2.程式設計實習(熟js)
前情提要 前情提要
就是因為現在⾮非常吃重視覺 硬體架構對user來講無感.講⼀一堆技術客⼾戶也不懂 對於Startup來說 需要把很多精⼒力放在程式上
Startup的處境 1.資⾦金不多 2.⼈人才 3.⼈人⼒力有限.時間不多
當你寫好nodeJS專案時,即將要放上去了...
1.買⼀一台機器.網址 3.弄好nodeJS環境 2. DNS指好 4. sreen -S nodejs while :
; do ; node app ; done
XXX.com 上線!
怎麼!流量要暴了 怎麼!程式寫錯了 怎麼!忘了寫404 page
怎麼!流量要暴了 怎麼!程式寫錯了 怎麼!忘了寫404 page OK ! 來個nginx/apache + Git
當你有100個專案時 每次重覆坐這些事情很 煩
None
web: node web.js worker: node worker.js Dyno 可以做 { }
Web Dyno Worker Dyno
苦
heroku config:set USER_NAME=blue process.env.USER_NAME var config = require(path.join(__dirname, '/',
'config.json')); 會被⾃自動指向/app 底下的config.json 環境設定⼀一定要
{ "port": 3000, "host": "localhost", "controllers": "controllers",
"error": { "format": "{level:1}{module:3}{code:2}", "file": "errors" }, "logger": { "level": "debug", "dir": "log", "filename": "%s.log" }, "packages": { "sequelize": { "db": "yourdbname", "username": "yourusername", "password": "yourpassword", "options": { "host": "yourhost" } }, "users": { "redis-‐database": 2, "token-‐expire": 604800, "nonce-‐expire": 300 } } } 苦
使⽤用額外的服務: AddOn api外連 { } AddOn可以額外呼叫worker專⾨門處理
⼀一年前websocket protocol....
The WebSockets protocol is not yet supported on the Cedar
stack. 如果真的很想⽤用socket.io 要切到xhr-polling
https://devcenter.heroku.com/articles/node-websockets Websocket近期⽀支援(10,2013) https://github.com/heroku-examples/node-ws-test
Heroku整體架構並⾮非全盤開源 http://www.infoq.com/cn/articles/heroku-inspiration
隨著架構增⼤大,我們也需要更彈性操作的需求 AWS Elastic Beanstalk
會⽤用到的服務 (像⼤大學選課)
EC2 ELB SNS AutoScaling S3 必修 選修 Amazon RDS、Amazon DynamoDB、
Amazon SimpleDB、Microsoft SQL Server、Oracle、IBM DB2 或 Informix 有GUI幫你包到好.也可透過Cli去update 你的產品 (git也可以)
要⽤用AWS可以先考慮從free開始 http://aws.amazon.com/free/
export PATH=”$PATH:/Users/blue/Desktop/html5/AWS-ElasticBeanstalk- CLI-2.5.1/eb/macosx/python2.7 先安裝 Beanstalk CLI vim ~/.zshrc
YourID->Security Credential-> accessKey
如果選ELB 就會⽴立⾺馬開”⾄至少”2台EC2 2)建⽴立⼀一個AMI role ⼀一般選(1)
如果要安裝其他套件 Open-ssl http://stackoverflow.com/questions/15460855/node-js-deployment-issue-on- amazon-elastic-beanstalk 但是注意⼀一下npm install -g 的東⻄西不是在這邊設定 mkdir .ebextensions
vim static.config packages: yum: openssl-‐devel: []
“scripts”:{ "preinstall": "npm i -‐g youmeb-‐cli" } 但是注意⼀一下npm install -g
的東⻄西這樣設定 vim package.json
Beanstalk , heroku 等Paas平台共同的⼀一個缺點就是.... 每次重新push repo時,之前的檔案都會刪掉 (除了在env以外的東⻄西) 即便是beanstalk你可以登⼊入EC2主機去改 依然在每次push 後即會被重設
其他設定 (beanstalk 後台 Live Demo)
⾸首先,希望⼤大家別再相信網路上不實際的說法 所有圖表.資料都要從官網上看才是最準確的 http://aws.amazon.com/
None
VPC常⽤用四個架構 I. VPC with Public Subnet Only 2. VPC with
Public and Private Subnet Only 3. VPC with Public and Private Subnet and hardware VPN 4. VPC with Private Subnet and hardware VPN
None
⽤用VPC有個最⼤大好處是,你可以透過api去得知同VPC其他主機的位置
最後兩三事.... 1.Heroku 跟EC2硬體⽐比較 2.關於價格 3.使⽤用時機
THANK YOU