赞
踩
~/workspace/blogger $ cf marketplace
Getting services from marketplace in org my-pivotal-org / space development as jda@gopivotal.com... OK
service plans description
blazemeter free-tier, basic1kmr, pro5kmr, pp10kmr, hv40kmr The JMeter Load Testing Cloud
cleardb spark, boost, amp, shock Highly available MySQL for your Apps.
cloudamqp lemur, tiger, bunny, rabbit, panda Managed HA RabbitMQ servers in the cloud
cloudforge free, standard, pro Development Tools In The Cloud
elephantsql turtle, panda, hippo, elephant PostgreSQL as a Service
ironmq pro_platinum, pro_gold, large, medium, small, pro_silver Powerful Durable Message Queueing Service
ironworker large, pro_gold, pro_platinum, pro_silver, small, medium Scalable Background and Async Processing
loadimpact lifree, li100, li500, li1000 Cloud-based, on-demand website load testing
memcachedcloud 25mb, 100mb, 250mb, 500mb, 1gb, 2-5gb, 5gb Enterprise-Class Memcached for Developers
mongolab sandbox Fully-managed MongoDB-as-a-Service
newrelic standard Manage and monitor your apps
rediscloud 25mb, 100mb, 250mb, 500mb, 1gb, 2-5gb, 5gb, 10gb, 50gb Enterprise-Class Redis for Developers
searchify small, plus, pro Custom search you control
searchly small, micro, professional, advanced, starter, business, enterprise Search Made Simple. Powered-by ElasticSearch
sendgrid free, bronze, silver, gold, platinum Email Delivery. Simplified.
Creating service mydb in org my-pivotal-org / space development as jda@gopivotal.com...
OK
现在我们就可以在自己的空间里看到新建的数据库服务。
Getting services in org my-pivotal-org / space development as jda@gopivotal.com...
OK
name service plan bound apps
mydb cleardb spark
- <%
- mydb = JSON.parse(ENV['VCAP_SERVICES'])["cleardb"]
- credentials = mydb.first["credentials"]
- %>
- ...
- production:
- adapter: pg
- encoding: utf8
- reconnect: false
- pool: 5
- host: <%= credentials["host"] %>
- username: <%= credentials["username"] %>
- password: <%= credentials["password"] %>
- database: <%= credentials["database"] %>
- port: <%= credentials["port"] %>
第二个改动是在Gemfile里加了一行"gem 'mysql2'"。这样我们的blogger就可以通过这个依赖和数据库联系。
Creating app iblogger in org my-pivotal-org / space development as jda@gopivotal.com...
OK
Using route iblogger.cfapps.io
Binding iblogger.cfapps.io to iblogger...
OK
Uploading iblogger...
Uploading from: /Users/jda/workspace/blogger
1.8M, 480 files
OK
上传完毕!MySQL - ready! APP - ready! 开始绑定MySQL - APP绑定!
Binding service mydb to app iblogger in org my-pivotal-org / space development as jda@gopivotal.com...
OK
TIP: Use 'cf push' to ensure your env variable changes take effect
Updating app iblogger in org my-pivotal-org / space development as jda@gopivotal.com...
OK
Uploading iblogger...
Uploading from: /Users/jda/workspace/blogger
1.8M, 480 files
OK
Starting app iblogger in org my-pivotal-org / space development as jda@gopivotal.com...
OK
-----> Downloaded app package (8.5M)
-----> Using Ruby version: ruby-1.9.3
-----> Installing dependencies using Bundler version 1.3.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
Installing rake (10.1.0)
Installing i18n (0.6.5)
...[output omitted]
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Detected manifest file, assuming assets were compiled locally
-----> WARNINGS:
...
-----> Uploading droplet (44M)
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
1 of 1 instances running
App started
Showing health and status for app iblogger in org my-pivotal-org / space development as jda@gopivotal.com...
OK
requested state: started
instances: 1/1
usage: 1G x 1 instances
urls: iblogger.cfapps.io
state since cpu memory disk
#0 running 2014-04-30 06:18:25 PM 0.0% 171.1M of 1G 121.3M of 1G
如果我们想亲自连接到数据库里查看我们的数据信息,我们可以通过'cf files'来获取数据库的验证信息。(请放心,我把下面数据库的密码改掉了:D)
Getting files for app iblogger in org my-pivotal-org / space development as jda@gopivotal.com...
OK
TMPDIR=/home/vcap/tmp
VCAP_APP_PORT=63752
USER=vcap
VCAP_APPLICATION={"limits":{"mem":1024,"disk":1024,"fds":16384},"application_version":"152d7bc5-d2a2-4351-af07-552a62a75f1a","application_name":"iblogger","application_uris":["iblogger.cfapps.io"],"version":"152d7bc5-d2a2-4351-af07-552a62a75f1a","name":"iblogger","space_name":"development","space_id":"ce1a7115-ba9a-493e-8f74-145e7571ab7f","uris":["iblogger.cfapps.io"],"users":null,"instance_id":"d7209457daa5463c9c1840b94dbac877","instance_index":0,"host":"0.0.0.0","port":63752,"started_at":"2014-04-30 10:18:12 +0000","started_at_timestamp":1398853092,"start":"2014-04-30 10:18:12 +0000","state_timestamp":1398853092}
RACK_ENV=production
PATH=/home/vcap/app/bin:/home/vcap/app/vendor/bundle/ruby/1.9.1/bin:/bin:/usr/bin:/bin:/usr/bin
PWD=/home/vcap
LANG=en_US.UTF-8
VCAP_SERVICES={"cleardb":[{"name":"mydb","label":"cleardb","tags":["relational","Data Store","mysql"],"plan":"spark","credentials":{"jdbcUrl":"jdbc:mysql://username:password@mysql.host.url:3306/db_name","uri":"mysql://username:password@mysql.host.url:3306/db_name?reconnect=true","<strong>name</strong>":"db_name","<strong>hostname</strong>":"mysql.host.url","<strong>port</strong>":"3306","<strong>username</strong>":"username","<strong>password</strong>":"password"}}]}
SHLVL=1
HOME=/home/vcap/app
RAILS_ENV=production
GEM_PATH=/home/vcap/app/vendor/bundle/ruby/1.9.1:
PORT=63752
VCAP_APP_HOST=0.0.0.0
DATABASE_URL=mysql2://username:password@mysql.host.url:3306/db_name?reconnect=true
MEMORY_LIMIT=1024m
_=/usr/bin/env
去iblogger.cfapps.io留言吧!!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。