This repository has been archived by the owner on Jan 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapt_packages.sh
80 lines (68 loc) · 2.59 KB
/
apt_packages.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
#!/usr/bin/env bash
# The vagrant box used pre-7.0 had a swapfile pre-configured. The one we
# use now doesn't, so generate one to keep things from out of memory during
# installation (namely passenger)
fallocate -l 2G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo "/swapfile none swap sw 0 0" >> /etc/fstab
# install passenger and nginx to go with it
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
apt-get install -y apt-transport-https ca-certificates
# Add Passenger APT repository
sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger trusty main > /etc/apt/sources.list.d/passenger.list'
# Update everything and install some of the dependent packages we'll need for other things
apt-get update
apt-get install -y python-twisted git curl python-software-properties mongodb vim build-essential libgmp3-dev libcurl4-openssl-dev nodejs
# Install rvm and a specific version of ruby
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL https://get.rvm.io | bash -s stable --ruby=2.2.3
source /usr/local/rvm/scripts/rvm
rvm --default use ruby-2.2.3
gem install bundler
# Add the user and group needed for nginx
id -u deploy &>/dev/null || useradd -r -G sudo deploy
# Install Passenger & Nginx
apt-get install -y nginx-extras passenger
cat <<EOF > /etc/nginx/conf.d/passenger.conf
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /usr/local/rvm/gems/ruby-2.2.3/wrappers/ruby;
passenger_max_pool_size 6;
passenger_buffer_response on;
passenger_min_instances 1;
passenger_max_instances_per_app 0;
passenger_pool_idle_time 300;
passenger_max_requests 0;
passenger_default_user www-data;
passenger_default_group www-data;
# To enable this, disable the other gzip settings in /etc/nginx/nginx.conf and
# uncomment everything below
#gzip on;
#gzip_http_version 1.0;
#gzip_comp_level 2;
#gzip_proxied any;
#gzip_vary off;
#gzip_types text/plain text/html text/css text/xml text/javascript application/json application/x-javascript application/xml application/xml+rss;
#gzip_min_length 1000;
#gzip_disable "MSIE [1-6]\.";
#gzip_static off;
EOF
cat <<EOF > /etc/nginx/sites-enabled/shadowcraft
upstream engine-7.0 {
server 127.0.0.1:8901;
# server 127.0.0.1:8902;
# server 127.0.0.1:8903;
# server 127.0.0.1:8904;
}
server {
listen 81;
server_name shadowcraft;
access_log /var/log/nginx/shadowcraft.access.log;
location / {
root /var/www/shadowcraft-ui/public;
passenger_enabled on;
rails_env development;
}
}
EOF