File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
3
apt-get update
4
- apt-get install -y wget curl git tmux postgresql build-essential libssl-dev make automake autoconf libncurses5-dev gcc default-jre certbot nginx ufw
4
+ apt-get install -y wget curl git tmux postgresql build-essential libssl-dev make automake autoconf libncurses5-dev gcc default-jre certbot nginx ufw python3-pip lzop pv
5
5
6
6
# install erlang
7
7
curl -O https://raw.githubusercontent.com/kerl/kerl/master/kerl
@@ -28,6 +28,29 @@ sudo -u postgres psql -c "ALTER USER holiday_ping WITH PASSWORD 'holiday_ping';"
28
28
cp /root/holiday_ping/priv/sql/tables.sql /tmp/
29
29
sudo -u postgres psql -a -f /tmp/tables.sql
30
30
31
+ # setup db backups
32
+ echo '
33
+ wal_level = replica
34
+ ' >> /etc/postgresql/9.6/main/postgresql.conf
35
+ service postgresql restart
36
+
37
+ sudo python3 -m pip install wal-e[aws]
38
+ echo " cd /var/lib/postgresql/
39
+ sudo -u postgres \
40
+ AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY AWS_REGION=us-east-1 wal-e \
41
+ -k $AWS_ACCESS_KEY_ID \
42
+ --s3-prefix=s3://lambdaclass.com/holiday_ping/backups \
43
+ backup-push /var/lib/postgresql/9.6/main
44
+
45
+ sudo -u postgres \
46
+ AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY AWS_REGION=us-east-1 wal-e \
47
+ -k $AWS_ACCESS_KEY_ID \
48
+ --s3-prefix=s3://lambdaclass.com/holiday_ping/backups \
49
+ delete --confirm retain 5
50
+ " > /usr/bin/holiday-backup
51
+ chmod +x /usr/bin/holiday-backup
52
+ echo ' 0 0 * * * /usr/bin/holiday-backup > /var/log/holiday-backup.log 2>&1' | crontab
53
+
31
54
# get ssl certificates. issue with already running port
32
55
certbot certonly --standalone -d holidayping.lambdaclass.com
33
56
You can’t perform that action at this time.
0 commit comments