vendredi 1 juillet 2016

Rails 3.2.3, how to config Memcached::dalli correctly in my production env

First of all, i introduce my situation :

My web apps is an OA(office assistance) system. i have one server hosting for all my clients, each client has a subdomain like http://ift.tt/297plFv to access to web apps. For example: There are three different clients, and their website link like :

...
http://ift.tt/297plFv
http://ift.tt/298bT0F
http://ift.tt/297psRw
...

Via Nginx + Thin, each website has his own port like this:

...
http://ift.tt/297plFv => my_ip_address:3000
http://ift.tt/298bT0F => my_ip_address:3001
http://ift.tt/297psRw => my_ip_address:3002
...

As you know, each website has his own environement :

Nginx
/etc/nginx/sites-available/3000-subdomain1
/etc/nginx/sites-available/3001-subdomain2
/etc/nginx/sites-available/3002-subdomain3

Thin
/etc/thin/3000-subdomain1.yml
/etc/thin/3001-subdomain2.yml
/etc/thin/3002-subdomain3.yml

Envs:
config/environments/subdomain1.rb # production mode
config/environments/subdomain2.rb # production mode
config/environments/subdomain3.rb # production mode

My question is how to config cache_store ? i use Memcached :: Dalli

I tried do this in config/environments/subdomain1.rb:

...
config.cache_store = :dalli_store, 'subdomain1.myapp.com',{ :namespace => Myapp, :expires_in => 1.day, :compress => true }
...

But i have doute for the second and third parameter subdomain1.myapp.com , :namespace => Myapp, Shoud i use my_ip_address:[port] or true url like (subdomain1.myapp.com) or just 127.0.0.1:[port] or nil ? Why ?

Shoud i remove the namespace or not ? Why ?

Any suggestion is welcome Thank you.

Aucun commentaire:

Enregistrer un commentaire