rhoconnect 3.4.3 → 3.4.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 3.4.4 (2013-02-27)
2
+ * Updated prod. stack to ruby-1.9.3-p392, redis-2.6.10, and nginx-1.3.13.
3
+
1
4
  ## 3.4.3 (2013-02-11)
2
5
  * Updated rack gem to latest release with important security fixes. Locked version of 'connection_pool' gem.
3
6
  * fixing 'rhoconnect spec' command in production env
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rhoconnect (3.4.3)
4
+ rhoconnect (3.4.4)
5
5
  bundler (~> 1.0)
6
6
  connection_pool (= 0.9.2)
7
7
  json (~> 1.6.0)
@@ -30,7 +30,7 @@ GEM
30
30
  mime-types
31
31
  xml-simple
32
32
  backports (2.6.2)
33
- builder (3.1.4)
33
+ builder (3.2.0)
34
34
  cabin (0.6.0)
35
35
  childprocess (0.3.8)
36
36
  ffi (~> 1.0, >= 1.0.11)
@@ -38,13 +38,13 @@ GEM
38
38
  coffee-script (2.2.0)
39
39
  coffee-script-source
40
40
  execjs
41
- coffee-script-source (1.4.0)
41
+ coffee-script-source (1.5.0)
42
42
  connection_pool (0.9.2)
43
43
  crack (0.3.2)
44
44
  daemons (1.1.9)
45
45
  diff-lcs (1.1.3)
46
46
  eventmachine (1.0.0)
47
- excon (0.18.3)
47
+ excon (0.18.5)
48
48
  execjs (1.4.0)
49
49
  multi_json (~> 1.0)
50
50
  extlib (0.9.16)
@@ -128,11 +128,11 @@ GEM
128
128
  multi_json (~> 1.0)
129
129
  simplecov-html (~> 0.7.1)
130
130
  simplecov-html (0.7.1)
131
- sinatra (1.3.4)
131
+ sinatra (1.3.5)
132
132
  rack (~> 1.4)
133
133
  rack-protection (~> 1.3)
134
134
  tilt (~> 1.3, >= 1.3.3)
135
- sprockets (2.8.2)
135
+ sprockets (2.9.0)
136
136
  hike (~> 1.2)
137
137
  multi_json (~> 1.0)
138
138
  rack (~> 1.0)
data/install.sh CHANGED
@@ -150,15 +150,6 @@ setPrefixDependantPaths ()
150
150
  # Make path to log file absolute and create directory if not already existent
151
151
  log="${prefix}/logs/${log}"
152
152
  touch $log > /dev/null
153
-
154
- # Add the log file path to the info file
155
- `echo $log >> info.dat`
156
- #cat info.dat
157
-
158
- # Move info.dat into installation directory if not already there
159
- if ! [ -e "${prefix}/info.dat" ]; then
160
- mv info.dat "${prefix}/info.dat"
161
- fi
162
153
  }
163
154
 
164
155
  setDefaults ()
@@ -174,19 +165,12 @@ setDefaults ()
174
165
  fi
175
166
  }
176
167
 
177
- logAndPrint ()
178
- {
179
- $1 > $log 2>&1
180
- exitStatus=$?
181
- }
182
-
183
168
  setRubyVars ()
184
169
  {
185
170
  if [[ $rubyVersion == "" || $rubyVersion =~ ruby'ee'|'enterprise' ]]; then
186
- rubyVersion="ruby-1.9.3-p286"
187
- rubyDir="ruby-1.9.3-p286"
171
+ rubyVersion=${RUBY_VERSION}
172
+ rubyDir=${RUBY_VERSION}
188
173
  rubyTar="${rubyDir}.tar.gz"
189
- # http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p286.tar.gz
190
174
  rubyURL="http://ftp.ruby-lang.org/pub/ruby/1.9/${rubyTar}"
191
175
  elif [$rubyVersion == "ruby187"]; then
192
176
  rubyDir="ruby-1.8.7"
@@ -211,44 +195,24 @@ installRuby ()
211
195
  echo "tar -xzf ${prefix}/${rubyTar} -C ${prefix}" >> $log
212
196
  tar -xzf ${prefix}/${rubyTar} -C ${prefix} > /dev/null 2>&1
213
197
  fi
198
+
214
199
  echo "Installing ruby. This may take some time..." | tee -a $log
215
-
216
- case $rubyVersion in
217
- # rubyee)
218
- # logAndPrint "${prefix}/${rubyDir}/installer --dont-install-useful-gems --no-dev-docs --auto ${prefix}"
219
- # ;;
220
- ruby-1.9.3-p286)
221
- (
222
- echo "cd ${prefix}/${rubyDir}" | tee -a $log
223
- cd ${prefix}/${rubyDir}
224
- echo "./configure --prefix=${prefix} --enable-shared --disable-install-doc" | tee -a $log
225
- ./configure --prefix=${prefix} --enable-shared --disable-install-doc >> $log 2>&1
226
- echo "make && make install" | tee -a $log
227
- make >> $log 2>&1
228
- make install >> $log 2>&1
229
- )
230
- ;;
231
- ruby187)
232
- logAndPrint "${prefix}/${rubyDir}/configure --prefix=\"${prefix}\""
233
- logAndPrint "make && make install"
234
- ;;
235
- ruby192)
236
- logAndPrint "${prefix}/${rubyDir}/configure --prefix=\"${prefix}\""
237
- logAndPrint "make && make install"
238
- ;;
239
- *)
240
- logAndPrint "echo \"${rubyVersion} is not a supported ruby version\""
241
- exit 1
242
- ;;
243
- esac
244
-
245
- if [[ $? != 0 ]]; then
200
+ echo "pushd ${prefix}/${rubyDir}" | tee -a $log
201
+ pushd ${prefix}/${rubyDir}
202
+ echo "./configure --prefix=${prefix} --enable-shared --disable-install-doc" | tee -a $log
203
+ ./configure --prefix=${prefix} --enable-shared --disable-install-doc >> $log 2>&1
204
+ echo "make && make install" | tee -a $log
205
+ make >> $log 2>&1
206
+ make install >> $log 2>&1
207
+
208
+ if (( $? )) ; then
246
209
  echo "Some dependencies not installed..." | tee -a $log
247
210
  echo "Please install them and then re-run the installation script." | tee -a $log
248
211
  echo "For troubleshooting see file $log ..." | tee -a $log
249
212
  exit 1
250
213
  fi
251
214
 
215
+ popd
252
216
  echo -e "$rubyDir is successfully installed.\n" | tee -a $log
253
217
  }
254
218
 
@@ -260,8 +224,8 @@ log=rhoconnect_$(date +$DATEFILE).log
260
224
 
261
225
  # make sure only run as root
262
226
  if [ "$(id -u)" != "0" ]; then
263
- echo "This script must be run as root" | tee -a $log
264
- exit 1
227
+ echo "This script must be run as root" | tee -a $log
228
+ exit 1
265
229
  fi
266
230
 
267
231
  # Check if web server is running on port 80
@@ -272,9 +236,9 @@ if [[ `echo "close" | telnet localhost 80 2>&1 | grep "Connected"` ]]; then
272
236
  fi
273
237
 
274
238
  # Get starting directory
275
- startDir=`pwd`
276
- if [[ $startDir = "/opt/rhoconnect/installer" ]]; then #FIXME:
277
- INSTALL_DIR="/opt/rhoconnect/installer"
239
+ PWD=`pwd`
240
+ if [[ $PWD = "/opt/rhoconnect/installer" ]]; then
241
+ INSTALL_DIR=$PWD
278
242
  else
279
243
  INSTALL_DIR="./installer"
280
244
  fi
@@ -293,6 +257,10 @@ webServer=""
293
257
  rubyVersion=""
294
258
  rubyBinDir=""
295
259
 
260
+ # Define ruby vession to be installed ...
261
+ RUBY_PATCH="p392"
262
+ RUBY_VERSION="ruby-1.9.3-${RUBY_PATCH}"
263
+
296
264
  # parse command-line options
297
265
  parseOpts "$*"
298
266
 
@@ -316,36 +284,19 @@ cleanPrefix
316
284
  # Once the prefix path is cleaned up...
317
285
  setPrefixDependantPaths
318
286
 
319
- # Install ruby if not already installed
320
- if ! [ -e "${prefix}/bin/ruby" ]; then
321
- installRuby
287
+ if [[ -e ${prefix}/bin/ruby && `${prefix}/bin/ruby -v | awk '{ print $2}'` =~ ${RUBY_PATCH} ]]; then
288
+ echo "${RUBY_VERSION} already installed" | tee -a $log
322
289
  else
323
- echo "Ruby already installed" | tee -a $log
290
+ installRuby
324
291
  fi
325
292
 
326
- # Construct the string with which to call the ruby installation script.
327
- callruby="${prefix}/bin/ruby ${INSTALL_DIR}/unix-like/rhoinstaller.rb ${opts}"
328
- # Call the ruby script
329
- $callruby
330
- rho_status=$?
331
-
332
- if [[ $installedSoftware -eq ${#INSTALL_ARRAY[@]} ]]; then
333
- rm "${prefix}/info.dat"
334
- if [ -e $prefix$rubyTar ]; then
335
- mv $prefix/$rubyTar $prefix"/downloads/"$rubyTar
336
- fi
337
- if [ -e $prefix$rubyDir ]; then
338
- mv $prefix$rubyDir $prefix"/downloads/"$rubyDir
339
- fi
340
- if [ ! -e $prefix"/post-install" ]; then
341
- mkdir $prefix"/post-install"
342
- fi
343
-
344
- if (( $rho_status )) ; then
345
- echo "Installation failed. For troubleshooting see file $log ..." | tee -a $log
346
- exit 1
347
- else
348
- opts=" -d $dist -l $log"
349
- ${prefix}/bin/ruby ${INSTALL_DIR}/unix-like/create_texts.rb ${opts}
350
- fi
293
+ # Install redis, sqllite3, nginx, rhoconnect
294
+ opts=" -d $dist -l $log"
295
+ ${prefix}/bin/ruby ${INSTALL_DIR}/unix-like/rhoinstaller.rb ${opts}
296
+ if (( $? )) ; then
297
+ echo "Installation failed. For troubleshooting see file $log ..." | tee -a $log
298
+ exit 1
351
299
  fi
300
+
301
+ # Create configuration scripts for redis, nginx, thin.
302
+ ${prefix}/bin/ruby ${INSTALL_DIR}/unix-like/create_texts.rb ${opts}
@@ -239,6 +239,15 @@ end
239
239
  def create_nginx_init
240
240
  nginx_init_script = <<'_NGINX_INIT_SCRIPT_'
241
241
  #!/bin/sh
242
+ ### BEGIN INIT INFO
243
+ # Provides: nginx
244
+ # Required-Start: $local_fs $remote_fs
245
+ # Required-Stop: $local_fs $remote_fs
246
+ # Default-Start: 2 3 4 5
247
+ # Default-Stop: S 0 1 6
248
+ # Short-Description: nginx initscript
249
+ # Description: nginx
250
+ ### END INIT INFO
242
251
  # Author: Ryan Norbauer http://norbauerinc.com
243
252
  # Modified: Geoffrey Grosenbach http://topfunky.com
244
253
  # Modified: Clement NEDELCU
@@ -363,15 +372,25 @@ http {
363
372
  }
364
373
  _NGINX_CONF_
365
374
 
366
- # create 'nginx' user if it does not exist
367
- user_nginx = `cat /etc/passwd | cut -d: -f1 | grep nginx`
368
- if user_nginx.empty?
375
+ # Creating 'nginx' group if it isn't already there
376
+ `getent group nginx > /dev/null`
377
+ if $? != 0
378
+ puts "Creating 'nginx' group ..."
379
+ if @dist == 'debian'
380
+ `addgroup --system nginx > /dev/null`
381
+ else
382
+ `/usr/sbin/groupadd -r nginx > /dev/null`
383
+ end
384
+ end
385
+ # Creating 'nginx' user if it isn't already there
386
+ `getent passwd nginx >/dev/null`
387
+ if $? != 0
369
388
  puts "Creating 'nginx' user ..."
370
389
  if @dist == 'debian'
371
390
  `adduser --system --home /opt/nginx/html --no-create-home --disabled-login --disabled-password --group nginx`
372
391
  else
373
- `/usr/sbin/useradd -M -r -s /sbin/nologin -d /opt/nginx/html nginx`
374
- end
392
+ `/usr/sbin/useradd -M -r -s /sbin/nologin -d /opt/nginx/html -g nginx nginx`
393
+ end
375
394
  end
376
395
 
377
396
  FileUtils.mv("/opt/nginx/conf/nginx.conf", "/opt/nginx/conf/nginx.conf.bak") unless File.exist? "/opt/nginx/conf/nginx.conf.bak"
@@ -539,16 +558,16 @@ To deploy and develop your rhoconnect app on nginx and thin servers:
539
558
  # ...
540
559
  }
541
560
 
542
- e) Edit Thin `/etc/thin/rhoapp.yml` configuration file directly
561
+ e) Edit thin `/etc/thin/rhoapp.yml` configuration file directly
543
562
  ---
544
563
  chdir: /opt/nginx/html/your_rhoconnect_app
545
564
  # ...
546
565
 
547
566
  or as root user generate a new one
548
- $ env PATH=/opt/rhoconnect/bin:$PATH thin config -C /etc/thin/your_rhoconnect_app.yml \
549
- -c /opt/nginx/html/your_rhoconnect_app/ \
550
- --socket /tmp/thin.sock --servers 2 \
551
- --user nginx --group nginx \
567
+ $ env PATH=/opt/rhoconnect/bin:$PATH thin config -C /etc/thin/your_rhoconnect_app.yml
568
+ -c /opt/nginx/html/your_rhoconnect_app/
569
+ --socket /tmp/thin.sock --servers 2
570
+ --user nginx --group nginx
552
571
  --log /var/log/thin/thin.log --pid /var/run/thin/thin.pid -e production`
553
572
 
554
573
  f) As root user restart Nginx, and Thin servers
@@ -1,7 +1,10 @@
1
1
  #!/bin/sh
2
-
3
- #echo "after_install script is running ..."
4
2
  echo "Starting rhoconnect installer ..."
5
3
 
6
4
  cd /opt/rhoconnect/installer
7
5
  ./install.sh
6
+ STATUS=$?
7
+ cd ../
8
+ rm -rf installer/
9
+
10
+ exit $STATUS
@@ -8,21 +8,20 @@ module Constants
8
8
  "libaprutil1-dev",
9
9
  "dtach"]
10
10
 
11
- RUBY = "ruby-1.9.3-p286"
12
- REDIS = "redis-2.4.17"
13
- SQLITE3 = "sqlite-autoconf-3071000"
14
- NGINX = "nginx-1.3.7"
11
+ RUBY = "ruby-1.9.3-p392"
12
+ REDIS = "redis-2.6.10"
13
+ SQLITE3 = "sqlite-autoconf-3071502"
14
+ NGINX = "nginx-1.3.13"
15
15
  PASSENGER_ROOT = "/opt/rhoconnect/lib/ruby/gems/1.9.1/gems/passenger"
16
16
 
17
17
  SOFTWARE = [ REDIS, SQLITE3, RUBY, NGINX ]
18
18
 
19
19
  REDIS_URL = "http://redis.googlecode.com/files/#{REDIS}.tar.gz"
20
- SQLITE3_URL = "http://www.sqlite.org/sqlite-autoconf-3071000.tar.gz"
20
+ SQLITE3_URL = "http://www.sqlite.org/#{SQLITE3}.tar.gz"
21
21
  NGINX_URL = "http://nginx.org/download/#{NGINX}.tar.gz"
22
- EVENTMACHINE_URL = "https://github.com/rhomobile/eventmachine/tarball/master"
23
22
  URLS = [ REDIS_URL, SQLITE3_URL, NGINX_URL]
24
23
  GEMS = ["bundler"] # foreman"
25
-
24
+
26
25
  SUPPORTED_PKG_MGRS = ["apt-get", "yum"]
27
26
  SUPPORTED_WEB_SERVERS = ["apache2", "nginx"]
28
27
 
@@ -22,21 +22,19 @@ module Installers
22
22
 
23
23
  def install_all_gems
24
24
  @gem_path = "#{@options[:prefix]}/bin/gem"
25
-
26
- # Update the RubyGems system software
27
- cmd "#{@gem_path} update --system"
28
- # Install bundler
25
+ # Update the RubyGems system software
26
+ # FIXME: => v.2.0.0
27
+ cmd "#{@gem_path} update --system 1.8.25"
29
28
  GEMS.each do |gem|
30
- install_gem gem
29
+ install_gem(gem)
31
30
  end
32
31
  end
33
32
 
34
- # install_gem
35
- def install_gem(gem)
36
- print_header "Installing #{gem} gem ..."
37
- cmd "#{@gem_path} install #{gem} --no-ri --no-rdoc" #unless check_gem(gem, @gem_path)
33
+ def install_gem(gem, options = "--no-ri --no-rdoc")
34
+ print_header "Installing #{gem} ..."
35
+ cmd "#{@gem_path} install #{gem} #{options}"
38
36
  raise "#{gem} installation failed." if $? != 0
39
- end #install_gem
37
+ end
40
38
 
41
39
  # install_redis
42
40
  # This method installs redis
@@ -74,20 +72,14 @@ module Installers
74
72
 
75
73
  def install_rhoconnect
76
74
  print_header "Building rhoconnect gem ..."
77
- Dir.chdir(@options[:start_dir])
75
+ Dir.chdir("#{@options[:prefix]}/installer")
78
76
 
79
77
  cmd "#{@options[:prefix]}/bin/bundle config build.sqlite3 " +
80
78
  "--with-sqlite3-include=#{@options[:prefix]}/include " +
81
- "--with-sqlite3-lib=#{@options[:prefix]}/lib" #if @options[:pkg_mgr] =~ /yum/ # CentOS
82
-
83
- # cmd "#{@options[:prefix]}/bin/bundle install --system --binstubs=/opt/rhoconnect/bin"
84
- # cmd "PATH=#{@options[:prefix]}/bin:$PATH rake build"
85
- # cmd "#{@gem_path} install pkg/rhoconnect-*.gem --no-ri --no-rdoc"
86
- # raise "Gem installation failed." if $? != 0
87
-
79
+ "--with-sqlite3-lib=#{@options[:prefix]}/lib"
88
80
  gem_name = (Dir.glob "rhoconnect-*.gem")[0]
89
81
  if gem_name && File.exists?(gem_name)
90
- install_gem gem_name
82
+ install_gem(gem_name)
91
83
  else
92
84
  cmd "#{@options[:prefix]}/bin/bundle install --system --binstubs=/opt/rhoconnect/bin --without=test development"
93
85
  cmd "PATH=#{@options[:prefix]}/bin:$PATH rake build"
@@ -59,18 +59,24 @@ optparse = OptionParser.new do|opts|
59
59
  opts.on( '-w', '--web-server SERVER', 'Specify apache2 or nginx. Default is Nginx.' ) do |server|
60
60
  options[:web_server] = server
61
61
  end #do
62
+
63
+ opts.on( '-d', '--dist DISTRO', 'Specify DISTRO as the current distribution.' ) do |dist|
64
+ options[:dist] = dist
65
+ end
66
+ opts.on('-l', '--Logfile file', ' Specify installtion log file') do |file|
67
+ options[:log_file] = file
68
+ end
62
69
 
63
70
  opts.on( '-h', '--help', 'Display this screen.' ) do
64
71
  puts opts
65
72
  exit
66
73
  end #do
67
74
  end
68
-
69
- options[:start_dir] = `pwd`.strip
70
75
 
71
76
  optparse.parse!
72
77
 
73
- log = Logger.new(IO.readlines("#{options[:prefix]}/info.dat").last.strip)
78
+ @log_file = options[:log_file]
79
+ log = Logger.new(@log_file)
74
80
  log.datetime_format = "%Y-%m-%d %H:%M:%S" # simplify time output
75
81
  options[:log] = log
76
82
 
@@ -1,3 +1,3 @@
1
1
  module Rhoconnect
2
- VERSION = '3.4.3'
2
+ VERSION = '3.4.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rhoconnect
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.3
4
+ version: 3.4.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-21 00:00:00.000000000 Z
12
+ date: 2013-02-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -734,7 +734,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
734
734
  version: '0'
735
735
  segments:
736
736
  - 0
737
- hash: 4550760957355739491
737
+ hash: -4478777276868581465
738
738
  required_rubygems_version: !ruby/object:Gem::Requirement
739
739
  none: false
740
740
  requirements: