General steps to replace unicorn in old projects

Source: Internet
Author: User

The general steps for the old project to replace Unicorn:

(1) Modify config/Application.rb
Delete
# assign log4r ' s logger as rails ' logger.
Log4r_config= Yaml.load_file (File.join (File.dirname (__file__), "Log4r.yml"))
Yamlconfigurator.decode_yaml (log4r_config[' log4r_config ')
Config.logger = log4r::logger[rails.env]
New configuration for memcached
Config.cache_store =:d Alli_store, *settings.memcached.servers,
{: namespace = Settings.memcached.namespace,: Compress = true}

(2) Create a new config/deploy/folder,
New PRODUCTION.RB
Staging.rb

(3) New config/environments/
Development.rb
Production.rb
Staging.rb
Test.rb

(4) Modify gemfile, delete thin, add unicorn
Panax Notoginseng Gem ' Dalli '
The Gem ' unicorn '
39
Group:test,:d evelopment do
The gem "Rspec-rails", ">= 2.5.0"
Gem ' Factory_girl ', ' 2.6.4 '
Gem ' factory_girl_rails ', ' 1.7.0 '
The Gem ' Faker ', ' 1.1.2 '
Gem ' forgery ', ' 0.5.0 '
The Gem ' magic_encoding ', ' 0.0.2 '
The Gem ' Email_spec ', ' 1.4.0 '
48
Net-ssh ', ' ~> 2.0 '
Gem ' Capistrano ', ' ~> 2.15.7 '
Wuyi Gem ' capistrano-rbenv ', ' 1.0.5 '
The Gem ' rb-readline ', ' 0.4.2 '
The end

(5) Modify the configuration of the configuration config/settings.yml
181 memcached:
182 namespace:xxx-xxxxx-cms-staging
183 Servers:
184-127.0.0.1:11215

(6) Configuring the Config/deploy.rb file

(7) Bundle EXEC Cap Deploy:setup
Bundle EXEC Cap Deploy:cold

Deployment issues that may occur
(1) Could not parse object (due to set:repository caused by writing the wrong config/deploy.rb)


(2) CONFIG/APPLICATION.RB configuration is not automatically recognized uninitialized constant cms::application::settings
Modified Gemfile, Gem "Rails_config", ' 0.3.4 '


(3)/home/wz/.rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/activesupport-3.0.8/lib/active_support/ Cache.rb:65:in ' Rescue in Lookup_store ': Could not the find cache store adapter for Dalli_store (cannot load such file--ACTI Ve_support/cache/dalli_store) (RuntimeError)
Need to add

Gem ' Dalli '

The final step is to make a soft link to the Nginx configuration in the project folder directory.
$ nginx-t
Nginx:the configuration file/opt/nginx/conf/nginx.conf syntax is OK
Nginx:configuration file/opt/nginx/conf/nginx.conf Test is successful

$ ln-s/opt/app/ruby/tudou-tv-cms-unicorn/current/config/nginx.staging.conf/opt/nginx/conf/tudou_tv_cms.conf
12:33 [[Email protected]]$ nginx-t
Nginx:the configuration file/opt/nginx/conf/nginx.conf syntax is OK
Nginx:configuration file/opt/nginx/conf/nginx.conf Test is successful
Tty:[0] jobs:[0] cwd:[~]
12:33 [[Email protected]]$ nginx-s Reload
Tty:[0] jobs:[0] cwd:[~]
12:33 [[Email protected]]$ NETSTAT-TLNP | grep 52
TCP 0 0 0.0.0.0:5200 0.0.0.0:* LISTEN 20263/nginx
TCP 0 0 10.100.14.83:5308 0.0.0.0:* LISTEN 1526/CFSERVD
TCP 0 0 0.0.0.0:5218 0.0.0.0:* LISTEN 1391/thin Server (0
12:33 [[Email protected]]$ vim/opt/nginx/conf/nginx.conf
Here is a new link to include in
Include tudou_tv_cms.conf;
Tty:[0] jobs:[0] cwd:[~]
12:34 [[Email protected]]$ nginx-t
Nginx:the configuration file/opt/nginx/conf/nginx.conf syntax is OK
Nginx:configuration file/opt/nginx/conf/nginx.conf Test is successful
Tty:[0] jobs:[0] cwd:[~]
12:34 [[Email protected]]$ nginx-s Reload
Tty:[0] jobs:[0] cwd:[~]
12:34 [[Email protected]]$ NETSTAT-TLNP
Active Internet connections (only servers)
Proto recv-q send-q Local address Foreign address State Pid/program Name
TCP 0 0 0.0.0.0:6500 0.0.0.0:* LISTEN 2347/thin Server (0
TCP 0 0 0.0.0.0:6565 0.0.0.0:* LISTEN 20307/nginx
TCP 0 0 0.0.0.0:5030 0.0.0.0:* LISTEN 20307/nginx
TCP 0 0 0.0.0.0:22022 0.0.0.0:* LISTEN 26901/sshd
TCP 0 0 127.0.0.1:199 0.0.0.0:* LISTEN 26927/snmpd
TCP 0 0 127.0.0.1:6600 0.0.0.0:* LISTEN 11834/uwsgi

General steps to replace unicorn in old projects

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.