# Часовий пояс
dpkg-reconfigure tzdata
# Глобальне оновлення ОС
apt-get update && apt-get -y upgrade
# Додаємо Postgres APT
touch /etc/apt/sources.list.d/pgdg.list
echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
# Ставимо Postgres
apt-get update
apt-get -y install postgresql-9.3 postgresql-contrib-9.3 libpq-dev
# Створюємо користувача для Postgres
sudo -u postgres -i
createuser dep -s
exit
# Тепер Erlang
wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
dpkg -i erlang-solutions_1.0_all.deb
apt-get update && apt-get -y install erlang
rm erlang-solutions_1.0_all.deb
# Monit (бонус)
apt-get install -y monit
# Встановити set daemon рівним 20
vi /etc/monit/monitrc
# Конфіг Monit'а для Postgres у файлі нижче
# Створюємо нового користувача в групі adm, заходимо під ним
adduser dep --ingroup adm
# Редагуємо sudoers, надаючи групі adm повноваження root
visudo
# Заходимо під юзером dep і ставимо rbenv-install
sudo apt-get -y install git-core curl make
curl https://raw.github.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash
# Додаємо rbenv в PATH (скопіювати на початок .bashrc)
export RBENV_ROOT="${HOME}/.rbenv"
if [ -d "${RBENV_ROOT}" ]; then
export PATH="${RBENV_ROOT}/bin:${PATH}"
eval "$(rbenv init -)"
fi
# Перечитуємо .bashrc
source .bashrc
# Ставимо залежності
rbenv bootstrap-ubuntu-12-04
# Ставимо Ruby
rbenv install 2.0.0-p247
rbenv global 2.0.0-p247
# Оновляємо джеми
gem up --sys
gem up
Last active
December 23, 2015 18:49
-
-
Save Myuzu/6678016 to your computer and use it in GitHub Desktop.
Postgres, Erlang та Ruby на Ubuntu 13.04.
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
# Розмістити в /etc/monit/conf.d/nginx.conf | |
check process nginx with pidfile /var/run/nginx.pid | |
group www-data | |
start program = "/etc/init.d/nginx start" | |
stop program = "/etc/init.d/nginx stop" | |
if failed host localhost port 80 protocol HTTP then restart | |
if cpu is greater than 95% for 16 cycles then restart | |
if 2 restarts within 2 cycles then alert | |
if 5 restarts within 5 cycles then timeout |
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
# Розмістити в /etc/monit/conf.d/postgres.conf | |
check process postgresql with pidfile /var/run/postgresql/9.3-main.pid | |
group database | |
start program = "/etc/init.d/postgresql start" | |
stop program = "/etc/init.d/postgresql stop" | |
if failed unixsocket /var/run/postgresql/.s.PGSQL.5432 protocol pgsql then restart | |
if failed unixsocket /var/run/postgresql/.s.PGSQL.5432 protocol pgsql then alert | |
if failed host localhost port 5432 protocol pgsql then restart | |
if failed host localhost port 5432 protocol pgsql then alert | |
if cpu is greater than 95% for 16 cycles then restart | |
if 2 restarts within 2 cycles then alert | |
if 5 restarts within 5 cycles then timeout | |
depend postgres_bin | |
depend postgres_rc | |
check file postgres_bin with path /usr/lib/postgresql/9.3/bin/postgres | |
group database | |
include /etc/monit/templates/rootbin | |
check file postgres_rc with path /etc/init.d/postgresql | |
group database | |
include /etc/monit/templates/rootbin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment