-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_server.sh
93 lines (81 loc) · 2.86 KB
/
setup_server.sh
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# ssh -i ~/smith-bw.pem [email protected]
# Setup Github
ssh-keygen -t rsa -C "[email protected]"
cat ~/.ssh/id_rsa.pub # add to github
sudo apt-get install git -y
git config --global user.name "smith11235"
git config --global user.email [email protected]
ssh -T [email protected]
exit
# Update base packages for Ruby & Gem build
sudo apt-get update
sudo apt-get upgrade -y
export package_list='curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libgdbm-dev libncurses5-dev automake libtool bison libffi-dev mysql-client libmysqlclient-dev libmagickwand-dev imagemagick phantomjs libpq-dev rmagick'
sudo apt-get install $package_list -y
# Login Perms
sudo sed -i 's/PermitRootLogin\\swithout-password/PermitRootLogin no/' /etc/ssh/sshd_config
sudo sed -i 's/UsePAM\\syes/UsePAM no/' /etc/ssh/sshd_config
sudo service ssh restart
# Setup Redis
# http://redis.io/topics/quickstart
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
pushd redis-stable
make
sudo make install
nohup redis-server &> redis-server.log &
popd
rm redis-stable.tar.gz
# Nginx Install
sudo gpg --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7
sudo gpg --armor --export 561F9B9CAC40B2F7 | sudo apt-key add -
sudo apt-get install apt-transport-https -y
echo "echo 'deb https://oss-binaries.phusionpassenger.com/apt/passenger trusty main' >> /etc/apt/sources.list.d/passenger.list" > .tmpsh
sudo sh .tmpsh
rm .tmpsh
sudo chown root: /etc/apt/sources.list.d/passenger.list
sudo chmod 600 /etc/apt/sources.list.d/passenger.list
sudo apt-get update -y
sudo apt-get install nginx-full passenger -y
sudo service nginx start
# Nginx Config
sudo vim /etc/nginx/sites-enabled/default
"
server{
listen 80;
server_name smith.brickworksoftware.com;
location / {
proxy_pass http://localhost:3000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
}
}
server {
listen 80;
server_name mail.brickworksoftware.com;
location / {
proxy_pass http://localhost:1080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
}
}
"
sudo service nginx restart
sudo chown -R ubuntu:ubuntu /home/ubuntu/.gnupg
# Install Dotfiles
git clone [email protected]:smith11235/dotfiles.git
pushd dotfiles
ruby dotfiles.rb
exit
# Get Brickwork
git clone [email protected]:brickworksoftware/brickwork_app.git
build_rvm
vim config/application.yml
"
RDS_PORT: "5432"
RDS_DB_NAME: railsapp
RDS_USERNAME: railsapp
RDS_PASSWORD: 5aed99058d873716ebec7111b2e679dc
RDS_HOSTNAME: [rds endpoint from aws console]
"
rake db:reset