我遇到了Rails 3.1资产管道的问题.资产包括两次开发:
<script src="/assets/main_new.js?body=1" type="text/javascript"></script>
<script src="/assets/pagenav.js?body=1" type="text/javascript"></script>
<script src="/assets/tours.controller.js?body=1" type="text/javascript"></script>
<script src="/assets/tours.js?body=1" type="text/javascript"></script>
<script src="/assets/application.js?body=1" type="text/javascript"></script>
Run Code Online (Sandbox Code Playgroud)
Rails以某种方式编译并包含application.js,因此所有脚本都包含两次 - 作为单个文件和application.js
生产中的预编译资产一切都很好.
development.rb
config.assets.compress = false
config.assets.debug = true
Run Code Online (Sandbox Code Playgroud)
production.rb
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Compress both stylesheets and JavaScripts
config.assets.compress = true
config.assets.js_compressor = :uglifier
config.assets.css_compressor = :scss
config.assets.compile = false
config.assets.digest = true
Run Code Online (Sandbox Code Playgroud)
application.rb中
config.assets.enabled = true
Run Code Online (Sandbox Code Playgroud) 如何通过我的Squid代理限制只访问一个网站?
以下不起作用......
acl amazon_ireland src 79.125.0.0/17
acl some_site url_regex google
http_access allow amazon_ireland
http_access allow some_site
http_access deny all
Run Code Online (Sandbox Code Playgroud) 我为我的Rails应用程序运行了4个Unicorn进程,它们占用了所有可用的MySQL连接,导致它因"连接太多"错误而崩溃.今天我不得不重启我的数据库实例4次.=(
流程
$ ps ax | grep [u]ni 21618 ? Sl 0:15 unicorn master -D -c /home/deployer/apps/XXX/shared/config/unicorn.rb -E production 21632 ? Sl 0:20 unicorn worker[0] -D -c /home/deployer/apps/XXX/shared/config/unicorn.rb -E production 21636 ? Sl 0:14 unicorn worker[1] -D -c /home/deployer/apps/XXX/shared/config/unicorn.rb -E production 21640 ? Sl 0:20 unicorn worker[2] -D -c /home/deployer/apps/XXX/shared/config/unicorn.rb -E production 21645 ? Sl 0:12 unicorn worker[3] -D -c /home/deployer/apps/XXX/shared/config/unicorn.rb -E production
我的database.yml为ActiveRecord池设置了22个连接......
... production: adapter: mysql2 encoding: utf8 database: xxx username: xxx password: xxx host: xxx …