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 :deploy do

...request which is not what you want. Instead a blob is created on the server, the file is uploaded and your form receives a generated hidden input field carrying the...

...false. However, this will also disable a ll other routes like update_rails_disk_service_url which you will need. Another solution would be to call a power that returns...

...install a modern libvips version using our PPA. If you're hosting on makandra servers these packages have already been installed on your application servers. RubyGem In your Ruby code...

...send a default ETag by hashing the response body. While this still requires the server to re-render the view for unchanged content, you don't need to send unchanged...

...Network infrastructure may mutate your ETag I recommend to deploy your app to a server and see if you get the same ETag for two responses to the same URL...

...always is to prevent long-running queries in the first place, automatic timeouts can serve as a safety net to terminate problematic queries automatically if a set time limit is...

...both databases offer a variable to limit the execution time of queries. While they serve similar purposes they do have some differences in behavior and implementation. PostgreSQL Timeout Type: statement...

github.com

gem 'capistrano-passenger', require: false Add to your Capfile: require 'capistrano/passenger' Declare which server role should be restarted (optional). Usually passenger tries to restart all servers with the app...

...role. If you have dedicated Sidekiq servers with the app role, adjust the passenger_roles setting to exclude them. set :passenger_roles, :app # This is the default Remove any homegrown...

makandra dev

There are two ways a logout in SAML can happen: Service Provider (SP) initiated and Identity Provider (IDP) initiated logout. I'll explain how to implement both flows with devise...

...triggers a DELETE /users/sign_out (at least for devise_saml_authenticatable, others might differ) The server generates a SAML LogoutRequest and responds with a redirect the the SingleLogoutService HTTP-Redirect Binding...

...delay (5 seconds in the example), the component makes a request to /foo. The server is expected to respond with HTML containing an element with the same [id] (news in...

The component parses the server response (using DOMParser) and extracts the element with the matching [id] attribute. The component replaces the component with the matching element from the...

...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...

...Saving files to a directory that is not shared between deploys or servers If you save your uploads to a made up directory like "RAILS_ROOT/uploads", this directory goes away...

...every release gets a new). Also this directory is not shared between multiple application servers, so your uploads are randomly saved to one local filesystem or another. Fixing this afterwards...

When your public-facing application has a longer downtime for server maintenance or long migrations, it's nice to setup a maintenance page to inform your users. When delivering the...

...for maintenance pages The best HTTP status code for your maintenance page is "503 Service Unavailable": The server is currently unable to handle the request due to a temporary overloading...

...the console, your test may fail after the last step. With unlucky timing the server may receive an AJAX request as the browser tab closes, causing a connection abort when...

...trying to send the response. Since Capybara fails a test if there is a server error this may produce a flaky test. Waiting for pending AJAX requests The following module...

makandra dev

...sometimes outside of our control. For example, on one of our bigger projects, our servers are on a denylist for all of Microsoft's cloud e-mail (like @outlook.com) for...

...were rejected. We then started to send out e-mails via Amazon's SES service, only to discover that we were now blocked by several German providers like @web.de.

...applications can be used by multiple users at the same time. A typical application server like Passenger has multiple worker processes for a single app. In a distributed deployment setup...

...like we use at makandra you will even have multiple application servers, each with their own worker pool. This means that your code needs to deal with concurrent data access...

...form. It runs inside your application and does not depend on an external SaaS service. Truemail supports different validation "layers": Regex validation: if the given address is syntactically valid

...on the other hand means that Truemail will connect to the target mail server and try to start email delivery. If you do this too often, your app servers might...

...at first, but is required for Time.current to work properly. If possible, put your server into local time zone, since Ruby's Time will use that. In the example above...

Time.now will be your local time (or the local time of your server) >> Project.create! >> Project.connection.select_one('SELECT created_at FROM projects') => {"created_at...

...can churn wildly A big drawback of db/structure.sql is that different developer PCs or servers may create slightly different SQL output. Since this file is rewritten with every migration run...

...Possible reasons for this churn include: Two developers use different versions of the database server (e.g. PostgreSQL 16 vs. 17). Two developers use the same version of the database server...

...überprüfen kannst, ob ein Zertifikat zu einem Private Key gehört. Du verstehst, wie ein Server Inhalte verschlüsseln kann, die dann ein Client entschlüsseln kann. Du weißt wie ein Client seinen...

...Schlüssel sicher zu einem Server übertragen kann Du weißt, für was das Feld "Common Name" in einem SSL/TLS Zertifikat da ist. Du weißt, für was das Feld "Subject Alternative Names...

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...

makandra dev

...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...

makandra dev

...below accordingly. Basic idea We will use the guard-livereload gem as the livereload server (which send updates to the browser), use the livereload-js npm package in the browser...

...to connect to the livereload server, not use rack-livereload any more as this is unnecessarily complex and does not work with many CSP policies. We will configure guard-livereload...

DevOps Curriculum

In dieser Card machst du einige Übungsaufgaben um Linux Server mit Ansible zu verwalten. Da es vermutlich zu aufwendig ist alles von 0 auf selbst zu erstellen, solltest du prüfen...

Beachte bei deinem Setup, dass du vielleicht nicht nur eine Wordpress Installation pro Server haben möchtest (mehrere Vhosts beim Nginx, mehrere PHP-FPM Konfigurationen, mehrere User). Dafür müssen auch...

set :assets_roles, %i[webpack] # Give the webpack role to a single server (see code block below) set :assets_prefix, 'packs' # Assets are located in /packs/

...related to Webpacker, but a nice thing Give the webpack role to a single server: # config/deploy/production.rb (analog to config/deploy/staging.rb) ... server ' ', user: ' ', roles: %w(... webpack) Make sure to read as well...

...if you do not know. How are cookies transferred between your browser and the server? Open the development tools in your browser for this page. Can you find the cookies...

...network tab, can you see how the cookies are transferred to or from the server? Can you log yourself out by manipulating a cookie? Can you log yourself back in...