A
certificate is considered a duplicate of an earlier certificate if they contain
the exact same set of hostnames, ignoring capitalization and ordering of
hostnames.
We also have a Duplicate Certificate limit of 5 certificates per week.
a
Renewal Exemption to the Certificates per Registered Domain limit.
The Duplicate Certificate limit and the Renewal Exemption ignore the public key
and extensions requested
You can issue 20 certificates in
week 1, 20 more certificates in week 2, and so on, while not interfering with
renewals of existing certificates.
Revoking certificates does not reset rate limits
If you’ve hit a rate limit, we don’t have a way to temporarily reset it.
get a list of certificates
issued for your registered domain by searching on crt.sh
Revoking certificates does not reset rate limits
If you have a large number of pending authorization objects and are getting a
rate limiting error, you can trigger a validation attempt for those
authorization objects by submitting a JWS-signed POST to one of its challenges, as
described in the
ACME spec.
If you do not
have logs containing the relevant authorization URLs, you need to wait for the
rate limit to expire.
having a large number of pending authorizations is generally the
result of a buggy client
application’s logic is a great example of a component
Aspects cross-cut our application - when we use some kind of persistence (e.g. a database) or network communication (such as ZMQ sockets)
our components need to know about it.
Aspect-oriented programming aims to get rid of cross-cuts by separating
aspect code from component code using injections of our aspects in certain join points
in our component code.
In most cases after and before advice are sufficient.
what does it mean to “evaluate code around” something?
In our case it means: Don’t run this method. Take it and push to my advice as an argument and evaluate this advice
to provide a join point
You’ll often see empty methods in code written in AOP paradigm
provide aspect code to link with our use case
use case is a pure domain object, without even knowing it’s connected with some kind of persistence and logging layer.
Aspect-oriented programming is fixing the problem with polluting pure logic objects with technical context of our applications.
we treat our glues as a configuration part, not the logic part of our apps.
Create an additional staging environment that closely resembles the
production one
Keep any additional configuration in YAML files under the config/ directory
Rails::Application.config_for(:yaml_file)
Use nested routes to express better the relationship between ActiveRecord
models
nest routes more than 1 level deep then use the shallow: true option
namespaced routes to group related actions
Don't use match to define any routes unless there is need to map multiple request types among [:get, :post, :patch, :put, :delete] to a single action using :via option.
Keep the controllers skinny
all the business logic
should naturally reside in the model
Share no more than two instance variables between a controller and a view.
using a template
Prefer render plain: over render text
Prefer corresponding symbols to numeric HTTP status codes
without abbreviations
Keep your models for business logic and data-persistence
only
Group macro-style methods (has_many, validates, etc) in the beginning of
the class definition
Prefer has_many :through to has_and_belongs_to_many
self[:attribute]
self[:attribute] = value
validates
Keep custom validators under app/validators
Consider extracting custom validators to a shared gem
preferable to make a class method instead which serves the
same purpose of the named scope
returns an ActiveRecord::Relation
object
.update_attributes
Override the to_param method of the model
Use the friendly_id gem. It allows creation of human-readable URLs by
using some descriptive attribute of the model instead of its id
find_each to iterate over a collection of AR objects
.find_each
.find_each
Looping through a
collection of records from the database (using the all method, for example)
is very inefficient since it will try to instantiate all the objects at once
always call
before_destroy callbacks that perform validation with prepend: true
Define the dependent option to the has_many and has_one associations
always use the exception raising bang! method or handle the method return value.
When persisting AR objects
Avoid string interpolation in
queries
param will be properly escaped
Consider using named placeholders instead of positional placeholders
use of find over where
when you need to retrieve a single record by id
use of find_by over where and find_by_attribute
use of where.not over SQL
use
heredocs with squish
Keep the schema.rb (or structure.sql) under version control.
Use rake db:schema:load instead of rake db:migrate to initialize an empty
database
Enforce default values in the migrations themselves instead of in the
application layer
change_column_default
imposing data integrity from
the Rails app is impossible
use the change method instead of up and down methods.
constructive migrations
use models in migrations, make sure you define them
so that you don't end up with broken migrations in the future
Don't use non-reversible migration commands in the change method.
In this case, block will be used by create_table in rollback
Never call the model layer directly from a view
Never make complex formatting in the views, export the formatting to a method
in the view helper or the model.
When the labels of an ActiveRecord model need to be translated, use the
activerecord scope
Separate the texts used in the views from translations of ActiveRecord
attributes
Place the locale files for the models in a folder locales/models
the
texts used in the views in folder locales/views
Use the dot-separated keys in the controllers and models
Reserve app/assets for custom stylesheets, javascripts, or images
Third party code such as jQuery or
bootstrap should be placed in
vendor/assets
Provide both HTML and plain-text view templates
config.action_mailer.raise_delivery_errors = true
Use a local SMTP server like
Mailcatcher in the development
environment
Provide default settings for the host name
The _url methods include the host name and the _path
methods don't
_url
Format the from and to addresses properly
default from:
sending html emails all styles should be inline
Sending emails while generating page response should be avoided. It causes
delays in loading of the page and request can timeout if multiple email are
sent.
.start_with?
.end_with?
&.
Config your timezone accordingly in application.rb
config.active_record.default_timezone = :local
it can be only :utc or :local
Don't use Time.parse
Time.zone.parse
Don't use Time.now
Time.zone.now
Put gems used only for development or testing in the appropriate group in the
Gemfile
Add all OS X specific gems to a darwin group in the Gemfile, and
all Linux specific gems to a linux group
Do not remove the Gemfile.lock from version control.
to connect to your backend using HTTPS instead of HTTP, set VIRTUAL_PROTO=https on the backend container.
The contents of /path/to/certs should contain the certificates and private keys for any virtual
hosts in use.
to replace the default proxy settings for the nginx container, add a configuration file at /etc/nginx/proxy.conf
The default configuration blocks the Proxy HTTP request header from being sent to downstream servers
add your configuration file under /etc/nginx/conf.d using a name ending in .conf
If your container exposes multiple ports, nginx-proxy will default to the service running on port 80. If you need to specify a different port, you can set a VIRTUAL_PORT env var to select a different one.
To add settings on a per-VIRTUAL_HOST basis, add your configuration file under /etc/nginx/vhost.d
SNI
The default behavior for the proxy when port 80 and 443 are exposed is as follows:
If a container has a usable cert, port 80 will redirect to 443 for that container so that HTTPS
is always preferred when available.
If the container does not have a usable cert, a 503 will be returned.
The Service Discovery feature watches for Docker events like when a container is created, destroyed, started or stopped. When one of these happens, the Agent identifies which service is impacted, loads the configuration template for this image, and automatically sets up its checks.
Configuration templates can be defined by simple template files or as single key-value stores using etcd or Consul.
In my opinion, understanding how a technology works under the hood is the best way to achieve learning speed and to build confidence that you are using the tool in the correct way.
The top-level layer may be read by a union-ing file system (AUFS on my docker implementation) to present a single cohesive view of all the changes as one read-only file system
before(:all) hooks are invoked before the transaction is opened. You can use
this to speed things up by creating data once before any example in a group is
run