capistrano3-ubuntu-server-prepare 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 352a3494a8a91dc55f202b1d48af5a219d744a25
4
- data.tar.gz: b40b026cf66b06204b760e96b7bfa99b83cacb5b
3
+ metadata.gz: 646c4939c01853c066de42c902df577ad0dc29f5
4
+ data.tar.gz: bc2fd2ceab30ddcfd3de8585a884c600466eb8c9
5
5
  SHA512:
6
- metadata.gz: 93bfb1affa68800598b4dd10446889c8d403ea0c3548d8c271bea7451b7a7cff2d6722f8bcfff913da910da88318a71bd8111c361cfe103152a6ae0554f6bbc6
7
- data.tar.gz: bc7a3f25b022822a128bc972629b09f9c0a35937a958f8b7a7b4c16d916037a56b5474b41fe6a5a16820772c2ad80d8a09757a0e06605889227728355d9a69c8
6
+ metadata.gz: e824336cfaaa093c99dfea71567bb63db70abce26e46b71a85259eb1edf94ac4a6ed63daae56b0d7420d1e1743995d7a070022ba577b59168360d93579b5ec32
7
+ data.tar.gz: 9968f15705710b7c1e239b0360f7caf621fef096ce55ece6a4092033d3344373975722066d5656a2fe10aad566b9671f4c5a7e171d3f77f04279a4581a646283
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "capistrano3-ubuntu-server-prepare"
7
- spec.version = "0.0.3"
7
+ spec.version = "0.0.4"
8
8
  spec.authors = ["goooseman"]
9
9
  spec.email = ["inbox@goooseman.ru"]
10
10
  spec.summary = "A task for Capistrano v3 to prepare Ubuntu 14.04 server for first deployment"
@@ -276,12 +276,116 @@ namespace :ubuntu_server_prepare do
276
276
  execute sudo_command + 'add-apt-repository -y ppa:chris-lea/node.js'
277
277
  execute sudo_command + 'apt-get update'
278
278
  execute sudo_command + 'apt-get -y install nodejs gawk g++ gcc make libreadline6-dev zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 autoconf libgdbm-dev libncurses5-dev automake libtool bison pkg-config libffi-dev'
279
- execute "gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3"
279
+ execute "gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3"
280
280
  execute "\\curl -sSL https://get.rvm.io | bash -s stable --rails --gems=bundler --autolibs=read-fail"
281
281
  end
282
+ <<<<<<< HEAD
283
+ end
284
+
285
+ execute "mkdir -p ~/sources/nginx/conf"
286
+ user = capture("echo $USER")
287
+ if fetch :pagespeed_install
288
+ upload! 'config/production/nginx/nginx_with_pagespeed.conf', "/home/#{user}/sources/nginx/conf/nginx.conf"
289
+ else
290
+ upload! 'config/production/nginx/nginx.conf', "/home/#{user}/sources/nginx/conf/nginx.conf"
291
+ end
292
+ upload! 'config/production/nginx/upstart.conf', "/home/#{user}/sources/nginx/conf/"
293
+ execute sudo_command + "cp -f ~/sources/nginx/conf/upstart.conf /etc/init/nginx.conf"
294
+ execute sudo_command + "cp -f ~/sources/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf"
295
+ nginx_status = capture(sudo_command + "status nginx")
296
+ if nginx_status == 'nginx stop/waiting'
297
+ execute sudo_command + "start nginx"
298
+ else
299
+ execute sudo_command + 'restart nginx'
300
+ end
301
+ =======
302
+ >>>>>>> 3b841ddc013973d608456aa8839726cdf98cb11e
282
303
  end
283
304
 
284
305
 
306
+ <<<<<<< HEAD
307
+ execute sudo_command + "apt-get install -y postgresql-9.3 postgresql-server-dev-9.3"
308
+ execute sudo_command + "-u postgres psql -c \"create user #{fetch :postgre_username} with password '#{fetch :postgre_password}';\""
309
+ execute sudo_command + "-u postgres psql -c \"alter role #{fetch :postgre_username} superuser createrole createdb replication;\""
310
+ end
311
+ end
312
+
313
+ desc 'Install Redis'
314
+ task :redis_install do
315
+ on roles(:all) do
316
+ execute "mkdir -p ~/sources/redis"
317
+ execute sudo_command + "apt-get install -y tcl8.5"
318
+ within "~/sources/redis" do
319
+ execute :wget, "http://download.redis.io/redis-stable.tar.gz"
320
+ execute :tar, "xvzf redis-stable.tar.gz"
321
+ end
322
+ within "~/sources/redis/redis-stable" do
323
+ execute :make
324
+ end
325
+ execute sudo_command + "cp -f ~/sources/redis/redis-stable/src/redis-server /usr/local/bin/"
326
+ execute sudo_command + "cp -f ~/sources/redis/redis-stable/src/redis-cli /usr/local/bin/"
327
+ execute sudo_command + "mkdir -p /etc/redis/"
328
+ execute sudo_command + "cp ~/sources/redis/redis-stable/redis.conf /etc/redis/"
329
+ end
330
+ end
331
+
332
+ desc 'Configure Redis'
333
+ task :redis_conf do
334
+ on roles(:all) do
335
+ user = capture("echo $USER")
336
+ execute sudo_command + "mkdir -p /var/www/other"
337
+ execute sudo_command + "mkdir -p /var/www/log"
338
+ execute sudo_command + "chgrp -R web /var/www"
339
+ execute sudo_command + "chmod -R 775 /var/www"
340
+ execute sudo_command + "chown -R #{user} /var/www"
341
+ execute "mkdir -p ~/sources/redis/conf"
342
+
343
+ upload! 'config/production/redis/redis.conf', "/home/#{user}/sources/redis/conf/"
344
+ upload! 'config/production/redis/upstart.conf', "/home/#{user}/sources/redis/conf/"
345
+ execute sudo_command + "cp -f ~/sources/redis/conf/upstart.conf /etc/init/redis-server.conf"
346
+ execute sudo_command + "cp -f ~/sources/redis/conf/redis.conf /etc/redis/"
347
+
348
+ redis_status = capture(sudo_command + "status redis-server")
349
+ if redis_status == 'redis-server stop/waiting'
350
+ execute sudo_command + "start redis-server"
351
+ else
352
+ execute sudo_command + 'restart redis-server'
353
+ end
354
+ end
355
+ end
356
+
357
+ desc 'Install RVM with rails'
358
+ task :rvm_install do
359
+ on roles(:all) do
360
+ execute sudo_command + 'apt-get -y install git curl python-software-properties software-properties-common'
361
+ execute sudo_command + 'add-apt-repository -y ppa:chris-lea/node.js'
362
+ execute sudo_command + 'apt-get update'
363
+ execute sudo_command + 'apt-get -y install nodejs gawk g++ gcc make libreadline6-dev zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 autoconf libgdbm-dev libncurses5-dev automake libtool bison pkg-config libffi-dev'
364
+ execute "gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3"
365
+ execute "\\curl -sSL https://get.rvm.io | bash -s stable --rails --gems=bundler --autolibs=read-fail"
366
+ end
367
+ end
368
+
369
+
370
+
371
+ desc 'Push ssh key to server'
372
+ task :push_ssh_keys do
373
+ on roles(:all) do
374
+ files = Dir.glob(Dir.home() + '/.ssh/*').select { |f| f !~ /\.pub|known|config/ }.map {|f| f.gsub!(Dir.home(), '~')}
375
+ set :key_localtion, ask("private key location (for example: #{files.join(', ')})", '~/.ssh/id_rsa') if !fetch :key_localtion
376
+ home = Dir.home()
377
+ key_location = fetch(:key_localtion).gsub('~', home)
378
+ until File.exists? key_location
379
+ set :key_localtion, ask("private key location (for example: #{files.join(', ')})", '~/.ssh/id_rsa')
380
+ key_location = fetch(:key_localtion).gsub('~', home)
381
+ end
382
+ execute "mkdir -p ~/.ssh"
383
+ user = capture("echo $USER")
384
+ upload! key_location, "/home/#{user}/.ssh/git_key"
385
+ upload! key_location + '.pub', "/home/#{user}/.ssh/git_key.pub"
386
+ execute "echo 'IdentityFile ~/.ssh/git_key' >> ~/.ssh/config"
387
+ execute "chmod -f 600 ~/.ssh/*"
388
+ =======
285
389
 
286
390
  desc 'Push ssh key to server'
287
391
  task :push_ssh_keys do
@@ -301,6 +405,7 @@ namespace :ubuntu_server_prepare do
301
405
  execute "echo 'IdentityFile ~/.ssh/git_key' >> ~/.ssh/config"
302
406
  execute "chmod -f 600 ~/.ssh/*"
303
407
  end
408
+ >>>>>>> 3b841ddc013973d608456aa8839726cdf98cb11e
304
409
  end
305
410
 
306
411
  desc 'Install additional packages'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano3-ubuntu-server-prepare
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - goooseman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-05 00:00:00.000000000 Z
11
+ date: 2015-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline
@@ -87,6 +87,8 @@ files:
87
87
  - Rakefile
88
88
  - capistrano-ubuntu-server-prepare.gemspec
89
89
  - capistrano3-ubuntu-server-prepare-0.0.1.gem
90
+ - capistrano3-ubuntu-server-prepare-0.0.2.gem
91
+ - capistrano3-ubuntu-server-prepare-0.0.3.gem
90
92
  - config/production/nginx/nginx.conf
91
93
  - config/production/nginx/nginx_with_pagespeed.conf
92
94
  - config/production/nginx/upstart.conf