handsome_fencer-circle_c_i 0.1.30 → 0.1.31

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
  SHA256:
3
- metadata.gz: b56185f4a552339ba52dfc9dd2fd906f20c7f8ca6fff69e859e67689eb3a4aa1
4
- data.tar.gz: 337ac939eaa41b5a15978d16ac011a0a921d9911aef46acd981e119469cc8f45
3
+ metadata.gz: 279e98853d236468921ab0073ecc31d7d6932316a1493c5c96ba1231ac82a0a6
4
+ data.tar.gz: 1a1f561d0b5c5829c3f21b6b494d55f7a3219f4176f9629be16eb40a04044749
5
5
  SHA512:
6
- metadata.gz: 4eaf3ca7ea9d8e8dcd637aeb2cd24be464508cc6726e233cb97e8efca372e1fb565d40d0f75b3b28ffcff9efced296307a412916c224309355f5fbe6286d1133
7
- data.tar.gz: f6e3be8b59018a2d47c819a5b9044b71ee2dfe645658f92cd666e5b4df80ec3d2441958c069eaf7af4b6cbb22d5d16d2c7be72498fcde9cf819b09d158406a0d
6
+ metadata.gz: c872c749da73eef74d681a3007b3a22f5d0dc44f53c2fb9b6327fe3ed7120928712dc73b6613c9d74293c471249e84a00b2029edea247c3a2a82a27fe6c49086
7
+ data.tar.gz: 5ac3211599c85639993142b9429dadf0775fef99bec11a4206a31edd100042b73ece32fa2a20e9091aa4c2a2177b66e78d83c5ad9270d082ba25b0e26f28a383
@@ -15,7 +15,29 @@ module HandsomeFencer
15
15
  copy_file "gitignore", ".gitignore" unless File.exist? ".gitignore"
16
16
  append_to_file ".gitignore", "docker/**/*.env"
17
17
  append_to_file ".gitignore", "docker/**/*.key"
18
- append_to_file "docker/containers/database/development.env", "something"
18
+
19
+ app_name = ask("Name of your app:")
20
+ append_to_file 'docker/env_files/circleci.env', "\nexport APP_NAME=#{app_name}"
21
+
22
+ append_to_file 'docker/containers/database/development.env', "\nPOSTGRES_DB=#{app_name}_development"
23
+ append_to_file 'docker/containers/database/production.env', "\nPOSTGRES_DB=#{app_name}_production"
24
+
25
+ {
26
+ "SERVER_HOST" => "ip address of your server",
27
+ "DOCKERHUB_EMAIL" => "You will need an account with Docker, which can be created at hub.docker.com. Once you have your account, please provide the email associated with it here:",
28
+ "DOCKERHUB_USER" => "Please provide your Docker username here:",
29
+ "DOCKERHUB_PASS" => "Please provide your Docker password here:"
30
+ }.each do |env_var, prompt|
31
+ variable_value = ask(prompt)
32
+ append_to_file 'docker/env_files/circleci.env', "\nexport #{env_var}=#{variable_value}"
33
+ end
34
+ account_type = ask("Are your images associated with your user name or an organization?", :limited_to => %w[organization user])
35
+ if account_type = "organization"
36
+ org_name = ask("Organization name:")
37
+ append_to_file 'docker/env_files/circleci.env', "\nexport DOCKERHUB_ORG_NAME=#{org_name}"
38
+ else
39
+ append_to_file 'docker/env_files/circleci.env', "\nexport DOCKERHUB_ORG_NAME=${DOCKERHUB_USER}"
40
+ end
19
41
  end
20
42
  end
21
43
  end
@@ -0,0 +1,4 @@
1
+ require 'sshkit'
2
+ import 'lib/tasks/deploy.rake'
3
+
4
+ task :default => 'docker:deploy'
@@ -0,0 +1,33 @@
1
+ defaults: &defaults
2
+ working_directory: /tmp
3
+
4
+ version: 2
5
+
6
+ jobs:
7
+
8
+ build:
9
+ machine: true
10
+ steps:
11
+ - checkout
12
+ - add_ssh_keys
13
+
14
+ - run: gem install handsome_fencer-circle_c_i
15
+ - run: handsome_fencer-circle_c_i expose circleci
16
+ - run: handsome_fencer-circle_c_i expose development
17
+ - run: echo 'source docker/env_files/circleci.env' >> $BASH_ENV
18
+ - run: docker-compose build
19
+ - run: docker-compose up -d
20
+ - run: docker-compose exec app bin/rails db:create db:migrate
21
+ - run: docker login -u $DOCKERHUB_USER -p $DOCKERHUB_PASS
22
+ - run:
23
+ name: Tag app image
24
+ command: docker tag $(docker images | grep project_app | awk '{ print $3 }') ${DOCKERHUB_ORG_NAME}/${APP_NAME}_app:$DEPLOY_TAG
25
+ - run:
26
+ name: Tag web image
27
+ command: docker tag $(docker images | grep project_web | awk '{ print $3 }') ${DOCKERHUB_ORG_NAME}/${APP_NAME}_web:$DEPLOY_TAG
28
+
29
+
30
+ - run: docker push ${DOCKERHUB_ORG_NAME}/${APP_NAME}_app:$DEPLOY_TAG
31
+ - run: docker push ${DOCKERHUB_ORG_NAME}/${APP_NAME}_web:$DEPLOY_TAG
32
+
33
+ - run: rake --rakefile .circleci/Rakefile
@@ -9,14 +9,23 @@ jobs:
9
9
  machine: true
10
10
  steps:
11
11
  - checkout
12
- - add_ssh_keys
13
- - run: bundle --gemfile='.circleci/Gemfile'
12
+ - run: gem install handsome_fencer-circle_c_i
13
+ - run: handsome_fencer-circle_c_i expose circleci
14
14
  - run: handsome_fencer-circle_c_i expose development
15
- - run: handsome_fencer-circle_c_i expose circle
16
- - run: echo 'source .circleci/circle.env' >> $BASH_ENV
17
- - run: docker-compose build
18
- - run: docker-compose up -d
15
+ - run: echo 'source docker/env_files/circleci.env' >> $BASH_ENV
16
+ - run: docker-compose up -d app --build
19
17
  - run: docker-compose exec app bin/rails db:create db:migrate
18
+ - run: docker-compose exec app bin/rails test
19
+
20
+ push:
21
+ machine: true
22
+ steps:
23
+ - checkout
24
+ - run: gem install handsome_fencer-circle_c_i
25
+ - run: handsome_fencer-circle_c_i expose circleci
26
+ - run: handsome_fencer-circle_c_i expose development
27
+ - run: echo 'source docker/env_files/circleci.env' >> $BASH_ENV
28
+ - run: docker-compose build app web
20
29
  - run: docker login -u $DOCKERHUB_USER -p $DOCKERHUB_PASS
21
30
  - run:
22
31
  name: Tag app image
@@ -29,4 +38,32 @@ jobs:
29
38
  - run: docker push ${DOCKERHUB_ORG_NAME}/${APP_NAME}_app:$DEPLOY_TAG
30
39
  - run: docker push ${DOCKERHUB_ORG_NAME}/${APP_NAME}_web:$DEPLOY_TAG
31
40
 
41
+ deploy:
42
+ machine: true
43
+ steps:
44
+ - checkout
45
+ - add_ssh_keys
46
+ - run: gem install handsome_fencer-circle_c_i
47
+ - run: handsome_fencer-circle_c_i expose circleci
48
+ - run: handsome_fencer-circle_c_i expose development
49
+ - run: echo 'source docker/env_files/circleci.env' >> $BASH_ENV
50
+
32
51
  - run: rake --rakefile .circleci/Rakefile
52
+
53
+ workflows:
54
+ version: 2
55
+ build-and-deploy:
56
+ jobs:
57
+ - build
58
+ - push:
59
+ requires:
60
+ - build
61
+ filters:
62
+ branches:
63
+ only: master
64
+ - deploy:
65
+ requires:
66
+ - push
67
+ filters:
68
+ branches:
69
+ only: master
@@ -1,9 +1,9 @@
1
- FROM ruby:2.5-alpine
1
+ FROM ruby:2.5.3-alpine
2
2
 
3
3
  LABEL maintainer="your-email-here@gmail.com"
4
4
 
5
5
  RUN apk add --no-cache --update build-base linux-headers \
6
- postgresql-dev nodejs tzdata libxml2-dev libxslt-dev imagemagick yarn
6
+ postgresql-dev nodejs tzdata libxml2-dev libxslt-dev imagemagick
7
7
 
8
8
  COPY Gemfile* /usr/src/app/
9
9
  WORKDIR /usr/src/app
@@ -1,3 +1,2 @@
1
1
  POSTGRES_USER=postgres
2
2
  POSTGRES_PASSWORD=some-long-secure-password
3
- POSTGRES_DB=sandbox_development
@@ -1,12 +1,4 @@
1
- export APP_NAME=
2
-
3
- export DOCKERHUB_PASS=
4
- export DOCKERHUB_EMAIL=
5
- export DOCKERHUB_USER=
6
- export DOCKERHUB_ORG_NAME=
7
-
8
1
  export DEPLOY_TAG=${CIRCLE_SHA1:0:7}
9
2
  export DEPLOY_PATH=${APP_NAME}
10
- export SERVER_HOST=
11
3
  export SERVER_USER=root
12
4
  export SERVER_PORT=22
@@ -3,7 +3,7 @@ version: '3.1'
3
3
  services:
4
4
 
5
5
  app:
6
- image: rennmappe/bacchanal_app:$DEPLOY_TAG
6
+ image: rennmappe/recallapi_app:$DEPLOY_TAG
7
7
  secrets:
8
8
  - host_ssh_key
9
9
  command: [ "bundle", "exec", "puma", "-C", "config/puma.rb" ]
@@ -12,25 +12,23 @@ services:
12
12
  - database
13
13
 
14
14
  volumes:
15
- - app-data:/bacchanal
16
- environment:
17
- - RAILS_MASTER_KEY
15
+ - app-data:/recallapi
18
16
  env_file:
19
- - .circleci/containers/database/production.env
20
- - .circleci/containers/app/production.env
17
+ - docker/containers/app/production.env
18
+ - docker/containers/database/production.env
21
19
  expose:
22
20
  - '3000'
23
21
 
24
22
  database:
25
23
  image: postgres
26
24
  env_file:
27
- - .circleci/containers/database/production.env
25
+ - docker/containers/database/production.env
28
26
 
29
27
  volumes:
30
28
  - db-data:/var/lib/postgresql/data
31
29
 
32
30
  web:
33
- image: rennmappe/bacchanal_web:$DEPLOY_TAG
31
+ image: rennmappe/recallapi_web:$DEPLOY_TAG
34
32
  command: [ "nginx", "-g", "daemon off;" ]
35
33
  depends_on:
36
34
  - app
@@ -17,13 +17,39 @@ server = SSHKit::Host.new(hostname: hostname, port: port, user: user)
17
17
  namespace :deploy do
18
18
 
19
19
  desc 'copy to server files needed to run and manage Docker containers'
20
-
21
20
  task :configs do
22
21
 
23
22
  on server do
24
23
  within deploy_path do
25
- upload! File.expand_path('../../config/containers/docker-compose.yml', __dir__), '.'
26
- upload! File.expand_path('../../.env', __dir__), '.', recursive: true
24
+ upload! File.expand_path('../../docker/overrides/production.docker-compose.yml', __dir__), 'docker-compose.yml'
25
+ upload! File.expand_path('../../docker', __dir__), '.', recursive: true
26
+ execute 'apt', 'install', 'ruby'
27
+ execute 'gem', 'install', 'handsome_fencer-circle_c_i'
28
+ execute 'handsome_fencer-circle_c_i', 'expose', 'production'
29
+ end
30
+ end
31
+ end
32
+
33
+ desc 'copy production key to server'
34
+ task :production_key do
35
+
36
+ on server do
37
+ within deploy_path do
38
+
39
+ upload! '.circleci/keys/production.key', '.circleci/keys/production.key'
40
+ end
41
+ end
42
+ end
43
+
44
+ desc 'expose production environment'
45
+ task :expose_production_environment do
46
+
47
+ on server do
48
+ within deploy_path do
49
+
50
+ execute 'apt', 'install', 'ruby'
51
+ execute 'gem', 'install', 'handsome_fencer-circle_c_i'
52
+ execute 'handsome_fencer-circle_c_i', 'expose', 'production'
27
53
  end
28
54
  end
29
55
  end
@@ -1,5 +1,5 @@
1
1
  module HandsomeFencer
2
2
  module CircleCI
3
- VERSION = '0.1.30'
3
+ VERSION = '0.1.31'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: handsome_fencer-circle_c_i
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.30
4
+ version: 0.1.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - schadenfred
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-03 00:00:00.000000000 Z
11
+ date: 2018-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sshkit
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: minitest-given
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -121,8 +135,9 @@ files:
121
135
  - lib/handsome_fencer/circle_c_i/crypto.rb
122
136
  - lib/handsome_fencer/circle_c_i/templates/Gemfile
123
137
  - lib/handsome_fencer/circle_c_i/templates/Gemfile.lock
138
+ - lib/handsome_fencer/circle_c_i/templates/circleci/Rakefile
139
+ - lib/handsome_fencer/circle_c_i/templates/circleci/config.job-example.yml
124
140
  - lib/handsome_fencer/circle_c_i/templates/circleci/config.yml
125
- - lib/handsome_fencer/circle_c_i/templates/circleci/config.yml.workflow-example
126
141
  - lib/handsome_fencer/circle_c_i/templates/config.job-example.yml
127
142
  - lib/handsome_fencer/circle_c_i/templates/config.yml
128
143
  - lib/handsome_fencer/circle_c_i/templates/config/database.yml
@@ -135,11 +150,7 @@ files:
135
150
  - lib/handsome_fencer/circle_c_i/templates/docker/containers/web/Dockerfile
136
151
  - lib/handsome_fencer/circle_c_i/templates/docker/containers/web/app.conf
137
152
  - lib/handsome_fencer/circle_c_i/templates/docker/containers/web/production.env
138
- - lib/handsome_fencer/circle_c_i/templates/docker/containers/web/production.env.enc
139
153
  - lib/handsome_fencer/circle_c_i/templates/docker/env_files/circleci.env
140
- - lib/handsome_fencer/circle_c_i/templates/docker/keys/circle.key
141
- - lib/handsome_fencer/circle_c_i/templates/docker/keys/development.key
142
- - lib/handsome_fencer/circle_c_i/templates/docker/keys/production.key
143
154
  - lib/handsome_fencer/circle_c_i/templates/docker/overrides/production.docker-compose.yml
144
155
  - lib/handsome_fencer/circle_c_i/templates/gitignore
145
156
  - lib/handsome_fencer/circle_c_i/templates/lib/tasks/deploy.rake
@@ -1,62 +0,0 @@
1
- defaults: &defaults
2
- working_directory: /tmp
3
-
4
- version: 2
5
-
6
- jobs:
7
-
8
- build:
9
- machine: true
10
- steps:
11
- - checkout
12
- - run: gem install handsome_fencer-circle_c_i
13
- - run: ruby .circleci/expose_env.rb
14
- - run: docker-compose build dev_app database
15
- - run: docker-compose run dev_app bin/rails db:create db:migrate test
16
-
17
- push:
18
- docker:
19
- - image: circleci/ruby:2.5.1-node-browsers
20
- environment:
21
- BASH_ENV: .env/circle/deploy.env
22
- steps:
23
- - checkout
24
- - setup_remote_docker
25
- - run: gem install handsomefencer-environment
26
- - run: ruby expose_env.rb
27
- - run: docker-compose up -d --build
28
- - run:
29
- name: Tag web image
30
- command: docker tag $(docker images | grep project_web | awk '{ print $3 }') rennmappe/bacchanal_web:$DEPLOY_TAG
31
- - run: docker login -u $DOCKERHUB_USER -p $DOCKERHUB_PASS
32
- - run: docker push rennmappe/bacchanal_web:$DEPLOY_TAG
33
-
34
- deploy:
35
- docker:
36
- - image: circleci/ruby:2.5.1-node-browsers
37
- environment:
38
- BASH_ENV: .env/circle/deploy.env
39
- steps:
40
- - checkout
41
- - add_ssh_keys
42
- - run: bundle install --without production
43
- - run: ruby expose_env.rb
44
- - run: bin/rails docker:deploy
45
-
46
- workflows:
47
- version: 2
48
- build-and-deploy:
49
- jobs:
50
- - build
51
- - push:
52
- requires:
53
- - build
54
- filters:
55
- branches:
56
- only: master
57
- - deploy:
58
- requires:
59
- - push
60
- filters:
61
- branches:
62
- only: master
@@ -1,9 +0,0 @@
1
- ortOJDNNR0mHvJFDoEHTWE8HrE+dJ1BQypXQvz+aY1Cy4no+HHrJZwZJxddZ
2
- 9Vxd+6BTblPsEiSFpaBz/K08AlRrH0CZBG5AvxZUEJe79OtDdcssuFOQJ6fW
3
- hu6+8jnXCKnZK4Jq2n13lW/PuWQO7I4n1/Q0DvnTLZmWZ+bW7w2h1D9W0GeJ
4
- C1PjBWehn3Mxx46rl0bPA+u9U2/4+46DE0wxcHSLDz5Y7IN2COEpAHZyyddB
5
- NBXS9K9I4ugBXiTRbcdTqQiAlnLHK2mAUjVx5Xz/O2FqiDbS5sbmZTp/eFbJ
6
- IdCdLIt3v5I8nQ9/zv9U0dBWk5VBM9/6LUSTXv6ImaTWzeQgIup5oovwvpoD
7
- WONaPjBph/JxylpV30VvmoO3aJYujiLp/ODGeXfG+LsC8dm1ARK/Ze+CfH6R
8
- gyiT5M4vOOeY7TFiFka6BdQyBktwlr8fDadQIklgcVm28mYsITdap+CIj4MJ
9
- HYm7erlKzic=
@@ -1 +0,0 @@
1
- onfZ0vi1iYCvvTJiwwdrvA==
@@ -1 +0,0 @@
1
- x5lqMwe/f3sAUCa0Dw6gkg==
@@ -1 +0,0 @@
1
- NgFzgk2EaRktfGaRlkgh5w==