handsome_fencer-circle_c_i 0.1.37 → 0.1.38
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/handsome_fencer/circle_c_i/cli/dockerize.rb +10 -5
- data/lib/handsome_fencer/circle_c_i/cli/generate_key.rb +9 -7
- data/lib/handsome_fencer/circle_c_i/cli/obfuscate.rb +7 -4
- data/lib/handsome_fencer/circle_c_i/templates/Gemfile +0 -2
- data/lib/handsome_fencer/circle_c_i/templates/circleci/Rakefile +1 -1
- data/lib/handsome_fencer/circle_c_i/templates/circleci/config.yml.workflow-example +62 -0
- data/lib/handsome_fencer/circle_c_i/templates/circleci/deploy.rake +127 -0
- data/lib/handsome_fencer/circle_c_i/templates/docker/containers/app/development.env +1 -0
- data/lib/handsome_fencer/circle_c_i/templates/docker/containers/app/production.env +1 -0
- data/lib/handsome_fencer/circle_c_i/templates/docker/containers/database/development.env +1 -0
- data/lib/handsome_fencer/circle_c_i/templates/docker/containers/database/production.env +3 -0
- data/lib/handsome_fencer/circle_c_i/templates/docker/containers/web/development.env +1 -0
- data/lib/handsome_fencer/circle_c_i/templates/docker/containers/web/production.env +1 -9
- data/lib/handsome_fencer/circle_c_i/templates/docker/env_files/circleci.env +15 -2
- data/lib/handsome_fencer/circle_c_i/templates/docker/env_files/circleci.env.enc +14 -0
- data/lib/handsome_fencer/circle_c_i/templates/docker/env_files/production.env +2 -0
- data/lib/handsome_fencer/circle_c_i/templates/docker/env_files/production.env.enc +2 -0
- data/lib/handsome_fencer/circle_c_i/templates/docker/keys/circleci.key +1 -0
- data/lib/handsome_fencer/circle_c_i/templates/docker/keys/development.key +1 -0
- data/lib/handsome_fencer/circle_c_i/templates/docker/keys/production.key +1 -0
- data/lib/handsome_fencer/circle_c_i/templates/docker/overrides/docker-compose.circleci.yml +19 -0
- data/lib/handsome_fencer/circle_c_i/templates/docker/overrides/docker-compose.production.yml +26 -0
- data/lib/handsome_fencer/circle_c_i/templates/docker/web/Dockerfile +20 -0
- data/lib/handsome_fencer/circle_c_i/templates/docker/web/app.conf +23 -0
- data/lib/handsome_fencer/circle_c_i/version.rb +1 -1
- metadata +14 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e348249059bb17352d462c9a189467302358f769c9fd4f505133e702994b2660
|
4
|
+
data.tar.gz: 5262518705ca9ed24c322656031fa425da0cd633c819166201e2a70a0b3dc44c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f92cd064efeb62efaf42a618429a081aa6171e91b8f91b37c70ee4b67e9cc6e181e97dba94ec3ec8c2af020ec9fe56d55b5e1d6fb1f6708a7821db16f450f9cc
|
7
|
+
data.tar.gz: 1a890b95b6b8349c85957aab8cc619c0f414b0fb159eaea4399c434dc560da568e6300a601833971404203028b09d50a9bc0848b43a3aceb4bbe2bf97de8dff6
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# HandsomeFencer::CircleCI
|
2
2
|
|
3
|
-
This gem provides developers a handsome way of deploying applications using Docker, CircleCI, and the server of their choice. It's written in Ruby, uses Thor, and
|
3
|
+
This gem provides developers a handsome way of deploying applications using Docker, CircleCI, and the server of their choice. It's written in Ruby, uses Thor, and admires the Rails philosophy of convention over configuration.
|
4
4
|
|
5
5
|
## Usage
|
6
6
|
|
@@ -46,7 +46,7 @@ docker-compose version 1.21.0, build 5920eb0
|
|
46
46
|
1) Execute the install command:
|
47
47
|
|
48
48
|
```bash
|
49
|
-
$ handsome_fencer-circle_c_i
|
49
|
+
$ handsome_fencer-circle_c_i dockerize
|
50
50
|
```
|
51
51
|
|
52
52
|
2) Ask Docker to use Rails to generate our dockerized Rails app:
|
@@ -55,7 +55,7 @@ $ handsome_fencer-circle_c_i install
|
|
55
55
|
$ docker-compose run app rails new .
|
56
56
|
```
|
57
57
|
|
58
|
-
If you're on a linux machine, you may need to chown the newly created files
|
58
|
+
If you're on a linux machine, you may need to chown the newly created files:
|
59
59
|
|
60
60
|
```bash
|
61
61
|
$ sudo chown <username><user group> -R .
|
@@ -21,23 +21,28 @@ module HandsomeFencer
|
|
21
21
|
|
22
22
|
append_to_file 'docker/containers/database/development.env', "\nPOSTGRES_DB=#{app_name}_development"
|
23
23
|
append_to_file 'docker/containers/database/production.env', "\nPOSTGRES_DB=#{app_name}_production"
|
24
|
-
|
25
24
|
{
|
26
|
-
"SERVER_HOST" => "ip address of your server",
|
27
|
-
"DOCKERHUB_EMAIL" => "You
|
25
|
+
"SERVER_HOST" => "ip address of your server:",
|
26
|
+
"DOCKERHUB_EMAIL" => "You'll need an account with Docker hub.docker.com. Please provide your Docker email:",
|
28
27
|
"DOCKERHUB_USER" => "Please provide your Docker username here:",
|
29
28
|
"DOCKERHUB_PASS" => "Please provide your Docker password here:"
|
30
29
|
}.each do |env_var, prompt|
|
31
30
|
variable_value = ask(prompt)
|
32
31
|
append_to_file 'docker/env_files/circleci.env', "\nexport #{env_var}=#{variable_value}"
|
33
32
|
end
|
34
|
-
account_type = ask("
|
35
|
-
if account_type == "
|
33
|
+
account_type = ask("Will you like to push your images to Docker under user account or organization instead?", :limited_to => %w[o, u])
|
34
|
+
if account_type == "o"
|
36
35
|
org_name = ask("Organization name:")
|
37
36
|
append_to_file 'docker/env_files/circleci.env', "\nexport DOCKERHUB_ORG_NAME=#{org_name}"
|
38
37
|
else
|
39
38
|
append_to_file 'docker/env_files/circleci.env', "\nexport DOCKERHUB_ORG_NAME=${DOCKERHUB_USER}"
|
40
39
|
end
|
40
|
+
{
|
41
|
+
"APP_NAME" => "Name of your app:"
|
42
|
+
}.each do |env_var, prompt|
|
43
|
+
app_name = ask(prompt)
|
44
|
+
template "docker/overrides/docker-compose.production.yml.tt", "docker/overrides/docker-copose.produciton.yml"
|
45
|
+
end
|
41
46
|
end
|
42
47
|
end
|
43
48
|
end
|
@@ -1,17 +1,19 @@
|
|
1
1
|
module HandsomeFencer
|
2
2
|
module CircleCI
|
3
3
|
class CLI < Thor
|
4
|
-
|
4
|
+
map "generate_keys" => "generate_key"
|
5
5
|
desc "generate_key", "(Re)generate a key for each environment"
|
6
6
|
|
7
7
|
def generate_key(*args)
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
default_environments = %w[circleci development production]
|
9
|
+
environments = args.first ? [args.first] : default_environments
|
10
|
+
environments.each do |environment|
|
11
|
+
@cipher = OpenSSL::Cipher.new 'AES-128-CBC'
|
12
|
+
@salt = '8 octets'
|
13
|
+
@new_key = @cipher.random_key
|
13
14
|
|
14
|
-
|
15
|
+
create_file "docker/keys/#{environment}.key", Base64.encode64(@new_key)
|
16
|
+
end
|
15
17
|
end
|
16
18
|
end
|
17
19
|
end
|
@@ -3,13 +3,16 @@ module HandsomeFencer
|
|
3
3
|
module CircleCI
|
4
4
|
class CLI < Thor
|
5
5
|
|
6
|
-
desc "obfuscate", "
|
6
|
+
desc "obfuscate", "obfuscates any files matching the pattern ./docker/**/*.env"
|
7
7
|
|
8
8
|
def obfuscate(*args)
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
default_environments = %w[circleci development production]
|
11
|
+
environments = args.first ? args.first : default_environments
|
12
|
+
environments.each do |environment|
|
13
|
+
@cipher = HandsomeFencer::CircleCI::Crypto.new(environment: environment)
|
14
|
+
@cipher.obfuscate('docker', "#{environment}.env")
|
15
|
+
end
|
13
16
|
end
|
14
17
|
end
|
15
18
|
end
|
@@ -0,0 +1,62 @@
|
|
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
|
@@ -0,0 +1,127 @@
|
|
1
|
+
# use SSHKit directly instead of Capistrano
|
2
|
+
require 'sshkit'
|
3
|
+
require 'sshkit/dsl'
|
4
|
+
include SSHKit::DSL
|
5
|
+
|
6
|
+
deploy_tag = ENV['DEPLOY_TAG']
|
7
|
+
app_name = ENV['APP_NAME']
|
8
|
+
hostname = ENV['SERVER_HOST']
|
9
|
+
user = ENV['SERVER_USER']
|
10
|
+
dockerhub_user = ENV['DOCKERHUB_USER']
|
11
|
+
dockerhub_pass = ENV['DOCKERHUB_PASS']
|
12
|
+
dockerhub_org = ENV['DOCKERHUB_ORG']
|
13
|
+
port = ENV['SERVER_PORT']
|
14
|
+
deploy_env = ENV['DEPLOY_ENV'] || :production
|
15
|
+
deploy_path = ENV['APP_NAME']
|
16
|
+
|
17
|
+
server = SSHKit::Host.new(hostname: hostname, port: port, user: user)
|
18
|
+
|
19
|
+
namespace :deploy do
|
20
|
+
|
21
|
+
desc 'copy to server files needed to run and manage Docker containers'
|
22
|
+
task :configs do
|
23
|
+
|
24
|
+
on server do
|
25
|
+
within deploy_path do
|
26
|
+
upload! File.expand_path('../docker-compose.yml', __dir__), 'docker-compose.yml'
|
27
|
+
|
28
|
+
upload! File.expand_path('../docker', __dir__), '.', recursive: true
|
29
|
+
execute 'apt', 'install', '-y', 'ruby'
|
30
|
+
execute 'gem', 'install', 'handsome_fencer-circle_c_i'
|
31
|
+
execute 'handsome_fencer-circle_c_i', 'expose', 'production'
|
32
|
+
execute :source, './docker/env_files/production.env'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# desc 'copy production key to server'
|
38
|
+
# task :production_key do
|
39
|
+
#
|
40
|
+
# on server do
|
41
|
+
# within deploy_path do
|
42
|
+
#
|
43
|
+
# upload! '.circleci/keys/production.key', '.circleci/keys/production.key'
|
44
|
+
# end
|
45
|
+
# end
|
46
|
+
# end
|
47
|
+
#
|
48
|
+
# desc 'expose production environment'
|
49
|
+
# task :expose_production_environment do
|
50
|
+
#
|
51
|
+
# on server do
|
52
|
+
# within deploy_path do
|
53
|
+
# execute 'snap', 'install', 'ruby', '--classic'
|
54
|
+
# execute 'gem', 'install', 'handsome_fencer-circle_c_i'
|
55
|
+
# execute 'handsome_fencer-circle_c_i', 'expose', 'production'
|
56
|
+
# end
|
57
|
+
# end
|
58
|
+
# end
|
59
|
+
end
|
60
|
+
|
61
|
+
namespace :docker do
|
62
|
+
|
63
|
+
desc 'logs into Docker Hub for pushing and pulling'
|
64
|
+
task :login do
|
65
|
+
on server do
|
66
|
+
execute "mkdir -p #{deploy_path}"
|
67
|
+
within deploy_path do
|
68
|
+
execute 'docker', 'login', '-u', dockerhub_user, '-p', dockerhub_pass
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
desc 'stops all Docker containers via Docker Compose'
|
74
|
+
task stop: 'deploy:configs' do
|
75
|
+
on server do
|
76
|
+
within deploy_path do
|
77
|
+
with rails_env: deploy_env, deploy_tag: deploy_tag do
|
78
|
+
execute 'docker-compose', 'stop'
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
desc 'starts all Docker containers via Docker Compose'
|
85
|
+
task start: 'deploy:configs' do
|
86
|
+
on server do
|
87
|
+
within deploy_path do
|
88
|
+
with rails_env: deploy_env, deploy_tag: deploy_tag do
|
89
|
+
execute 'docker-compose', 'docker-compose', '-f', 'docker-compose.yml', '-f', 'docker/overrides/docker-compose.production.yml',
|
90
|
+
'up', '-d'
|
91
|
+
execute 'echo', deploy_tag , '>', 'deploy.tag'
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
desc 'pulls images from Docker Hub'
|
98
|
+
task pull: 'docker:login' do
|
99
|
+
on server do
|
100
|
+
within deploy_path do
|
101
|
+
images = [
|
102
|
+
"#{dockerhub_org}/#{app_name}_app:#{deploy_tag}",
|
103
|
+
"#{dockerhub_org}/#{app_name}_web:#{deploy_tag}",
|
104
|
+
"postgres:9.4.5"
|
105
|
+
]
|
106
|
+
images.each do |image|
|
107
|
+
execute 'docker', 'pull', "#{image}"
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
desc 'runs database migrations in application container via Docker Compose'
|
114
|
+
task migrate: 'deploy:configs' do
|
115
|
+
on server do
|
116
|
+
within deploy_path do
|
117
|
+
with rails_env: deploy_env, deploy_tag: deploy_tag do
|
118
|
+
execute 'docker-compose', '-f', 'docker-compose.yml', '-f', 'docker/overrides/docker-compose.production.yml',
|
119
|
+
'exec', 'app', "bin/rails", 'db:create', 'db:migrate'
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
desc 'pulls images, stops old containers, updates the database, and starts new containers'
|
126
|
+
task deploy: %w{docker:pull docker:stop docker:migrate docker:start }
|
127
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
CA_SSL=false
|
@@ -1,9 +1 @@
|
|
1
|
-
|
2
|
-
export DOCKERHUB_EMAIL="set me"
|
3
|
-
export DOCKERHUB_USER="set me"
|
4
|
-
export PUSH_DEPLOY_TAG=${CIRCLE_PREVIOUS_BUILD_NUM}_${CIRCLE_SHA1:0:7}
|
5
|
-
export DEPLOY_TAG=${CIRCLE_BUILD_NUM}_${CIRCLE_SHA1:0:7}
|
6
|
-
export DEPLOY_PATH="name of our app"
|
7
|
-
export SERVER_HOST="server ip address"
|
8
|
-
export SERVER_USER="probably root"
|
9
|
-
export SERVER_PORT="probably 22"
|
1
|
+
CA_SSL=true
|
@@ -1,4 +1,17 @@
|
|
1
|
-
export
|
2
|
-
export
|
1
|
+
export APP_NAME=handsomefencer
|
2
|
+
export DOCKERHUB_PASS=itchcn33mo3rd
|
3
|
+
export DOCKERHUB_EMAIL=fred.schoeneman@gmail.com
|
4
|
+
export DOCKERHUB_USER=fdschoeneman
|
5
|
+
export DOCKERHUB_ORG=handsomefencer
|
6
|
+
export DEPLOY_TAAAG=${CIRCLE_SHA1:0:7}
|
7
|
+
export DEPLOY_TAG=c9e7e42
|
8
|
+
export DEPLOY_PATH=handsomefencer
|
9
|
+
export SERVER_HOST=167.99.162.37
|
3
10
|
export SERVER_USER=root
|
4
11
|
export SERVER_PORT=22
|
12
|
+
export POSTGRES_USER=postgres
|
13
|
+
export POSTGRES_PASSWORD=some-long-secure-password
|
14
|
+
export POSTGRES_DB=handsomefencer_development
|
15
|
+
export DATABASE_HOST=database
|
16
|
+
export MAILGUN_API_KEY=key-5b45d533820d066228c9a9795fc0165d
|
17
|
+
export MAILGUN_DOMAIN=handsomefencer.com
|
@@ -0,0 +1,14 @@
|
|
1
|
+
0hvtMYjVtPdhBDLaK94EKSHMMns973iA3+sci1XqIm2/YboGfDV5+N982wUu
|
2
|
+
uqulsbs/dUWPbA56hEr5bzmbt2EjCkLRTeil7vjWuNAmWuiC013S/WsdfKle
|
3
|
+
MpROGITy6maxADEiiukVlIfMgYViqx/MzU8i8KOgWieJhsyk5SICg3oPiEEs
|
4
|
+
dupU+QEQO40I1dH0NkBmJezv99nMihuWHhjpwZBRmfkT1EzNI9LvEYqeauii
|
5
|
+
zHZTqjxYCCLL9WvUeec5euXgIqsqLgjhBkUIEZvvrzI48WsPFslXURLcuYuB
|
6
|
+
wVo1HLu3MFZsEucbYF+LOv0zX1BLJ+DyuscRnKDJUr4TxN4blwKFCML9z2J1
|
7
|
+
XdjvSy1Et5skIWlfvU/HcFBZ93To9N74s6gq8WOkfYUQVE05iuoIe5oveXid
|
8
|
+
NhE2pnfN2JGONdBShoVbbTWgcPInvHu0pukMH0voM2rl+WLRyUjpsvK7B/Fe
|
9
|
+
LW+V9LA2fIYcrt5pX9iELJGZwQJ7iovnmLma/y+Oc107NR8X6KIw51e58cBk
|
10
|
+
lY1zgz4HOcrIG0nTqYMFbp6CCTX8pNZIq7esb4fFY37YOxanjXHxs4rJyEui
|
11
|
+
PkLKOlObkYdisD85QB+b38LRdGJ2phoiKWi/5S3zPBbHBnOH7NjqZeMio1TH
|
12
|
+
pYlx2q77+aK2eoSVZ/Ti5J0+a0Qvl5O424ovewvz2hIh4gI2zwhvVtLa36Fi
|
13
|
+
Vj61TizJIagdajK1DBXp66IP1nOGUIytPHbryCxrghJFig1YiUGNAQq+Jajl
|
14
|
+
VZCalFcTc1k/W9NL7g3fSY064y922NyE+lMfENY6Ds5so7VU43sn
|
@@ -0,0 +1 @@
|
|
1
|
+
onfZ0vi1iYCvvTJiwwdrvA==
|
@@ -0,0 +1 @@
|
|
1
|
+
x5lqMwe/f3sAUCa0Dw6gkg==
|
@@ -0,0 +1 @@
|
|
1
|
+
NgFzgk2EaRktfGaRlkgh5w==
|
@@ -0,0 +1,19 @@
|
|
1
|
+
version: '3.1'
|
2
|
+
|
3
|
+
services:
|
4
|
+
|
5
|
+
database:
|
6
|
+
env_file:
|
7
|
+
- docker/containers/database/production.env
|
8
|
+
|
9
|
+
app:
|
10
|
+
env_file:
|
11
|
+
- docker/containers/app/production.env
|
12
|
+
- docker/containers/database/production.env
|
13
|
+
|
14
|
+
web:
|
15
|
+
build:
|
16
|
+
context: .
|
17
|
+
dockerfile: docker/containers/web/Dockerfile
|
18
|
+
env_file:
|
19
|
+
- docker/containers/web/development.env
|
@@ -0,0 +1,26 @@
|
|
1
|
+
version: '3.1'
|
2
|
+
|
3
|
+
services:
|
4
|
+
|
5
|
+
database:
|
6
|
+
env_file:
|
7
|
+
- docker/containers/database/production.env
|
8
|
+
|
9
|
+
app:
|
10
|
+
image: "${DOCKERHUB_ORG}/${APP_NAME}_app:${DEPLOY_TAG}"
|
11
|
+
env_file:
|
12
|
+
- docker/containers/app/production.env
|
13
|
+
- docker/containers/database/production.env
|
14
|
+
expose:
|
15
|
+
- '3000'
|
16
|
+
|
17
|
+
web:
|
18
|
+
image: <%= config[:dockerhub_org] %>/<%= config[:app_name] %>_web:${DEPLOY_TAG}
|
19
|
+
depends_on:
|
20
|
+
- app
|
21
|
+
ports:
|
22
|
+
- "80:80"
|
23
|
+
|
24
|
+
chrome:
|
25
|
+
command: echo "Chrome service not started in production"
|
26
|
+
restart: "no"
|
@@ -0,0 +1,20 @@
|
|
1
|
+
FROM nginx
|
2
|
+
|
3
|
+
RUN apt-get update -qq && apt-get -y install apache2-utils
|
4
|
+
|
5
|
+
ENV RAILS_ROOT /usr/src/app
|
6
|
+
|
7
|
+
WORKDIR $RAILS_ROOT
|
8
|
+
|
9
|
+
RUN mkdir log
|
10
|
+
|
11
|
+
COPY public public/
|
12
|
+
|
13
|
+
# Copy Nginx config template
|
14
|
+
COPY docker/web/app.conf /tmp/docker_example.nginx
|
15
|
+
|
16
|
+
# substitute variable references in the Nginx config template for real values from the environment
|
17
|
+
|
18
|
+
# put the final config in its place
|
19
|
+
|
20
|
+
RUN envsubst '$RAILS_ROOT' < /tmp/docker_example.nginx > /etc/nginx/conf.d/default.conf
|
@@ -0,0 +1,23 @@
|
|
1
|
+
upstream puma_rails_app {
|
2
|
+
server app:3000;
|
3
|
+
}
|
4
|
+
server {
|
5
|
+
listen 80;
|
6
|
+
proxy_buffers 64 16k;
|
7
|
+
proxy_max_temp_file_size 1024m;
|
8
|
+
proxy_connect_timeout 5s;
|
9
|
+
proxy_send_timeout 10s;
|
10
|
+
proxy_read_timeout 10s;
|
11
|
+
location / {
|
12
|
+
try_files $uri $uri/ @rails_app;
|
13
|
+
}
|
14
|
+
location @rails_app {
|
15
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
16
|
+
proxy_set_header Host $http_host;
|
17
|
+
proxy_redirect off;
|
18
|
+
proxy_pass http://puma_rails_app;
|
19
|
+
# limit_req zone=one;
|
20
|
+
access_log /usr/src/app/log/nginx.access.log;
|
21
|
+
error_log /usr/src/app/log/nginx.error.log;
|
22
|
+
}
|
23
|
+
}
|
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.
|
4
|
+
version: 0.1.38
|
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
|
+
date: 2018-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sshkit
|
@@ -138,6 +138,8 @@ files:
|
|
138
138
|
- lib/handsome_fencer/circle_c_i/templates/circleci/Rakefile
|
139
139
|
- lib/handsome_fencer/circle_c_i/templates/circleci/config.job-example.yml
|
140
140
|
- lib/handsome_fencer/circle_c_i/templates/circleci/config.yml
|
141
|
+
- lib/handsome_fencer/circle_c_i/templates/circleci/config.yml.workflow-example
|
142
|
+
- lib/handsome_fencer/circle_c_i/templates/circleci/deploy.rake
|
141
143
|
- lib/handsome_fencer/circle_c_i/templates/config.job-example.yml
|
142
144
|
- lib/handsome_fencer/circle_c_i/templates/config.yml
|
143
145
|
- lib/handsome_fencer/circle_c_i/templates/config/database.yml
|
@@ -149,10 +151,20 @@ files:
|
|
149
151
|
- lib/handsome_fencer/circle_c_i/templates/docker/containers/database/production.env
|
150
152
|
- lib/handsome_fencer/circle_c_i/templates/docker/containers/web/Dockerfile
|
151
153
|
- lib/handsome_fencer/circle_c_i/templates/docker/containers/web/app.conf
|
154
|
+
- lib/handsome_fencer/circle_c_i/templates/docker/containers/web/development.env
|
152
155
|
- lib/handsome_fencer/circle_c_i/templates/docker/containers/web/production.env
|
153
156
|
- lib/handsome_fencer/circle_c_i/templates/docker/env_files/circleci.env
|
157
|
+
- lib/handsome_fencer/circle_c_i/templates/docker/env_files/circleci.env.enc
|
158
|
+
- lib/handsome_fencer/circle_c_i/templates/docker/env_files/production.env
|
159
|
+
- lib/handsome_fencer/circle_c_i/templates/docker/env_files/production.env.enc
|
160
|
+
- lib/handsome_fencer/circle_c_i/templates/docker/keys/circleci.key
|
161
|
+
- lib/handsome_fencer/circle_c_i/templates/docker/keys/development.key
|
154
162
|
- lib/handsome_fencer/circle_c_i/templates/docker/keys/production.key
|
163
|
+
- lib/handsome_fencer/circle_c_i/templates/docker/overrides/docker-compose.circleci.yml
|
164
|
+
- lib/handsome_fencer/circle_c_i/templates/docker/overrides/docker-compose.production.yml
|
155
165
|
- lib/handsome_fencer/circle_c_i/templates/docker/overrides/production.docker-compose.yml
|
166
|
+
- lib/handsome_fencer/circle_c_i/templates/docker/web/Dockerfile
|
167
|
+
- lib/handsome_fencer/circle_c_i/templates/docker/web/app.conf
|
156
168
|
- lib/handsome_fencer/circle_c_i/templates/gitignore
|
157
169
|
- lib/handsome_fencer/circle_c_i/templates/lib/tasks/deploy.rake
|
158
170
|
- lib/handsome_fencer/circle_c_i/version.rb
|