-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathserver install
80 lines (55 loc) · 1.87 KB
/
server install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
server install
44.228.221.170
ssh -i mysshkey.pem [email protected]
#ubuntu
sudo apt update
sudo apt upgrade
sudo apt install -y postgresql postgresql-contrib libpq-dev nodejs nginx
sudo systemctl enable postgresql.service
sudo systemctl start postgresql.service
sudo systemctl enable nginx
sudo systemctl start nginx
#add swap
sudo dd if=/dev/zero of=/swapfile bs=1024 count=1024k
sudo chmod 0600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo chown root:root /swapfile
echo 10 | sudo tee /proc/sys/vm/swappiness
echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf
sudo echo "/swapfile none swap sw 0 0" >> /etc/fstab
#rbenv + ruby
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
cd ~/.rbenv && src/configure && make -C src
cd
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init - bash)"' >> ~/.bash_profile
echo 'alias r=rails' >> ~/.bash_profile
. ~/.bash_profile
git clone https://github.com/rbenv/ruby-build.git
sudo PREFIX=/usr/local ./ruby-build/install.sh
echo 'gem: --no-document' >> ~/.gemrc
rbenv install 3.1.2
#gamerankr
cd
git clone https://github.com/michaeleconomy/gamerankr.git
cd gamerankr
gem install bundler
bundle
bundle exec rails assets:precompile
sudo cp config/puma.service /etc/systemd/system/puma.service
sudo systemctl daemon-reload
sudo systemctl enable puma
sudo systemctl start puma
sudo cp config/nginx.conf /etc/nginx/conf.d/gamerankr.conf
sudo systemctl restart puma
#ssl
sudo snap install core; sudo snap refresh core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
sudo certbot --nginx
#on server
echo "create role gamerankr with login createdb password 'pass';" | sudo -u postgres psql
export PGPASSWORD=pass
echo "create database gamerankr_prod" | psql -U gamerankr -h localhost -d postgres
pg_restore -U gamerankr -h localhost -d gamerankr_prod backup.dump