一、准备环境
安装Fedora第三方源
yum -y update
yum -y install epel-release
二、安装nginx
yum -y install nginx
三、根据需要安装所需要的数据库
根据项目的实际需要,选择需要安装的数据库。这里以MariaDB数据库为例。
yum -y install mariadb-server mariadb mariadb-devel
使用CentOS7默认的yum源安装的mariadb版本为5.5。该版本配合mysql2
完全没问题。但是如果使用MariaDB的官网yum源安装最新版本的mariadb 10.2以后,会导致gem install mysql2
编译通不过。即使安装了mariadb-devel,mysql2的gem也找不到mariadb的开发库,不知道是什么地方出了问题。
所以,保险起见,目前推荐使用mariadb5.5与mysql2的gem配合。
四、安装配置renv+rails环境
参考以下文档,完成deploy
账号下的ruby+rails的环境配置:
五、配置 mina + git 发布环境
六、使用acme.sh脚本申请Let’s Encrypt证书
配置nginx + puma
- https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server
- http://jiunjiun.logdown.com/posts/2014/08/23/rails-nginx-mina-puma
- https://segmentfault.com/a/1190000002918225
- http://blog.noriaki.me/2015-01-12-development-rails-apache-puma-on-centos
- http://qiita.com/noriaki/items/74ee4877c0989a42399b
- http://qiita.com/takkkun/items/ecdee7e7dec1bcc9a5b5
关于预编译 注意nginx里面assets目录的写法,否则生产环境下会pipeline后的asset会通不过
- http://blog.wackwack.net/entry/2014/06/28/185834
- http://stackoverflow.com/questions/18700219/rails-4-assets-not-loading-in-production
- http://qiita.com/metheglin/items/c5c756246b7afbd34ae2
- http://qiita.com/Kumassy/items/1fd8c0c12cf054e4c4dc
- http://div.io/topic/1691
使用mina作为rail的发布工具
- https://gist.github.com/xhj/5938280
- https://gist.github.com/duykhoa/54aeaa062a3b78a42c05
- http://thelazylog.com/deploying-rails-application-with-nginx-puma-and-mina/
- http://xufei.logdown.com/posts/2014/03/05/rails-mina-puma-nginx
- https://github.com/untitledkingdom/mina-puma
- https://infinum.co/the-capsized-eight/faster-web-application-deployments-using-mina-instead-of-capistrano
- https://www.oswish.net/blogs/57a724b463b1d96046000006
- http://befool.co.jp/blog/chainzhang/mina-deploy/
- https://www.digitalocean.com/community/tutorials/how-to-use-mina-to-deploy-a-ruby-on-rails-application
- http://qiita.com/ne_ko_/items/23d447a7aba6ac910fff
- https://segmentfault.com/a/1190000002918225
keyを生成
$ bundle exec rake secret
qnaiglfmugm82487yfam7y4qixm8734pt7bfdac6622iou9x74pof904r77ed64ba5a8c4r3qoi5u948x3q7n0q98q7089qm398
#環境変数に設定
$export SECRET_KEY_BASE=
qnaiglfmugm82487yfam7y4qixm8734pt7bfdac6622iou9x74pof904r77ed64ba5a8c4r3qoi5u948x3q7n0q98q7089qm398
CentOS服务器访问github上的代码
配置nginx + puma
自动启动puma的service写法 https://firegoby.jp/archives/5694 http://pebble8888.hatenablog.com/entry/2016/05/05/201903 ryosman项目实际上用的这种方式 http://arakaji.hatenablog.com/entry/2015/08/03/200502 http://qiita.com/noriaki/items/74ee4877c0989a42399b
CentOS安装最新版postgresql
TODO:追加postgresql的使用 http://qiita.com/SOJO/items/a1d97887d24c3e44596f http://qiita.com/Morinikki/items/9296a915205b2e5af703
如何让所有用户都能使用psql? http://qiita.com/ponponz/items/e6ca28c7e9e09185e97e
配置ssh转发
https://developer.github.com/guides/using-ssh-agent-forwarding/ https://firegoby.jp/archives/5694 https://github.com/mina-deploy/mina/issues/23