Skip to content

Instantly share code, notes, and snippets.

### Unicorn ###
check process unicorn
with pidfile /home/deployer/qna/current/tmp/pids/unicorn.pid
start program = "/bin/su - deployer -c 'cd /home/deployer/qna/current && /home/deployer/.rvm/bin/rvm default do bundle exec unicorn -c /home/deployer/qna/current/config/unicorn/prooduction.rb -E deployment -D'"
stop program = "/bin/su - deployer -c 'kill -s QUIT `cat /home/deployer/qna/current/tmp/pids/unicorn.pid`'"
if memory usage > 90% for 3 cycles then restart
if cpu > 90% for 2 cycles then restart
if 5 restarts within 5 cycles then timeout
### Sphinxsearch ###
** 1. С помощью SQL (DDL):
* Создайте базу данных test_guru
newaz=# CREATE DATABASE test_guru;
* Таблицу categories с атрибутом title
newaz=# CREATE TABLE categories (
newaz(# id serial PRIMARY KEY,
newaz(# title varchar(25) NOT null
newaz(# );
# GET запрос без параметров
~$ nc -C httpbin.org 80
GET /anything HTTP/1.1
Host: httpbin.org
Accept: application/json
HTTP/1.1 200 OK
Date: Thu, 31 Mar 2022 17:02:55 GMT
Content-Type: application/json
Content-Length: 321