stack_car 0.3.2 → 0.3.4

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: 93b58e9c3c162600cc498d4c2242c5da431c090d
4
- data.tar.gz: d4608eac83ba102a95180a2045a86e8a061397b7
3
+ metadata.gz: 2331786a667cdd1c925669949212b88fc6b9c9a6
4
+ data.tar.gz: db83a6aa549e9f2dce0b61e9c2cbd0ffc3cc5ee7
5
5
  SHA512:
6
- metadata.gz: a9897dcb06eb7a510182c81157f58c478dde1f4fd029c1721fa64a5f5dc4dbb31948b4cf37eb10c30dc816fc2d0fd4ed9c9cb1e249be371da91bfad44b8b1c3f
7
- data.tar.gz: 23b934044181ea9b232226b41d15149b9ea75726d73d91245373a744fa061cf3be39ecfc17d49629e2096a69477c487f75321b477d6f1e1e32d576149408c5bd
6
+ metadata.gz: c36afa299abfc85fdfaa533fbff3c2a787619d76e369c91b5b10284a94349fc38e8bb8c710759eedba0ffbf3fe4e93c93e3c4ed4d88c9b1b6f2f876676c4245f
7
+ data.tar.gz: 52f60ba42b4939e897e4382de82bb2dd8b083f9aa749ae1e90089ab8c836f08d8b6c8af52fe8ac971a5c87683059f7921349e6e03223eed7e144b2a8fe03ccc0
data/lib/stack_car/cli.rb CHANGED
@@ -93,23 +93,37 @@ module StackCar
93
93
  def release(environment)
94
94
  timestamp = Time.now.strftime("%Y%m%d%I%M%S")
95
95
  registry = "#{ENV['REGISTRY_HOST']}#{ENV['REGISTRY_URI']}"
96
- run("docker login #{ENV['REGISTRY_HOST']}")
97
- run("docker tag #{registry} #{registry}:#{environment}-#{timestamp}")
96
+ tag = ENV["TAG"] || 'latest'
97
+ unless File.exists?("#{ENV['HOME']}/.docker/config.json") && File.readlines("#{ENV['HOME']}/.docker/config.json").grep(/#{ENV['REGISTRY_HOST']}/).size > 0
98
+ run("docker login #{ENV['REGISTRY_HOST']}")
99
+ end
100
+ run("docker tag #{registry}:#{tag} #{registry}:#{environment}-#{timestamp}")
98
101
  run("docker push #{registry}:#{environment}-#{timestamp}")
99
- run("docker tag #{registry} #{registry}:#{environment}-latest")
102
+ run("docker tag #{registry}:#{tag} #{registry}:#{environment}-latest")
100
103
  run("docker push #{registry}:#{environment}-latest")
101
- run("docker tag #{registry} #{registry}:latest")
104
+ run("docker tag #{registry}:#{tag} #{registry}:latest")
102
105
  run("docker push #{registry}:latest")
103
106
  end
104
107
 
105
108
  desc "provision ENVIRONMENT", "configure the servers for docker and then deploy an image"
106
109
  def provision(environment)
107
- run("cd ops && ansible-playbook -i hosts -l #{environment}:localhost provision.yml")
110
+ run("ansible-playbook -i ops/hosts -l #{environment}:localhost ops/provision.yml")
111
+ end
112
+
113
+ method_option :service, default: 'web', type: :string, aliases: '-s'
114
+ desc "ssh ENVIRONMENT", "log in to a running instance - requires PRODUCTION_SSH to be set"
115
+ def ssh(environment)
116
+ target = ENV["#{environment.upcase}_SSH"]
117
+ if target
118
+ run(target)
119
+ else
120
+ say "Please set #{environment.upcase}_SSH"
121
+ end
108
122
  end
109
123
 
110
124
  desc "deploy ENVIRONMENT", "deploy an image from the registry"
111
125
  def deploy(environment)
112
- run("cd ops && ansible-playbook -i hosts -l #{environment}:localhost deploy.yml")
126
+ run("ansible-playbook -i ops/hosts -l #{environment}:localhost ops/deploy.yml")
113
127
  end
114
128
 
115
129
  method_option :elasticsearch, default: false, type: :boolean, aliases: '-e'
@@ -1,3 +1,3 @@
1
1
  module StackCar
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.4"
3
3
  end
data/templates/.env.erb CHANGED
@@ -23,5 +23,5 @@ SITE_URI=https://TODO.com
23
23
  DEPLOY_HOOK=TODO
24
24
  <% end -%>
25
25
  TAG=dev
26
- VIRUAL_PORT=80
26
+ VIRTUAL_PORT=80
27
27
  PASSENGER_APP_ENV=development
@@ -31,6 +31,7 @@ RUN bundle check || bundle install
31
31
  RUN touch /var/log/worker.log && chmod 666 /var/log/worker.log
32
32
  RUN mkdir /etc/service/worker
33
33
  ADD ops/worker.sh /etc/service/worker/run
34
+ RUN chmod +x /etc/service/worker/run
34
35
  <% end %>
35
36
 
36
37
  COPY . $APP_HOME
@@ -38,6 +39,7 @@ RUN chown -R app $APP_HOME
38
39
 
39
40
  # Asset complie and migrate if prod, otherwise just start nginx
40
41
  ADD ops/nginx.sh /etc/service/nginx/run
42
+ RUN chmod +x /etc/service/nginx/run
41
43
  RUN rm -f /etc/service/nginx/down
42
44
 
43
45
  CMD ["/sbin/my_init"]
@@ -62,7 +62,7 @@ services:
62
62
  - "8080"
63
63
  <% end -%>
64
64
  web:
65
- image: "${REGISTRY_HOST}/${REGISTRY_URI}:${TAG:-master}"
65
+ image: "${REGISTRY_HOST}${REGISTRY_URI}:${TAG:-master}"
66
66
  env_file:
67
67
  - .env-example
68
68
  labels:
@@ -1,7 +1,7 @@
1
1
  version: '2.1'
2
2
  services:
3
3
  web:
4
- image: "${REGISTRY_HOST}/${REGISTRY_URI}:${TAG:-master}"
4
+ image: "${REGISTRY_HOST}${REGISTRY_URI}:${TAG:-master}"
5
5
  environment:
6
6
  - RAILS_ENV=production
7
7
  - RACK_ENV=production
@@ -77,7 +77,7 @@ services:
77
77
  <% end -%>
78
78
  web:
79
79
  build: .
80
- image: "${REGISTRY_HOST}/${REGISTRY_URI}:${TAG:-master}"
80
+ image: "${REGISTRY_HOST}${REGISTRY_URI}:${TAG:-master}"
81
81
  volumes:
82
82
  - .:/home/app/webapp
83
83
  env_file:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stack_car
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Kaufman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-20 00:00:00.000000000 Z
11
+ date: 2017-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler