provides a framework to concatenate and minify or compress
JavaScript and CSS assets
Sourcegraph - 0 views
Sandstorm - 0 views
83More
The Asset Pipeline - Ruby on Rails Guides - 0 views
-
adds the ability to write these assets in other languages and pre-processors such as CoffeeScript, Sass and ERB
- ...80 more annotations...
-
Starting with version 3.1, Rails defaults to concatenating all JavaScript files into one master .js file and all CSS files into one master .css file
-
In production, Rails inserts an MD5 fingerprint into each filename so that the file is cached by the web browser
-
The technique sprockets uses for fingerprinting is to insert a hash of the content into the name, usually at the end.
-
The sass-rails gem is automatically used for CSS compression if included in Gemfile and no config.assets.css_compressor option is set.
-
When a filename is unique and based on its content, HTTP headers can be set to encourage caches everywhere (whether at CDNs, at ISPs, in networking equipment, or in web browsers) to keep their own copy of the content
-
app/assets is for assets that are owned by the application, such as custom images, JavaScript files or stylesheets.
-
lib/assets is for your own libraries' code that doesn't really fit into the scope of the application or those libraries which are shared across applications.
-
vendor/assets is for assets that are owned by outside entities, such as code for JavaScript plugins and CSS frameworks.
-
By default these files will be ready to use by your application immediately using the require_tree directive.
-
By default, this means the files in app/assets take precedence, and will mask corresponding paths in lib and vendor
-
if you add an erb extension to a CSS asset (for example, application.css.erb), then helpers like asset_path are available in your CSS rules
-
If you add an erb extension to a JavaScript asset, making it something such as application.js.erb, then you can use the asset_path helper in your JavaScript code
-
data URI — a method of embedding the image data directly into the CSS file — you can use the asset_data_uri helper.
-
Sprockets will also look through the paths specified in config.assets.paths, which includes the standard application paths and any paths added by Rails engines.
-
sass-rails provides -url and -path helpers (hyphenated in Sass, underscored in Ruby) for the following asset classes: image, font, video, audio, JavaScript and stylesheet.
-
The require_tree directive tells Sprockets to recursively include all JavaScript files in the specified directory into the output.
-
manifest files contain directives — instructions that tell Sprockets which files to require in order to build a single CSS or JavaScript file.
-
Directives are processed top to bottom, but the order in which files are included by require_tree is unspecified.
-
You need not supply the extensions explicitly. Sprockets assumes you are requiring a .js file when done from within a .js file
-
Rails 4 creates both app/assets/javascripts/application.js and app/assets/stylesheets/application.css regardless of whether the --skip-sprockets option is used when creating a new rails application.
-
Additional layers of preprocessing can be requested by adding other extensions, where each extension is processed in a right-to-left manner
-
In development mode, assets are served as separate files in the order they are specified in the manifest file.
-
when these files are requested they are processed by the processors provided by the coffee-script and sass gems and then sent back to the browser as JavaScript and CSS respectively.
-
By default Rails assumes that assets have been precompiled and will be served as static assets by your web server
-
If you set config.assets.initialize_on_precompile to false, be sure to test rake assets:precompile locally before deploying
-
By default Rails assumes assets have been precompiled and will be served as static assets by your web server.
-
The X-Sendfile header is a directive to the web server to ignore the response from the application, and instead serve a specified file from disk
1More
PHP 開發者使用 Let's Encrypt 的好搭檔 - Acme PHP - 興趣使然的程式猿 - Medium - 1 views
2More
Rails Application Templates - Ruby on Rails Guides - 1 views
HMAC-based One-time Password Algorithm - Wikipedia - 0 views
cmder | Console Emulator - 0 views
Conflict-free replicated data type - Wikipedia - 0 views
31More
An Introduction to HAProxy and Load Balancing Concepts | DigitalOcean - 0 views
-
improve the performance and reliability of a server environment by distributing the workload across multiple servers (e.g. web, application, database).
-
ACLs are used to test some condition and perform an action (e.g. select a server, or block a request) based on the test result.
- ...28 more annotations...
-
ACLs allows flexible network traffic forwarding based on a variety of factors like pattern-matching and the number of connections to a backend
-
adding more servers to your backend will increase your potential load capacity by spreading the load over multiple servers
-
use_backend rules, which define which backends to use depending on which ACL conditions are matched, and/or a default_backend rule that handles every other case
-
Generally, all of the servers in the web-backend should be serving identical content--otherwise the user might receive inconsistent content.
-
Using layer 7 allows the load balancer to forward requests to different backend servers based on the content of the user's request.
-
require that a user continues to connect to the same backend server. This persistence is achieved through sticky sessions, using the appsession parameter in the backend that requires it.
-
If a server fails a health check, and therefore is unable to serve requests, it is automatically disabled in the backend
-
For certain types of backends, like database servers in certain situations, the default health check is insufficient to determine whether a server is still healthy.
-
However, your load balancer is a single point of failure in these setups; if it goes down or gets overwhelmed with requests, it can cause high latency or downtime for your service.
-
If that load balancer fails, your failover mechanism will detect it and automatically reassign the IP address to one of the passive servers.
53More
Understanding the Nginx Configuration File Structure and Configuration Contexts | Digit... - 0 views
-
discussing the basic structure of an Nginx configuration file along with some guidelines on how to design your files
-
In Nginx parlance, the areas that these brackets define are called "contexts" because they contain configuration details that are separated according to their area of concern
- ...50 more annotations...
-
if a directive is valid in multiple nested scopes, a declaration in a broader context will be passed on to any child contexts as default values.
-
Nginx will error out on reading a configuration file with directives that are declared in the wrong context.
-
The "events" context is contained within the "main" context. It is used to set global options that affect how Nginx handles connections at a general level.
-
Nginx uses an event-based connection processing model, so the directives defined within this context determine how worker processes should handle connections.
-
the connection processing method is automatically selected based on the most efficient choice that the platform has available
-
When configuring Nginx as a web server or reverse proxy, the "http" context will hold the majority of the configuration.
-
The http context is a sibling of the events context, so they should be listed side-by-side, rather than nested
-
fine-tune the TCP keep alive settings (keepalive_disable, keepalive_requests, and keepalive_timeout)
-
Each client request will be handled according to the configuration defined in a single server context, so Nginx must decide which server context is most appropriate based on details of the request.
-
multiple location contexts can be defined, each location is used to handle a certain type of client request, and each location is selected by virtue of matching the location definition against the client request through a selection algorithm
-
Location blocks live within server contexts and, unlike server blocks, can be nested inside one another.
-
While server contexts are selected based on the requested IP address/port combination and the host name in the "Host" header, location blocks further divide up the request handling within a server block by looking at the request URI
-
The request URI is the portion of the request that comes after the domain name or IP address/port combination.
-
New directives at this level allow you to reach locations outside of the document root (alias), mark the location as only internally accessible (internal), and proxy to other servers or locations (using http, fastcgi, scgi, and uwsgi proxying).
-
The upstream context should be placed within the http context, outside of any specific server contexts.
-
The upstream context can then be referenced by name within server or location blocks to pass requests of a certain type to the pool of servers that have been defined.
-
Since Nginx will test conditions of a request with many other purpose-made directives, if should not be used for most forms of conditional execution.
-
The limit_except context is used to restrict the use of certain HTTP methods within a location context.
-
The result of the above example is that any client can use the GET and HEAD verbs, but only clients coming from the 192.168.1.1/24 subnet are allowed to use other methods.
-
it is usually best to declare directives in the highest context to which they are applicable, and overriding them in lower contexts as necessary.
-
Nginx already engages in a well-documented selection algorithm for things like selecting server blocks and location blocks.
-
instead of relying on rewrites to get a user supplied request into the format that you would like to work with, you should try to set up two blocks for the request, one of which represents the desired method, and the other that catches messy requests and redirects (and possibly rewrites) them to your correct block.
-
incorrect requests can get by with a redirect rather than a rewrite, which should execute with lower overhead.
LightVM - Systems and Machine Learning - 0 views
View AllMost Active Members
View AllTop 10 Tags
- 151system
- 133programming
- 102docker
- 101rails
- 89development
- 83devops
- 81kubernetes
- 80javascript
- 77database
- 71ruby
- 68linux
- 64web
- 61server
- 58networking
- 52security
- 49python
- 42mysql
- 42php
- 40framework
- 35performance