View health_check.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
LAST_UPDATED_MINUTES=2 | |
(find /tmp/ -iname "web-healthy" -cmin -$LAST_UPDATED_MINUTES | egrep -q ".*") || curl --fail http://localhost:$WEB_LISTEN/heartbeat |
View Run services using Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### Postgres | |
# Run Postgres 10 | |
sudo docker run --rm --name postgres10 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRE_PORT=5433 -p 5433:5432 postgres:10 | |
# Connect to Postgres 10 | |
psql -p 5433 -U postgres -h 172.17.0.1 |
View Минимальные навыки владения ActiveRecord в Rails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) Чёткое понимание ORM: что это и для чего нужно? | |
2) Чёткое понимание паттенра ActiveRecord. | |
3) Умение работать с ActiveRecord в Rails. | |
http://rusrails.ru/#modeli | |
http://api.rubyonrails.org/classes/ActiveRecord/Base.html |
View Минимальные навыки владения SQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Необходимо хорошо знать основы SQL, в частности CRUD. | |
А именно: | |
1.1) Выборка данных с одной таблицы. | |
Умения: | |
** Выбор необходимых столбцов. | |
** Умение применять алиасы для переименования выбираемых столбцов. | |
** Фильтрация результатов (WHERE). | |
** Сортировка результатов (ORDER BY). | |
** Ограничение возвращаемых результатов (LIMIT). |
View url_helpers.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module UrlHelpers | |
extend ActiveSupport::Concern | |
def default_url_options | |
Rails.configuration.action_mailer.default_url_options | |
end | |
included do | |
include Rails.application.routes.url_helpers | |
end |
View indexes_tablespace_changer.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Usage sample: | |
# CONNECTION_STRING='dbname=some_db port=5432 user=some_user' \ | |
# TABLESPACE=some_db_indexes_tablespace \ | |
# ruby indexes_tablespace_changer.rb | |
require 'pg' | |
CONNECTION_STRING = ENV['CONNECTION_STRING'] |
View db_backup.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# These ENV variables should be specified: | |
# * WORKING_DIR | |
# * PG_USER | |
# * SCP_USER | |
# * SCP_HOST | |
# * SCP_DIR | |
# | |
# Also optional variable MAIL_TO can be specified. |