propro 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b07fd0c57004c103d92f1432d332576d42a2c727
4
- data.tar.gz: 224de6f4c0082f49bbe4439e6b29fe689ecc9ea0
3
+ metadata.gz: f931ac11df6b50792a31bdcc3a5647d13e9f4506
4
+ data.tar.gz: fbbaee3496ec6f96e56e52b20d2c0ad2b5a7935b
5
5
  SHA512:
6
- metadata.gz: e2916678fdd03b6f0f1f39316adaea8199dd397d7e798cf95d24b6e2e01988b72beb38f59cf8ff4afd44b0d5624b31f00e8a34c93f34df5d5aaec3c71372abcc
7
- data.tar.gz: f28f60a839ff498107eb3c26b400bcfd4f1deedd95a28a892dae87a9c430ebd52b454a03d3c510a3e6af8acef544c0c664d87a4eb33e64efc03c93e0ab076204
6
+ metadata.gz: 815249fbbf1e5cbccc9ca6894628a8a94c8695c0f930b1f1082381864b8d7aca1f6dbacf275f28f9bcc49da7b0ff5bd8b42f0b06f037498d7167f9dfd8b57db3
7
+ data.tar.gz: 90fbf023c021736649cc126453339e8b39c00530423b89ef593b2f83a219fc45bb0c8cef90aad05bd0f41a1c6f89e645de4df26a677a8e0c2f714d1ca60ee80e
@@ -1,4 +1,4 @@
1
- # ____ _________ ____ _________
1
+ s# ____ _________ ____ _________
2
2
  # / __ \/ ___/ __ \/ __ \/ ___/ __ \
3
3
  # / /_/ / / / /_/ / /_/ / / / /_/ /
4
4
  # / .___/_/ \____/ .___/_/ \____/
@@ -9,27 +9,34 @@
9
9
 
10
10
  source :vagrant
11
11
 
12
+ # Tune shared memory
12
13
  set :system_shmall_percent, 0.65
13
14
  set :system_shmmax_percent, 0.35
14
15
  provision 'vagrant/system'
15
16
 
17
+ # Install PG
16
18
  set :pg_version, 9.3
17
19
  provision 'vagrant/pg'
18
20
 
21
+ # Install Redis
19
22
  set :redis_version, '2.8.4'
20
23
  provision 'vagrant/redis'
21
24
 
25
+ # Install Ruby via RVM
22
26
  set :vagrant_rvm_ruby_version, '2.0.0'
23
27
  provision 'vagrant/rvm'
24
28
 
29
+ # Install Nginx
25
30
  set :nginx_version, '1.4.4'
26
31
  set :nginx_worker_connections, 100
27
32
  set :nginx_client_max_body_size, '100m'
28
33
  provision 'vagrant/nginx'
29
34
 
35
+ # Install Node
30
36
  set :node_version, '0.10.25'
31
37
  provision 'vagrant/node'
32
38
 
39
+ # Install extra packages
33
40
  set :extra_packages, [
34
41
  'man', # RTFM!
35
42
  'git-core', # For Bundler
@@ -0,0 +1,126 @@
1
+ # This is an example Propro file that will build a standalone web server on
2
+ # DigitalOcean or Linode
3
+ #
4
+ # To use it, here are the steps you'd take:
5
+ #
6
+ # 0. Read this file and modify it accordingly
7
+ # 1. Create a new Droplet / Linode and specify Ubuntu 12.04 LTS (32 or 64 bit)
8
+ # 2. From your command line run:
9
+ # $ propro deploy path/to/webserver.propro --server {{PUBLIC_IP_ADDRESS}}
10
+ # 3. Enter the root password you were provided
11
+ # 4. Watch Propro do it's thing, when it's done, wait for your machine to reboot
12
+ # 5. ssh admin@{{PUBLIC_IP_ADDRESS}}
13
+ # 6. Boom.
14
+ #
15
+ # Check out the ext/bash directory to see the avaliable config options, the
16
+ # option names map over to the directory tree, for example, to find where
17
+ # `vps_system_admin_authorized_github_users` is defined, check out:
18
+ # `ext/bash/vps/system.sh`
19
+
20
+ # Let Propro know about the packages you'd like to load:
21
+ source :vps
22
+ source :app
23
+ source :db
24
+
25
+ # The machine's name
26
+ set :vps_system_hostname, 'web1'
27
+
28
+ # Fully Qualified Domain Name for the server, usually: hostname.domain
29
+ set :vps_system_fqdn, 'web1.myapp.com'
30
+
31
+ # Propro will install the public keys of these GitHub users for the admin user
32
+ # they will be able to ssh into the machine once it's provisioned without a
33
+ # password.
34
+ set :vps_system_admin_authorized_github_users, ['??????', '????????']
35
+
36
+ # When you ssh into the machine as the admin user, this is the password you
37
+ # will type for sudo:
38
+ set :vps_system_admin_sudo_password, '?????????'
39
+
40
+ # For DigitalOcean this info can be found in the Settings tab of your Droplet,
41
+ # the default value is for Linode so you can remove this line in that case.
42
+ set :vps_system_public_netmask, '255.255.240.0'
43
+
44
+ # You don't need to assign a private IP to your VPS, you can remove the
45
+ # following lines if you don't care to use a private IP but it's a really good
46
+ # idea to assign one.
47
+ set :vps_system_private_ip, '10.???.???.???'
48
+ set :vps_system_private_netmask, '255.255.0.0'
49
+
50
+ # Shared memory configuration preferences, the defaults are for a database
51
+ # server, if you host your database on the same machine as the webserver, it
52
+ # might make sense to tweak these
53
+ set :system_shmall_percent, 0.75
54
+ set :system_shmmax_percent, 0.5
55
+
56
+ # Let Propro know that you would like to run the vps/system provisioner this
57
+ # will set up a base system, disable root login and create an admin user that
58
+ # the above GitHub users will be able to ssh into.
59
+ provision 'vps/system'
60
+
61
+ # This is the PG version you'd like to use, any of the versions listed on
62
+ # apt.postgresql.org can be specified.
63
+ set :pg_version, 9.3
64
+
65
+ # List the extension's you'd like to enable, the defaults are listed below, if
66
+ # you're cool with the defaults, you can delete the line.
67
+ set :pg_extensions, [
68
+ 'btree_gin',
69
+ 'btree_gist',
70
+ 'fuzzystrmatch',
71
+ 'hstore',
72
+ 'intarray',
73
+ 'ltree',
74
+ 'pg_trgm',
75
+ 'tsearch2',
76
+ 'unaccent'
77
+ ] # see: http://www.postgresql.org/docs/9.3/static/contrib.html
78
+
79
+ # This is the name of the database that will be created:
80
+ set :db_pg_name, 'myapp'
81
+
82
+ # This is the name of the DB user to create:
83
+ set :db_pg_user, 'deploy'
84
+
85
+ # Run the DB provisioner, this will install PG and create the database for the
86
+ # specified user, if the username is the same as the deploy user you don't
87
+ # need to specify it when you connect to the database:
88
+ provision 'db/pg'
89
+
90
+ # The domain of the web application that you will be deploying.
91
+ set :app_domain, 'myapp.com'
92
+
93
+ # Propro will install the public keys of these GitHub users for the deploy user
94
+ # they will be able to ssh into the machine without a password as the deploy
95
+ # user once it's provisioned and will be able to deploy the application.
96
+ set :app_authorized_github_users, ['??????', '??????']
97
+
98
+ # The name of the deploy user, the app will run as this user:
99
+ set :app_user, 'deploy'
100
+
101
+ # The base directory to put the application files and data into:
102
+ set :apps_dir, '/sites'
103
+
104
+ # Run the app provisioner
105
+ provision 'app'
106
+
107
+ # Specify the Nginx version to compile from source:
108
+ set :nginx_version, '1.4.7'
109
+
110
+ # Install Nginx and base conf files. All confs are put into
111
+ # /etc/{{service}}.conf
112
+ provision 'app/nginx'
113
+
114
+ # Specify the version of Node to install
115
+ set :node_version, '0.10.26'
116
+ provision 'app/node'
117
+
118
+ # Install Ruby 2.0 via RVM
119
+ set :app_rvm_ruby_version, '2.0.0'
120
+ provision 'app/rvm'
121
+
122
+ # Install Puma service
123
+ provision 'app/puma'
124
+
125
+ # Install Puma configuration for Nginx
126
+ provision 'app/puma/nginx'
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env bash
2
+ function provision-app-ffmpeg {
3
+ section "FFmpeg"
4
+ ffmpeg-install
5
+ }
@@ -0,0 +1,106 @@
1
+ #!/usr/bin/env bash
2
+ # http://askubuntu.com/a/148567
3
+ # https://trac.ffmpeg.org/wiki/UbuntuCompilationGuide
4
+ # http://juliensimon.blogspot.ca/2013/08/howto-compiling-ffmpeg-x264-mp3-aac.html
5
+
6
+ export FFMPEG_VERSION="git" # @specify (or a version to download: "2.1.4")
7
+ export FFMPEG_YASM_VERSION="1.2.0"
8
+ export FFMPEG_XVID_VERSION="1.3.2"
9
+
10
+ FFMPEG_URL="http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.gz"
11
+ FFMPEG_YASM_URL="http://www.tortall.net/projects/yasm/releases/yasm-$FFMPEG_YASM_VERSION.tar.gz"
12
+ FFMPEG_XVID_URL="http://downloads.xvid.org/downloads/xvidcore-$FFMPEG_XVID_VERSION.tar.gz"
13
+
14
+ function ffmpeg-install {
15
+ local tmpdir=$(get-tmp-dir)
16
+ cd "$tmpdir"
17
+
18
+ announce "Install Dependencies"
19
+ install-packages build-essential git libfaac-dev libgpac-dev \
20
+ libjack-jackd2-dev libmp3lame-dev libopencore-amrnb-dev \
21
+ libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libva-dev libvdpau-dev \
22
+ libvorbis-dev libxfixes-dev zlib1g-dev libgsm1-dev
23
+
24
+ announce-item "Yasm"
25
+ announce-item "> Download"
26
+ download $FFMPEG_YASM_URL
27
+
28
+ announce-item "> Extract"
29
+ extract yasm-$FFMPEG_YASM_VERSION.tar.gz
30
+ cd yasm-$FFMPEG_YASM_VERSION
31
+
32
+ announce-item "> Configure"
33
+ ./configure
34
+
35
+ announce-item "> Compile"
36
+ make
37
+
38
+ announce-item "> Install"
39
+ make install
40
+ make distclean
41
+ cd ..
42
+
43
+ announce-item "X264"
44
+ announce-item "> Download"
45
+ git clone --depth 1 git://git.videolan.org/x264
46
+
47
+ announce-item "> Configure"
48
+ cd x264
49
+ ./configure --prefix=/usr/local --enable-shared
50
+
51
+ announce-item "> Compile"
52
+ make
53
+
54
+ announce-item "> Install"
55
+ make install
56
+ make distclean
57
+ cd ..
58
+
59
+ announce-item "Xvid"
60
+ announce-item "> Download"
61
+ download $FFMPEG_XVID_URL
62
+
63
+ announce-item "> Extract"
64
+ extract xvidcore-$FFMPEG_XVID_VERSION.tar.gz
65
+ cd xvidcore/build/generic
66
+
67
+ announce-item "> Configure"
68
+ ./configure --prefix=/usr/local
69
+
70
+ announce-item "> Compile"
71
+ make
72
+
73
+ announce-item "> Install"
74
+ make install
75
+ cd ../../..
76
+
77
+ announce "Download $FFMPEG_VERSION"
78
+ if [ $FFMPEG_VERSION == "git" ]; then
79
+ git clone --depth 1 git://source.ffmpeg.org/ffmpeg.git
80
+ cd ffmpeg
81
+ else
82
+ download $FFMPEG_URL
83
+
84
+ announce "Extract"
85
+ extract ffmpeg-$FFMPEG_VERSION.tar.gz
86
+ cd ffmpeg-$FFMPEG_VERSION
87
+ fi
88
+
89
+ announce "Configure"
90
+ ./configure --prefix=/usr/local --enable-gpl --enable-version3 \
91
+ --enable-nonfree --enable-shared --enable-libopencore-amrnb \
92
+ --enable-libopencore-amrwb --enable-libfaac --enable-libgsm \
93
+ --enable-libmp3lame --enable-libtheora --enable-libvorbis \
94
+ --enable-libx264 --enable-libxvid
95
+
96
+ announce "Compile"
97
+ make
98
+
99
+ announce "Install"
100
+ make install
101
+ make distclean
102
+ ldconfig -v
103
+
104
+ cd ~/
105
+ rm -rf "$tmpdir"
106
+ }
@@ -9,6 +9,7 @@ export NGINX_ACCESS_LOG_FILE_NAME="access.log"
9
9
  export NGINX_ERROR_LOG_FILE_NAME="error.log"
10
10
  export NGINX_DEPENDENCIES="libpcre3-dev libssl-dev"
11
11
  export NGINX_WORKER_COUNT=$(get-processor-count)
12
+ export NGINX_SERVER_NAMES_HASH_BUCKET_SIZE="64"
12
13
  export NGINX_PID_FILE="/var/run/nginx.pid"
13
14
  export NGINX_CLIENT_MAX_BODY_SIZE="5m" # @specify
14
15
  export NGINX_WORKER_CONNECTIONS="2000" # @specify
@@ -74,6 +75,8 @@ http {
74
75
  client_max_body_size $NGINX_CLIENT_MAX_BODY_SIZE;
75
76
  client_body_temp_path /var/spool/nginx-client-body 1 2;
76
77
 
78
+ server_names_hash_bucket_size $NGINX_SERVER_NAMES_HASH_BUCKET_SIZE;
79
+
77
80
  default_type application/octet-stream;
78
81
 
79
82
  include /etc/nginx/conf/*.conf;
@@ -25,6 +25,7 @@ function get-archtype {
25
25
  }
26
26
 
27
27
  function update-sources {
28
+ sed -i "/^# deb.*multiverse/ s/^# //" /etc/apt/sources.list
28
29
  apt-get -qq -y update
29
30
  }
30
31
 
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env bash
2
+ function provision-vagrant-ffmpeg {
3
+ section "FFmpeg"
4
+ ffmpeg-install
5
+ }
@@ -4,8 +4,10 @@ export VPS_SYSTEM_FQDN="" # @require
4
4
  export VPS_SYSTEM_ADMIN_AUTHORIZED_GITHUB_USERS="" # @require
5
5
  export VPS_SYSTEM_ADMIN_SUDO_PASSWORD="" # @require
6
6
  export VPS_SYSTEM_PRIVATE_IP="" # @specify
7
+ export VPS_SYSTEM_DNS_SERVERS="208.67.222.222 208.67.220.220"
7
8
  export VPS_SYSTEM_ADMIN_USER="admin" # @specify
8
- export VPS_SYSTEM_PRIVATE_NETMASK="255.255.128.0"
9
+ export VPS_SYSTEM_PRIVATE_NETMASK="255.255.128.0" # @specify Default is for Linode, DigitalOcean: 255.255.0.0
10
+ export VPS_SYSTEM_PUBLIC_NETMASK="255.255.255.0" # @specify Default is for Linode, DigitalOcean: 255.255.240.0
9
11
  export VPS_SYSTEM_ALLOW_PORTS="www 443 ssh"
10
12
  export VPS_SYSTEM_LIMIT_PORTS="ssh"
11
13
  export VPS_SYSTEM_ALLOW_PRIVATE_IPS="" # @specify
@@ -119,8 +121,9 @@ auto eth0 eth0:0 eth0:1
119
121
  # Public interface
120
122
  iface eth0 inet static
121
123
  address $ip_addr
122
- netmask 255.255.255.0
124
+ netmask $VPS_SYSTEM_PUBLIC_NETMASK
123
125
  gateway $gateway
126
+ dns-nameservers $VPS_SYSTEM_DNS_SERVERS
124
127
  EOT
125
128
 
126
129
  if [ $VPS_SYSTEM_PRIVATE_IP ]; then
@@ -134,10 +137,7 @@ EOT
134
137
  fi
135
138
 
136
139
  announce "Restart networking"
137
- /etc/init.d/networking restart
138
-
139
- announce "Removing DHCP"
140
- aptitude -q -y remove isc-dhcp-client dhcp3-client dhcpcd
140
+ service networking restart
141
141
  }
142
142
 
143
143
  function provision-vps-system {
@@ -51,6 +51,7 @@ module Propro
51
51
  end
52
52
  end
53
53
 
54
+ # I hate this immensely
54
55
  desc 'deploy SCRIPT', 'Builds a Propro script and then executes it remotely'
55
56
  option :server, aliases: '-s', banner: '<server address>'
56
57
  option :password, aliases: '-p', banner: '<server password>'
@@ -84,17 +85,19 @@ module Propro
84
85
  session.scp.upload!(script_data, remote_script_path)
85
86
  session.exec!("chmod +x #{remote_script_path}")
86
87
  session.exec!("touch #{remote_log_path}")
87
- tail = session.exec("tail -f #{remote_log_path}") do |ch|
88
- ch.on_data do |ch, data|
89
- STDOUT.write(data)
90
- STDOUT.flush
91
- end
88
+
89
+ tail = session.exec("tail -f #{remote_log_path}") do |ch, stream, data|
90
+ STDOUT.write(data)
91
+ STDOUT.flush
92
92
  end
93
93
 
94
94
  sleep 1 # ughhhhhh
95
95
  say_event 'run', remote_script_url
96
96
  puts
97
- session.exec(remote_script_path)
97
+
98
+ session.exec(remote_script_path) do |ch|
99
+ ch.on_data { } # mute stdout
100
+ end
98
101
  end
99
102
  rescue IOError # uggghhhhhhhhhh
100
103
  say_event 'done', "#{address} is rebooting"
@@ -109,9 +112,11 @@ module Propro
109
112
  end
110
113
 
111
114
  def ask_password
112
- STDIN.noecho do
115
+ pwd = STDIN.noecho do
113
116
  ask 'password:'
114
117
  end
118
+ puts
119
+ pwd
115
120
  end
116
121
 
117
122
  def absolute_path(path)
@@ -10,6 +10,7 @@ module Propro
10
10
  lib/nginx
11
11
  lib/node
12
12
  lib/redis
13
+ lib/ffmpeg
13
14
  vps/system
14
15
  app
15
16
  app/rvm
@@ -17,6 +18,7 @@ module Propro
17
18
  app/nginx
18
19
  app/sidekiq
19
20
  app/monit
21
+ app/ffmpeg
20
22
  app/puma
21
23
  app/puma/nginx
22
24
  app/node
@@ -32,6 +34,7 @@ module Propro
32
34
  vagrant/rvm
33
35
  vagrant/node
34
36
  vagrant/nginx
37
+ vagrant/ffmpeg
35
38
  lib/extras
36
39
  ]
37
40
 
@@ -1,3 +1,3 @@
1
1
  module Propro
2
- VERSION = '0.3.0'
2
+ VERSION = '0.4.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: propro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carsten Nielsen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-19 00:00:00.000000000 Z
11
+ date: 2014-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -95,8 +95,9 @@ files:
95
95
  - Rakefile
96
96
  - bin/propro
97
97
  - examples/vagrant.propro
98
- - examples/vps_webserver.propro
98
+ - examples/webserver.propro
99
99
  - ext/bash/app.sh
100
+ - ext/bash/app/ffmpeg.sh
100
101
  - ext/bash/app/monit.sh
101
102
  - ext/bash/app/nginx.sh
102
103
  - ext/bash/app/node.sh
@@ -111,6 +112,7 @@ files:
111
112
  - ext/bash/db/pg.sh
112
113
  - ext/bash/db/redis.sh
113
114
  - ext/bash/lib/extras.sh
115
+ - ext/bash/lib/ffmpeg.sh
114
116
  - ext/bash/lib/nginx.sh
115
117
  - ext/bash/lib/node.sh
116
118
  - ext/bash/lib/pg.sh
@@ -120,6 +122,7 @@ files:
120
122
  - ext/bash/lib/system.sh
121
123
  - ext/bash/lib/ubuntu.sh
122
124
  - ext/bash/vagrant.sh
125
+ - ext/bash/vagrant/ffmpeg.sh
123
126
  - ext/bash/vagrant/nginx.sh
124
127
  - ext/bash/vagrant/node.sh
125
128
  - ext/bash/vagrant/pg.sh
@@ -1,51 +0,0 @@
1
- # ____ _________ ____ _________
2
- # / __ \/ ___/ __ \/ __ \/ ___/ __ \
3
- # / /_/ / / / /_/ / /_/ / / / /_/ /
4
- # / .___/_/ \____/ .___/_/ \____/
5
- # /_/ /_/
6
- #
7
- # Example provisioner for standalone web server
8
- #
9
-
10
- source :vps
11
- source :app
12
- source :db
13
-
14
- # vps/system
15
- set :vps_system_hostname, 'myapp'
16
- set :vps_system_fqdn, 'web1.myapp.com'
17
- set :vps_system_admin_authorized_github_users, %w[ ????? ????? ]
18
- set :vps_system_admin_sudo_password, '??????'
19
- set :vps_system_private_ip, '???.???.???.???' # Private network IP of VPS
20
- set :vps_system_admin_user, 'admin'
21
- provision 'vps/system'
22
-
23
- # app
24
- set :app_domain, 'myapp.com'
25
- set :app_authorized_github_users, %w[ ????? ????? ????? ]
26
- provision 'app'
27
-
28
- # app/rvm
29
- set :app_rvm_ruby_version, '2.0.0'
30
- provision 'app/rvm'
31
-
32
- # app/nginx
33
- provision 'app/nginx'
34
-
35
- # app/puma/nginx
36
- set :app_puma_nginx_access_log_file_name, 'myapp.access.log'
37
- set :app_puma_nginx_error_log_file_name, 'myapp.error.log'
38
- provision 'app/puma/nginx'
39
-
40
- # db/pg
41
- set :db_pg_name, 'myapp_production'
42
- set :db_pg_user, 'myapp'
43
- provision 'db/pg'
44
-
45
- # db/redis
46
- provision 'db/redis'
47
-
48
- # lib/extras
49
- set :extra_packages, %w[ imagemagick ]
50
- provision 'extras'
51
-