stack_car 0.2.2 → 0.2.3

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: c72e980bbffa17149e6be7837ad3ad9e5976067c
4
- data.tar.gz: e145e199cc0618a45a819a788be3f48b06e88874
3
+ metadata.gz: f6733f0600c47bc8fe2254c6cb13f319f95c951e
4
+ data.tar.gz: 6d6ae0940f19e2f2ad7ca10878f2d359018940d9
5
5
  SHA512:
6
- metadata.gz: dd315865d0ad824d4cf554fddb8840d562ff14f21bea436c7678db68b532d9bb5c0da77b9b83e4c2b3cc289c5edf702f6bbe89d144f53f89d4b1a1eb4cc265bb
7
- data.tar.gz: 404f6a4b47a30caa5abe10f67cd5835eab88a3e567a860906a139d343105e9df0ab172d9469e798d85b60bf6d937ade496ed17e410692d246d21205377fa666c
6
+ metadata.gz: 1ce405538df50e3ea51e9adb2cf6664333091ba2a96689c17a09a308ad6d94e6a20531c0384fad527ca17436ab6ff698e6b6f12cbd81b133d6decbdb07de59c8
7
+ data.tar.gz: 1a3c3b6627138f91875d0d0bd66bb9726e1ed3759e124bb7ee8f49602ae15ec35a64e1df51314557d39530e806b05299beb35d8a7d80dd1d549fa953d504d608
data/lib/stack_car/cli.rb CHANGED
@@ -11,13 +11,14 @@ module StackCar
11
11
  end
12
12
 
13
13
  method_option :service, default: 'web', type: :string, aliases: '-s'
14
- method_option :build, default: true, type: :boolean, aliases: '-b'
14
+ method_option :build, default: false, type: :boolean, aliases: '-b'
15
15
  desc "up", "starts docker-compose with rebuild and orphan removal, defaults to web"
16
16
  def up
17
17
  args = ['--remove-orphans']
18
18
  args << '--build' if options[:build]
19
19
  run("rm -rf tmp/pids/server.pid")
20
20
  run("docker-compose up #{args.join(' ')} #{options[:service]}")
21
+ # TODO run("docker cp #{@project_name}_#{options[:service]}_1:/bundle .")
21
22
  end
22
23
 
23
24
  method_option :service, default: '', type: :string, aliases: '-s'
@@ -32,7 +33,6 @@ module StackCar
32
33
  def build
33
34
  @project_name = File.basename(File.expand_path('.'))
34
35
  run("docker-compose build #{options[:service]}")
35
- run("docker cp #{@project_name}_#{options[:service]}_1:/bundle .")
36
36
  end
37
37
 
38
38
 
@@ -114,10 +114,19 @@ module StackCar
114
114
  @db_libs = @db_libs.join(' ')
115
115
 
116
116
 
117
- ['.dockerignore', 'Dockerfile', 'docker-compose.yml', 'docker-compose-prod.yml', '.gitlab-ci.yml', '.env'].each do |template_file|
117
+ ['.dockerignore', 'Dockerfile', 'docker-compose.yml', 'docker-compose-prod.yml', '.gitlab-ci.yml', '.env'].each do |template_file|
118
+ puts template_file
118
119
  template("#{template_file}.erb", template_file)
119
- end
120
- empty_directory('bundle')
120
+ end
121
+ template("database.yml.erb", "config/database.yml")
122
+ empty_directory('bundle')
123
+ run("touch bundle/.gitkeep && git add bundle/.gitkeep") unless File.exists?('bundle/.gitkeep')
124
+ insert_into_file "config/environment.rb", "/bundle", :after => "/.bundle"
125
+
126
+ prepend_to_file "README.md" do
127
+ File.read("#{self.class.source_root}/README.md")
128
+ end
129
+
121
130
  if options[:deploy] || options[:rancher]
122
131
  directory('ops')
123
132
  ['hosts'].each do |template_file|
@@ -1,3 +1,3 @@
1
1
  module StackCar
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
data/templates/.env.erb CHANGED
@@ -2,12 +2,18 @@
2
2
  POSTGRES_DB=<%= @project_name %>
3
3
  POSTGRES_USER=postgres
4
4
  POSTGRES_PASSWORD=DatabaseFTW
5
+ POSTGRES_HOST=postgres
6
+ TEST_DB=<%= @project_name %>
5
7
  <% end -%>
6
8
  <% if options[:mysql] -%>
7
9
  MYSQL_DATABASE=<%= @project_name %>
10
+ MYSQL_USER=root
11
+ MYSQL_PASSWORD=DatabaseFTW
8
12
  MYSQL_ROOT_PASSWORD=DatabaseFTW
13
+ MYSQL_HOST=mysql
14
+ TEST_DB=<%= @project_name %>
9
15
  <% end -%>
10
16
  <% if options[:deploy] || options[:rancher] -%>
11
17
  REGISTRY_HOST=registry.gitlab.com
12
- REGISTRY_URI /TODO/<%= @project_name %>
18
+ REGISTRY_URI=/TODO/<%= @project_name %>
13
19
  <% end -%>
@@ -18,12 +18,12 @@ services:
18
18
 
19
19
  variables:
20
20
  <% if options[:postgres] -%>
21
- POSTGRES_DB: <%= project_name %>
21
+ POSTGRES_DB: <%= @project_name %>
22
22
  POSTGRES_USER: postgres
23
23
  POSTGRES_PASSWORD: DatabaseFTW
24
24
  <% end -%>
25
25
  <% if options[:MYSQL] -%>
26
- MYSQL_DATABASE: <%= project_name %>
26
+ MYSQL_DATABASE: <%= @project_name %>
27
27
  MYSQL_ROOT_PASSWORD: DatabaseFTW
28
28
  <% end -%>
29
29
 
@@ -2,7 +2,7 @@ FROM ruby:2.3.0
2
2
 
3
3
  RUN apt-get update -qq && apt-get install -y build-essential nodejs pv libsasl2-dev <%= @db_libs %> && \
4
4
  apt-get clean && \
5
- rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
5
+ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
6
6
 
7
7
  <% if options[:fcrepo] %>
8
8
  RUN mkdir -p /opt/fits && \
@@ -0,0 +1,23 @@
1
+ # Docker development setup
2
+
3
+ 1) Install Docker.app
4
+
5
+ 2) Get .env file from team member
6
+
7
+ 3) gem install stack_car
8
+
9
+ 4) sc up
10
+
11
+ ``` bash
12
+ gem install stack_car
13
+ sc up
14
+
15
+ ```
16
+
17
+ # Deploy a new release
18
+
19
+ ``` bash
20
+ sc release {staging | production} # creates and pushes the correct tags
21
+ sc deploy {staging | production} # deployes those tags to the server
22
+ ```
23
+
@@ -0,0 +1,31 @@
1
+ <% if options[:mysql] -%>
2
+ login: &login
3
+ adapter: mysql2
4
+ host: <%%= ENV['MYSQL_HOST'] %>
5
+ username: <%%= ENV['MYSQL_USER'] %>
6
+ password: <%%= ENV['MYSQL_PASSWORD'] %>
7
+ database: <%%= ENV['MYSQL_DATABASE'] %>
8
+ <% end -%>
9
+ <% if options[:postgres] -%>
10
+ login: &login
11
+ adapter: postgresql
12
+ host: <%%= ENV['POSTGRES_HOST'] %>
13
+ username: <%%= ENV['POSTGRES_USER'] %>
14
+ password: <%%= ENV['POSTGRES_PASSWORD'] %>
15
+ database: <%%= ENV['POSTGRES_DB'] %>
16
+ <% end -%>
17
+
18
+
19
+ development:
20
+ <<: *login
21
+
22
+ test:
23
+ <<: *login
24
+ database: <%%= ENV['TEST_DB'] %>
25
+
26
+ staging:
27
+ <<: *login
28
+
29
+
30
+ production:
31
+ <<: *login
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.2.2
4
+ version: 0.2.3
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-01-30 00:00:00.000000000 Z
11
+ date: 2017-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -140,6 +140,8 @@ files:
140
140
  - templates/.env.erb
141
141
  - templates/.gitlab-ci.yml.erb
142
142
  - templates/Dockerfile.erb
143
+ - templates/README.md
144
+ - templates/database.yml.erb
143
145
  - templates/docker-compose-prod.yml.erb
144
146
  - templates/docker-compose.yml.erb
145
147
  - templates/hosts.erb