部署 简单部署 AppFog

shiren1118 · 2012年12月19日 · 最后由 ldl_xz 回复于 2013年07月11日 · 3033 次阅读

简单部署 appfog

首先 clone 这个项目https://github.com/appfog/af-ruby-rails/

自己改个名字,如果 clone 的时候没有指定的话

登陆

**Alfred-iMac:alfred$ af logn**

##上传

**Alfred-iMac:alfred$ af push**
Would you like to deploy from the current directory? [Yn]: 默认
Application Name: alfred
Detected a Rails Application, is this correct? [Yn]:  选择3,速度更快一些
1: AWS US East - Virginia
2: AWS EU West - Ireland
3: AWS Asia SE - Singapore
4: Rackspace AZ 1 - Dallas
5: HP AZ 2 - Las Vegas
Select Infrastructure: 3
Application Deployed URL [alfred.ap01.aws.af.cm]: 
Memory reservation (128M, 256M, 512M, 1G, 2G) [256M]: 1G  只要不是128就成
How many instances? [1]: 
Bind existing services to 'alfred'? [yN]: 默认
Create services to bind to 'alfred'? [yN]: 默认
Would you like to save this configuration? [yN]: 
Creating Application: OK
Uploading Application:
  Checking for available resources: OK
  Packing application: OK
  Uploading (38K): OK   
Push Status: OK
Staging Application 'alfred': OK                                           
Starting Application 'alfred': OK                                          

相关资源地址

数据库

AppFog automatically creates and binds a new MySQL service with the Ruby on Rails jumpstart, and the app is automatically reconfigured to connect to the service. For more information on services and how to connect to them manually, check out our docs on Services.

文档说会自动绑定对应的 services:

在 push 的时候需配置 services

Bind existing services to 'alfred'? [yN]: 
yCreate services to bind to 'alfred'? [yN]: y
1: mongodb
2: mysql
3: postgresql
4: rabbitmq
5: redis
What kind of service?: n

主意问题

有的时候会报这个错误

Error (JSON 503): <?xml version="1.0" encoding="u...

执行,指定 ruby 是 1.9.3 的版本就可以解决了

af push --runtime ruby193

appfog 單一檔案好像超過一個大小就會上傳失敗

我这里记录了 appfog mongodb 的操作http://www.9958.pw/post/appfog_database

需要 登录 后方可回复, 如果你还没有账号请 注册新账号