CMS x2015(2015年主站).
- Ruby 2.2.0-p0
- Postgres
- Rails 4.1.6
- Nginx + Unicorn
- Faye
- Linux or vagrant for mac
- Sidekiq
- Redis
- Grape
$ cp config/database.example.yml config/database.yml
$ rspec spec
$ bundle install
$ rake db:create
$ rake db:migrate
$ rake db:seed
$ rails s
提供的Vagrant镜像包已经包含系统所有依赖的环境,只需本地加载这个镜像包,项目就可以启动运行了。 目前镜像已经存在的用户有vagrant 和 deploy 密码同用户名
$ mkdir -p ~/workspace/source && cd ~/workspace
$ vagrant box add 36kr ubuntu_tls_ruby_mongo_postgre_memcached_redis_nginx_node_els_img_faye_sidekiq_36kr_v3.box
$ vagrant init 36kr
修改Vagrantfile文件
# 开启vagrant与host的端口映射
$ config.vm.network "forwarded_port", guest: 3000, host: 3000
# 开启目录映射
$ config.vm.synced_folder "~/workspace/source/36krx2015", "/vagrant_data"
$ vagrant up
使用Capistrano3 进行
- 产品环境
$ bundle exec cap production deploy:create_database
$ bundle exec cap production deploy
$ bundle exec cap production deploy:rake_seed
$ bundle exec cap production run_faye
- 开发环境
$ bundle exec cap development deploy:create_database
$ bundle exec cap development deploy
$ bundle exec cap development deploy:rake_seed
$ bundle exec cap development run_faye
- Vagrant环境
$ bundle exec cap vagrant deploy:create_database
$ bundle exec cap vagrant deploy
$ bundle exec cap vagrant deploy:rake_seed
$ bundle exec cap vagrant run_faye
- 产品环境
ruby bundle exec cap production deploy
- 开发环境
ruby bundle exec cap development deploy
在浏览器里打开
http://localhost:3000/api/doc
在本地项目根目录
$ bundle exec sidekiq
然后在浏览器访问
http://localhost:3000/sidekiq
在本地项目根目录
$ redis-stat --server
$ redis-stat --verbose --server=8080 5
# redis-stat server can be daemonized
$ redis-stat --server --daemon
# Kill the daemon
$ killall -9 redis-stat-daemon
然后在浏览器访问
http://localhost:8080/sidekiq
然后在浏览器访问
http://localhost:3000/newrelic