makandra Operations

If you want to perform a failover on another haproxy backend server this is the way you should do it: Gather information Via hatop Note: Please mind that the names...

...of frontends / backends / servers are only examples. Mind this when you want to use the shown CLI commands. The path to the haproxy socket may also vary. Example: We have...

makandra dev

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

This is a way to run multiple redis server on one ubuntu server. These steps you have to do only once: Adjust init script Change some Variables. From this:

...ARGS=/etc/redis/redis.conf NAME=redis-server DESC=redis-server PIDFILE=/var/run/redis.pid to this: NAME=`basename ${0}` DAEMON_ARGS=/etc/redis/${NAME}.conf DESC=${NAME} PIDFILE=/var/run/${NAME}.pid Move redis configuration ^

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

...is from a real project: In a long form, a automatically validates against the server when changed. One test changed the , then immediately scrolled down many pages and submitted the...

...JavaScript periodically requests updates from a server to keep a in sync with the latest server-site data. Sometimes the test ended right after a polling request was sent, but...

...quite annoying when you have multiple deployment targets with different hostnames, e.g. a staging server and a production server. Using the hack below you don't need to configure default...

...request.protocol ActionMailer::Base.default_url_options[:host] = request.host_with_port end end If your application server talks only HTTP and relies on the web server for SSL, and if the web...

...malicious users can upload executables (like an .exe or .scr file) and use your server to distribute it. However, modern operating systems usually warn before executing files that were downloaded...

...be spoofed. When the user later accesses a file upload via an URL, the server will choose a Content-Type header based on the file's extension, regardless of what...

...Eventually you will want want the same detection logic to be available on both server and client side. This card shows how to get a Ruby method touch_device? for...

When an AJAX request raises an exception on the server, Rails will show a minimal error page with only basic information. Because all Unpoly updates work using AJAX requests, you...

...need to update the isDevelopmentError() function so it returns true when your particular development server shows an error. Unpoly >= 2.x // Only do this in development. This requires a `[data...

If your Rails application is using Webpack you need to serve assets on the same host as you application runs, otherwise you will see the following errors in your browser...

So if you are using awesome.vcap.me:3000 you need to start the webpack-dev-server with a different host than localhost (0.0.0.0): bin/webpack-dev-server --host awesome.vcap.me

...HTTP request for every asset and block other assets from being loaded until the server responds with 304 not modified. This will slow down your page loading considerably, and cause...

...unnecessary load on your servers. This card describes how you can setup your application in a way that browsers can properly cache your assets. The caching conundrum A caching solution...

If you are a makandra employee and are running your app on makandra servers, you can skip this step. All servers and developer machines at makandra are already configured...

...is not gitignored, or your changes are only valid for your machine, not any servers. Inside a Docker environment, this file might be ignored. How to fix. Globally:

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

makandra dev

...yourself. Do not manipulate package.json yourself. Yarn will do this for you. The dev server If might have noticed that adding webpack made you development server pretty slow. To increase...

...performance, open a separate terminal, and run bin/webpack-dev-server. The dev server will watch all your changes and compile everything automatically in the background. It will also auto-reload your code...

This is an attempt to list some of those things: On the server Always optimize: Don't do stupid things with the database. Avoid "n + 1" queries. Don...

...complicated table, or crazy visualization in a separate AJAX call? Move work from the server to the client. On the client The biggest issue on the client are loading times...

github.com

The maintenance mode is enabled on all application server as soon as the file /public/system/maintenance.html is present. Installation Add this line to your application's Gemfile: gem 'capistrano...

...application's web interface by writing a #{maintenance_basename}.html file to each web server. The servers must be configured to detect the presence of this file, and if it...

...and we want user names to be unique) The requests are accepted on the server by two worker processes who will now process them in parallel Both requests scan the...

...and we want user names to be unique) The requests are accepted on the server by two worker processes who will now process them in parallel Both requests scan the...

...response includes caching headers like Expires or Cache-Control, their validity depends on the server's Date header if present. Otherwise, the browser uses its local time. This can lead...

...its own local system time. This subtle behavior ensures that cookies remain consistent with server time, even if the client’s clock is incorrect. However, this can lead to unexpected...

...old to match the format created by pg_dump. The version of the PostgreSQL server doesn't matter here. For example, the official Ubuntu 20.04 sources include only PostgreSQL...

...workaround below. Background Creating and restoring a database dump has four components: the source server, pg_dump, the target server, and pg_restore. pg_dump will create a dump, and...

...used to redirects always resulting in a GET request. # Browser sends PATCH /foo HTTP/1.1 # Server responds HTTP/1.1 302 Found Location: /bar # Browser follows redirect PATCH /bar # Server responds

...is neither GET or POST. Some workarounds for this issue below. Fix on the server: Redirect with a modern status code If your redirecting action redirects with a HTTP status...

For our production servers we use Passenger as a Ruby application server. While it is possible to use Passenger for development as an Apache module, the installation process is not...

Get performance behavior that is closer to what you'll get on production servers Get a full-featured Ruby application server without configuration Usage Install Passenger Standalone with gem...

makandra dev

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

Your development server is usually running on an insecure HTTP connection which is perfectly fine for development. If you need your local dev server to be accessible via HTTPS for...

...to do this again in a month or a year. Next, start your application server for HTTPS. For a Rails application with Puma: bin/rails server -b 'ssl://0.0.0.0:3000?key...

makandra Curriculum

Rubber ducking: not just a funny phrase Debugging in Ruby Note Running your server as part of a single combined terminal with the bin/dev command makes Ruby debugging harder...

...To work around this, you should start your web server in a separate terminal as described above. If you are using terminator, bin/term is the easiest way to to achieve...