This blogpost shows how to setup Rails 6 with Bootstrap 4.
This snippet shows a somehow different and less customized approach.
$ rails new rails6-bootstrap4
$ bundle --binstubs
$ yarn add bootstrap jquery popper.js expose-loader
# Basic key operators to query the JSON objects : | |
# #> : Get the JSON object at that path (if you need to do something fancy) | |
# -> : Get the JSON object at that path (if you don't) | |
# ->> : Get the JSON object at that path as text | |
# {obj, n} : Get the nth item in that object | |
# https://www.postgresql.org/docs/9.4/functions-json.html#FUNCTIONS-JSONB-OP-TABLE | |
# Date | |
# date before today |
# Ruby pattern matching based on Type (=> operator) | |
[1,2,3] => [1, Integer, my_variable] | |
# This means: | |
# We want to assign `my_variable` (variable binding), | |
# but only if the first position is 1 and second position is an Integer) | |
my_variable # => 3 ✨ | |
# What if it doesn't match? You get an exception 💣 | |
[1,2,3] => [Integer, String, my_variable] | |
# [1, 2, 3]: String === 2 does not return true (NoMatchingPatternError) |
# sudo vi /etc/nginx/sites-enabled/unicorn.qna.conf | |
# это директива nginx которая указывает список бэкенд серверов которые физически будут обрабатывать запрос и таким образом nginx будет проксировать запросы к указанным серверам и даже как loadbalancer | |
upstream unicorn { | |
server unix:/home/deployer/qna/shared/tmp/sockets/unicorn.qna.sock fail_timeout=0; # описали сервер ссылающийся на сокет а можно было на ip и таких серверов может быть несколько, fail_timeout - означает что nginx не будет посылать запросы если наш сервер не отвечает | |
} | |
# к этому никакого отношения upstream не имеет | |
server { | |
listen 80; |
# ... | |
store_with S3 do |s3| | |
s3.access_key_id = "your_key" | |
s3.secret_access_key = "your_pass" | |
s3.bucket = "your_bucket_name" | |
s3.path = "your_path_to_backup" | |
s3.region = "ru-central1" | |
s3.fog_options = { endpoint: "https://storage.yandexcloud.net" } | |
end |
This blogpost shows how to setup Rails 6 with Bootstrap 4.
This snippet shows a somehow different and less customized approach.
$ rails new rails6-bootstrap4
$ bundle --binstubs
$ yarn add bootstrap jquery popper.js expose-loader
require 'active_record/connection_adapters/sqlite3_adapter' | |
# | |
# Monkey-patch for disable foreign keys during `alter_table` for sqlite3 adapter for Rails 5 | |
# | |
module ActiveRecord | |
module ConnectionAdapters | |
class SQLite3Adapter < AbstractAdapter |
If your master.key has been compromised, you might want to regenerate it.
No key regeneration feature at the moment. We have to do it manually.
rails credentials:show
somewhere temporarily.config/master.key
and config/credentials.yml.enc
EDITOR=vim rails credentials:edit
in the terminal: This command will create a new master.key
and credentials.yml.enc
if they do not exist.config/credentials.yml.enc
FROM ruby:2.3.1 | |
# Install dependencies | |
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs | |
# Set an environment variable where the Rails app is installed to inside of Docker image: | |
ENV RAILS_ROOT /var/www/app_name | |
RUN mkdir -p $RAILS_ROOT | |
# Set working directory, where the commands will be ran: |
Pug - это препроцессор HTML и шаблонизатор, который был написан на JavaScript для Node.js.