...a new connection end end These three connections will remain connected to the database server after the threads terminate. This only affects threads that use ActiveRecord. You can rely on...
...outlined below. This may cause your application to open more connections than your database server allows. If you don't want to risk that, you can also manually release connections...
When your Rails application server raises error, Capybara will fail your test when it clears the session after the last step. The effect is a test that passes all steps...
%r{No route matches .*"/uploads/test/\d+-[\d\-]+/[^"]+"}i, ].freeze def raise_server_error! super rescue StandardError => e # Ignore errors about missing source maps unless IGNORE_MESSAGES.any? { |ignore_message...
Maintenance mode is enabled on application server as soon as the file /public/system/maintenance.html is present. Note that the servers must be configured accordingly. Installation Add this line to your...
...application's web interface by writing a #{maintenance_basename}.html file to each web server. By default, the maintenance page will just say the site is down for "maintenance", and...
...sure the Vary: Accept header is set. Proxy caching is a good feature to serve your publicly visible application content faster and reduce load on your servers. It is e.g...
...server SHOULD include a Vary header field with any cacheable response that is subject to server-driven negotiation. Doing so allows a cache to properly interpret future requests on that...
...ms (queries: 8, input: 1218, output: 158) | GC: 87.7ms) This extends Rails 7 Server Timings, so the same numbers also show up in the browser's DevTools "Server Timing...
Understanding your type of cronjob Some cronjobs must only run on a single server. E.g. when you run nightly batch operations on the database, it should probably run on a...
...single server. Running it on multiple servers would likely result in deadlocks or corrupt data. Some cronjobs must always run on all servers. E.g. starting a sidekiq process on reboot...
Sometimes you need to access a dev server running on localhost from another machine that is not part of the same network. Maybe you want to use your phone to...
...the past, we often used some port forwarding or other techniques to expose the service to the internet. Enter ngrok, a command line tool that gives you an on-the...
If you want to know the currently deployed release, simply SSH to a server and view that file. $ cat /var/www/my-project/current/REVISION cf8734ece3938fc67262ad5e0d4336f820689307 Capistrano task When your application is deployed to...
...multiple servers, you probably want to see a result for all of them. Here is a Capistrano task that checks all servers with the :app role. namespace :app do
...heise.de mail is handled by 10 relay.heise.de. nslookup query Internet domain name servers. Nslookup has two modes: interactive and non-interactive. >nslookup heise.de Server: 146.254.160.30 Address: 146.254.160.30#53 Non-authoritative...
...have to type in domain names and press enter to get the infos. The Server in the first line is your DNS resolver. To use a specific one, you can...
...the number of releases grows, junk clogs up the hard drive of our application servers: Old release code Old tmp folders with compiled view templates etc. Precompiled assets (Javascripts, images...
...will symlink the public/assets directory to shared/assets. This is cool since we can still serve previous assets after a new release, in the window where browser caches might still have...
...for HTTP or 443 for HTTPS. You can use nmap to find out what service is running behind a given port, and most often see some details about it. This...
...can be helpful if servers don't offer the services you expect for some ports. If you'd like to see what ports are listing on your local machine, you...
Sometimes you just want to have a small web server that serves files to test something. Serve the current directory On Ruby 1.9.2+ you can do the following ("." for current...
...same way with Python 3.x python -m http.server In both cases your web server is single-threaded and will block when large files are being downloaded from you.
...a state transition while updating the record. To process a form with multiple buttons, your server-side code will need to know which button was pressed. To do so you...
...not allow to recolor the image using CSS. Inline- are unnecessary work for the server and are not cached. Icon-fonts require complicated setup and are unnecessarily large. In times...
Rails has configurable time zones, while Ruby is always in the server's time zone Thus, using Ruby's time API will give you wrong results for...
...can, however, tell Rails the only single time zone you'll need is the server's. config.time_zone = "Berlin" # Local time zone config.active_record.default_timezone = :local config.active_record.time_zone_aware_attributes = false...
We generally use multiple application servers (at least two) and you have to search on all of them if you don't know which one handled the request you are...
Rails application logs usually live in /var/www/ /shared/log. Web server logs usually live in /var/www/ /log. Searching through single logs with grep / zgrep You can use grep in...
...on http://127.0.0.1:39949 You can disable this behavior by tweaking Capybara's Puma server in your spec/support/capybara.rb: Capybara.server = :puma, { Silent: true } Note You don't need to configure this...
This card describes four variants, that add a more intuitive workflow when working with nested attributes in Rails + Unpoly:
...To do that you need the secret key which should only live on the servers. Do not download these key files to your local dev environment. They are sensitive and...
...Rails console does not crash while starting up. Disable eager loading again. Get rails server running Fix all errors until rails server can render a page. Click around a bit...
...CORS request, it adds an Origin: header with the origin (protocol + hostname + port). The server decides whether access is acceptable for this origin and adds the Access-Control-Allow-Origin...
...This way, CORS puts cross-domain access control in the hands of the requested server. Certain request types (mostly non-GET requests) require a special "preflight" request that checks server...
This Capistrano task runs a command on all servers. bundle exec cap production app:run cmd='zgrep -P "..." RAILS_ROOT/log/production.log' Code # lib/capistrano/tasks/app.rake namespace :app do # Use e.g. to grep logs...
...on all servers: # b cap production app:run_cmd cmd='zgrep -P "..." RAILS_ROOT/log/production.log' # # * Use RAILS_ROOT as a placeholder for the remote Rails root directory. # * Append ` || test $? =1;` to...
...power to ['creatable_cards'] The reason for this behavior is that the Capybara test server is running in another thread, and the RSpec thread can't "see" the exception at...
...user sees in this situation, e.g. an error flash. ¹ Rack::Test features emulate the server within the same thread and will therefore "see" those exceptions The test thread and server...
...on all of them. 3) Switch to a persisted storage for sessions on the server Another option to prevent this session replay attack is to switch to persisted storage for...