20180204
肖威工作总结
上午:查看one域名购买方法+麦子学院云端部署方法
one域名购买方法: https://www.dynadot.com/zh/domain/one.html https://www.getyour.id/zh-cn/domain/register-domain-name/new-tlds/global-brand/.one https://sg.godaddy.com/zh/tlds/one-domain
云端部署的流程: Github 专案设置 http://www.maiziedu.com/course/798/ 云端服务器搭建vps: https://cloud.digitalocean.com/welcome?i=2af35d 域名购买方法: http://my.freenom.com/domains.php 购买域名,填写好DNS记录
本机运行: ping theo.gq ping blog.theo.gq 查看我们的域名是否可以完成访问
在服务器上安装软件包 (1)git/ruby/nginx/database
$ ssh root@mine $ sudo apt-get install git-core nginx sqlite3 libsqlite3-dev https://www.brightbox.com/docs/ruby/ubuntu
$ sudo apt-get install software-properties-common $ sudo apt-add-repository ppa:brightbox/ruby-ng $ sudo apt-get update
$ sudo apt-get install ruby2.2 ruby2.2-dev $ sudo apt-get install libxml2-dev lisxslt-dev
$ ruby -v $ git -v
$ gem install bundler
$ vi /etc/nginx/sites-enabled/blog.conf
upstream blog { server localhost:3000; }
http Setting
server { listen 80; server_home blog.thep.gq; }
location / { proxy_set_header X-Forwarder-For Sproxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://blog; }
sudo service nginx restart
进入网站的根目录: cd /var/www
$ git clone https://github.com/bbtfr/maize.blog.git
$ ll $ maizi-blog $ cd maizi-blog $ bunlde $ rake db:create db:migrate $ rails s
生产环境下使用命令行的方法: https://devcenter.heroku.com/articles/rails-unicorn
gem 'unicorn'
# config/unicorn.rb worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3) timeout 15 preload_app true before_fork do |server, worker| Signal.trap 'TERM' do puts 'Unicorn master intercepting TERM and sending myself QUIT instead' Process.kill 'QUIT', Process.pid end defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect! end after_fork do |server, worker| Signal.trap 'TERM' do puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT' end defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection end在本地:让我们添加的gem生效,然后推到githuby上面
bundle install git add . git commit -m “unicorn confing” git push -f在远端:进入 cd /var/www 目录
git pull bundle install unicorn -c config/unicorn.rb 进入ngx的配置文件: vi /etc/nginx/sites-enabled/ 效果: blog.conf default vi /etc/nginx/sites-enabled/blogupstream blog { <!--server localhost:3000;--> server Unix:/var/www/maizi-blog/tmp/sockets/unicorn.sock; } # http Setting server { listen 80; server_home blog.thep.gq; } location / { proxy_set_header X-Forwarder-For Sproxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://blog; }*$ :wq!* $ sudo service nginx restart Restarting nginx nginx $ unicorn -c config/unicorn.rb $ unicorn -c config/unicorn.rb -D $ exit
自动化部署流程
(1)capistrano
https://github.com/capistrano-plugins/capistrano-unicorn-nginx
gem 'capistrano', '~> 3.6.1'
gem 'capistrano-unicorn-nginx', '~> 4.1.0'
bundle
cap install
Capfile加入插件
require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
require 'capistrano/unicorn_nginx'
修改config/deploy.rb文件
lock '3.4.0'
set :application, 'blog'
set :repo_url, 'https://github.com/bbtfr/maize-blog.git'
set :nginx_server_name, 'blog.theo.gq'
修改config/prodiction.rb文件
server 'mine', 'root' , roles: %w{app db web}
自动化部署方法:
cap production setup
接下来我们登录vps看一看:
cd /var/www/blog/shared/
ll
cd config/
ll
cat datavase.yml
cat secrets.yml
ll
exit
cap production deploy
(2)mina
下午:参加区块链线下活动
晚上:查看区块链的视频 从中国第一个区块链到星云链 - 徐义吉by DingDingTV https://www.youtube.com/watch?v=HtD9yRQ84IQ
区块链世界和新维度建设——星云链创始人演讲实况 https://www.youtube.com/watch?v=u2aDwjOLSd4
[ANS Legacy] Antshares Basic Development | 小蚁区块链技术开发分享 https://www.youtube.com/watch?v=WHON7h8d_Eo