c9平台ruby开发环境克隆SaaS应用并将应用部署至heroku的操作记录
克隆对象为rottenpotatoes,是一个初级影评网站,为《SaaS软件工程》课本实例项目,基于Ruby on Rails框架开发。下面将我的操作过程进行记录,便于日后回顾。
一、克隆项目至C9平台Get RottenPotatoes running from your c9 workspace)
1.安装正确的Ruby版本
# Please pipe this script to a "bash --login" shell
RUBY=2.4.0
set +v
# install the correct version of ruby
echo yes | rvm remove all
rvm install ruby-$RUBY
# reload rvm so it can modify environment of running shell script
. /usr/local/rvm/scripts/rvm
rvm use $RUBY
echo rvm use $RUBY >> $HOME/.profile
2.git克隆
git clone https://github.com/saasbook/rottenpotatoes-rails-intro.git
3.gem安装包
gem install bundle
4.包安装
bundle install --without production
5.创建数据库db
bundle exec rake db:setup
6.服务器
rails server -p $PORT -b $IP
二、将项目部署至heroku
1、 heroku create projectlimin
2、输入heroku信息 、密码。
3、部署应用
git init
heroku git:remote -a 你的应用名称
git add .
git commit -am "init"
git push heroku master
接下来,转移数据库:
4、heroku rake db:migrate
5、heroku run rake db:seed
参考资料:
heroku安装及部署rails项目教程(https://www.jianshu.com/p/5ac77554ef41)