docker_houston 0.0.1
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 +7 -0
- data/.DS_Store +0 -0
- data/.gitignore +9 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/docker +9 -0
- data/bin/setup +7 -0
- data/docker_houston.gemspec +31 -0
- data/lib/docker_houston.rb +6 -0
- data/lib/docker_houston/capistrano.rb +128 -0
- data/lib/docker_houston/railtie.rb +7 -0
- data/lib/docker_houston/version.rb +3 -0
- data/lib/generators/.DS_Store +0 -0
- data/lib/generators/docker_houston/install_generator.rb +51 -0
- data/lib/generators/templates/Capfile +4 -0
- data/lib/generators/templates/Dockerfile.erb +53 -0
- data/lib/generators/templates/database.yml.docker.erb +19 -0
- data/lib/generators/templates/deploy.rb.erb +70 -0
- data/lib/generators/templates/docker-compose.yml.erb +26 -0
- data/lib/generators/templates/secrets.yml +27 -0
- data/lib/generators/templates/staging.rb.erb +10 -0
- data/lib/generators/templates/unicorn.rb +13 -0
- metadata +127 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 2c453de7f3462e9d8b9477e640b2c9ee2097cc4f
|
|
4
|
+
data.tar.gz: 7d73186faf8f39adc7d36e7cee35ba8474c59d5e
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 38174ba1e87347f810d518f42f6914c6f7488b0630c2919f316a1981c187b06a9a5e541351f987d7b5dacc8940d1187f89c98570d3ee3c936b67df81da56ba37
|
|
7
|
+
data.tar.gz: 203b9d388ccb7c4ec55849853df43617441889c8b029c4bf87fdff5e507e54e4e5417f31ea455e38ca1fb355622a1490914350a85382b12f32aa90412e357e7f
|
data/.DS_Store
ADDED
|
Binary file
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 alex-zige
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# DockerHouston
|
|
2
|
+
|
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/docker_houston`. To experiment with that code, run `bin/console` for an interactive prompt.
|
|
4
|
+
|
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Add this line to your application's Gemfile:
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
gem 'docker_houston'
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
And then execute:
|
|
16
|
+
|
|
17
|
+
$ bundle
|
|
18
|
+
|
|
19
|
+
Or install it yourself as:
|
|
20
|
+
|
|
21
|
+
$ gem install docker_houston
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
TODO: Write usage instructions here
|
|
26
|
+
|
|
27
|
+
## Development
|
|
28
|
+
|
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake false` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
30
|
+
|
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
32
|
+
|
|
33
|
+
## Contributing
|
|
34
|
+
|
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/docker_houston. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## License
|
|
39
|
+
|
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
|
41
|
+
|
data/Rakefile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "docker_houston"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start
|
data/bin/docker
ADDED
data/bin/setup
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'docker_houston/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "docker_houston"
|
|
8
|
+
spec.version = DockerHouston::VERSION
|
|
9
|
+
spec.authors = ["alex-zige"]
|
|
10
|
+
spec.email = ["alex.zige@gmail.com"]
|
|
11
|
+
|
|
12
|
+
spec.summary = "Misson Control for docker builds."
|
|
13
|
+
spec.description = "Utilities for deploy docker builds."
|
|
14
|
+
spec.homepage = "http://www.google.com"
|
|
15
|
+
spec.license = "MIT"
|
|
16
|
+
|
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
|
19
|
+
# if spec.respond_to?(:metadata)
|
|
20
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
|
21
|
+
# else
|
|
22
|
+
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
|
23
|
+
# end
|
|
24
|
+
|
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
26
|
+
spec.require_paths = ["lib","bin","tasks"]
|
|
27
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
|
28
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
29
|
+
spec.add_dependency "rails"
|
|
30
|
+
spec.add_dependency 'capistrano', '~> 3.1'
|
|
31
|
+
end
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
begin
|
|
2
|
+
fetch(:repository)
|
|
3
|
+
fetch(:application)
|
|
4
|
+
rescue IndexError => e
|
|
5
|
+
puts "#{e.message} (ensure :application and :repository are set in deploy.rb)"
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
set :app_with_stage, ->{"#{fetch(:app_name)}"}
|
|
9
|
+
|
|
10
|
+
set :repo_url, ->{ fetch(:repository) } unless fetch(:repo_url)
|
|
11
|
+
|
|
12
|
+
set :release_dir, ->{Pathname.new("/home/deploy/dockerised_apps/#{fetch(:app_with_stage)}/current")}
|
|
13
|
+
|
|
14
|
+
set :shared_dir, ->{Pathname.new("/home/deploy/dockerised_apps/#{fetch(:app_with_stage)}/shared")}
|
|
15
|
+
|
|
16
|
+
set :log_dir, -> {Pathname.new("/home/deploy/dockerised_apps/logs/#{fetch(:app_with_stage)}")}
|
|
17
|
+
|
|
18
|
+
set :app_dir, ->{fetch(:release_dir).to_s.chomp('/current')}
|
|
19
|
+
|
|
20
|
+
def exec_on_remote(command, message="Executing command on remote...", container_id='web')
|
|
21
|
+
on roles :app do |server|
|
|
22
|
+
ssh_cmd = "ssh -A -t #{server.user}@#{server.hostname}"
|
|
23
|
+
puts "Executing remote command..."
|
|
24
|
+
exec "#{ssh_cmd} 'cd #{fetch(:release_dir)} && docker-compose -p #{fetch(:app_with_stage)} run web #{command}'"
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
desc 'Run a rails console on remote'
|
|
29
|
+
task :console do
|
|
30
|
+
exec_on_remote("bundle exec rails c", "Running console on remote...")
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
desc 'Run a bash terminal on remote'
|
|
34
|
+
task :bash do
|
|
35
|
+
exec_on_remote("bash", "Running bash terminal on remote...")
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
namespace :docker do
|
|
39
|
+
desc "deploy a git tag to a docker container"
|
|
40
|
+
task :lift_off do
|
|
41
|
+
on roles :app do
|
|
42
|
+
invoke 'deploy'
|
|
43
|
+
invoke 'docker:setup_db'
|
|
44
|
+
invoke 'docker:build_container'
|
|
45
|
+
invoke 'docker:stop'
|
|
46
|
+
invoke 'docker:start'
|
|
47
|
+
invoke 'docker:notify'
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
desc 'relink docker databse'
|
|
52
|
+
task :setup_db do
|
|
53
|
+
on roles :app do
|
|
54
|
+
docker_db = "#{fetch(:release_dir)}/config/database.yml.docker"
|
|
55
|
+
if test "[ -f #{docker_db} ]"
|
|
56
|
+
execute :cp, "#{docker_db} #{docker_db.chomp('.docker')}"
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
desc "build container"
|
|
62
|
+
task :build_container do
|
|
63
|
+
on roles :app do
|
|
64
|
+
within fetch(:release_dir) do
|
|
65
|
+
execute "cd #{fetch(:release_dir)} && docker-compose -p #{fetch(:app_with_stage)} build web"
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
desc "precompile assets"
|
|
71
|
+
task :precompile_assets do
|
|
72
|
+
on roles :app do
|
|
73
|
+
within fetch(:release_dir) do
|
|
74
|
+
execute :echo, "precompiling assets..."
|
|
75
|
+
execute "docker-compose -p #{fetch(:app_with_stage)} run web bundle exec rake assets:precompile"
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
desc "start web service"
|
|
81
|
+
task :start do
|
|
82
|
+
on roles :app do
|
|
83
|
+
within fetch(:release_dir) do
|
|
84
|
+
execute "cd #{fetch(:release_dir)} && docker-compose -p #{fetch(:app_with_stage)} up -d"
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
desc "stop service"
|
|
90
|
+
task :stop do
|
|
91
|
+
on roles :app do
|
|
92
|
+
within fetch(:release_dir) do
|
|
93
|
+
execute "cd #{fetch(:release_dir)} && docker-compose -p #{fetch(:app_with_stage)} kill" # kill the running containers
|
|
94
|
+
execute "cd #{fetch(:release_dir)} && docker-compose -p #{fetch(:app_with_stage)} rm --force"
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
desc 'Run a bash console attached to the running docker application'
|
|
100
|
+
task :bash do
|
|
101
|
+
invoke 'bash'
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
desc 'Run a console attached to the running docker application'
|
|
105
|
+
task :console do
|
|
106
|
+
invoke 'console'
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
desc 'Run seed_fu against remote url'
|
|
110
|
+
task :seed_fu do
|
|
111
|
+
exec_on_remote("rake db:seed_fu", "Seeding database on remote...")
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
desc "Tail logs from remote dockerised app"
|
|
115
|
+
task :logs do
|
|
116
|
+
execute "cd #{fetch(:log_dir)} && tail -f staging.log"
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
desc 'Notify Third party IM'
|
|
120
|
+
task :notify do
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
desc 'Drop reseed the database'
|
|
124
|
+
task :reseed do
|
|
125
|
+
exec_on_remote("rake db:reset && rake db:seed_fu", "Reseeding database on remote...")
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
end
|
|
Binary file
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
require 'rails/generators/base'
|
|
2
|
+
require 'securerandom'
|
|
3
|
+
|
|
4
|
+
module DockerHouston
|
|
5
|
+
module Generators
|
|
6
|
+
class InstallGenerator < Rails::Generators::Base
|
|
7
|
+
|
|
8
|
+
argument :app_name, type: :string, default: Rails.application.class.parent_name.downcase
|
|
9
|
+
|
|
10
|
+
source_root File.expand_path("../../templates", __FILE__)
|
|
11
|
+
desc "Creates a docker configuration template files to your application."
|
|
12
|
+
|
|
13
|
+
def copy_dockerfile
|
|
14
|
+
copy_file "Dockerfile.erb", "Dockerfile"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def copy_docker_compse
|
|
18
|
+
template "docker-compose.yml.erb", "docker-compose.yml"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def copy_secret
|
|
22
|
+
copy_file "secrets.yml", "config/secrets.yml"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def copy_unicorn
|
|
26
|
+
copy_file "unicorn.rb", "config/unicorn.rb"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def copy_capistrano_staging
|
|
30
|
+
template 'staging.rb.erb', "config/deploy/staging.rb"
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def copy_capistrano_deploy
|
|
34
|
+
template 'deploy.rb.erb', "config/deploy.rb"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def copy_capistrano_file
|
|
38
|
+
copy_file 'Capfile', "Capfile"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def copy_executable
|
|
42
|
+
copy_file "../../../bin/docker", "bin/docker"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def rails_4?
|
|
46
|
+
Rails::VERSION::MAJOR == 4
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
FROM ruby:2.3.0
|
|
2
|
+
|
|
3
|
+
RUN apt-get update -y
|
|
4
|
+
|
|
5
|
+
RUN apt-get install -y wget curl \
|
|
6
|
+
build-essential git git-core \
|
|
7
|
+
zlib1g-dev libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev
|
|
8
|
+
|
|
9
|
+
RUN apt-get install -y software-properties-common
|
|
10
|
+
|
|
11
|
+
RUN apt-get dist-upgrade -y
|
|
12
|
+
|
|
13
|
+
# Add options to gemrc
|
|
14
|
+
RUN echo "gem: --no-document" > ~/.gemrc
|
|
15
|
+
|
|
16
|
+
RUN gem install bundler
|
|
17
|
+
|
|
18
|
+
ENV BUNDLE_GEMFILE=/app/Gemfile
|
|
19
|
+
ENV BUNDLE_JOBS=2
|
|
20
|
+
ENV BUNDLE_PATH=/bundle
|
|
21
|
+
ENV BUNDLE_WITHOUT=development:test
|
|
22
|
+
|
|
23
|
+
WORKDIR /tmp
|
|
24
|
+
|
|
25
|
+
RUN mkdir /app
|
|
26
|
+
|
|
27
|
+
RUN mkdir /app/.bundle
|
|
28
|
+
RUN echo 'BUNDLE_WITHOUT: development:test' > /app/.bundle/config
|
|
29
|
+
|
|
30
|
+
RUN gem install backup -v 4.2.2 --no-ri --no-rdoc
|
|
31
|
+
RUN mkdir /backups
|
|
32
|
+
|
|
33
|
+
RUN rm /etc/default/rcS && touch /etc/default/rcS
|
|
34
|
+
RUN echo "UTC=no" >> /etc/default/rcS
|
|
35
|
+
RUN cp /etc/localtime /etc/localtime.bkp
|
|
36
|
+
RUN rm /etc/localtime
|
|
37
|
+
RUN ln -s /usr/share/zoneinfo/Pacific/Auckland /etc/localtime
|
|
38
|
+
|
|
39
|
+
# RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main' >> /etc/apt/sources.list
|
|
40
|
+
# RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
|
|
41
|
+
# RUN apt-get update
|
|
42
|
+
# RUN apt-get install -y postgresql-9.4
|
|
43
|
+
# RUN apt-get remove -y postgresql-client-9.3
|
|
44
|
+
# COPY . /app
|
|
45
|
+
|
|
46
|
+
WORKDIR /app
|
|
47
|
+
ADD Gemfile /app/Gemfile
|
|
48
|
+
ADD Gemfile.lock /app/Gemfile.lock
|
|
49
|
+
RUN bundle install
|
|
50
|
+
ADD . /app
|
|
51
|
+
|
|
52
|
+
RUN mkdir -p log
|
|
53
|
+
RUN touch log/cron.stdout.log && touch log/cron.stderr.log
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
default: &default
|
|
2
|
+
adapter: postgresql
|
|
3
|
+
encoding: unicode
|
|
4
|
+
username: docker
|
|
5
|
+
password: docker
|
|
6
|
+
pool: 5
|
|
7
|
+
host: postgresql
|
|
8
|
+
|
|
9
|
+
development:
|
|
10
|
+
<<: *default
|
|
11
|
+
database: <%= app_name %>_dev
|
|
12
|
+
|
|
13
|
+
staging:
|
|
14
|
+
<<: *default
|
|
15
|
+
database: <%= app_name %>_staging
|
|
16
|
+
|
|
17
|
+
test:
|
|
18
|
+
<<: *default
|
|
19
|
+
database: <%= app_name %>_test
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# config valid only for current version of Capistrano
|
|
2
|
+
lock '3.4.0'
|
|
3
|
+
|
|
4
|
+
set :branch, fetch(:branch, 'master')
|
|
5
|
+
set :application, "<%= app_name %>"
|
|
6
|
+
set :repository, "<%= `git ls-remote --get-url` %>"
|
|
7
|
+
set :default_stage, "staging"
|
|
8
|
+
|
|
9
|
+
set :scm, "git"
|
|
10
|
+
set :scm_verbose, false
|
|
11
|
+
|
|
12
|
+
set :repo_url, fetch(:repository)
|
|
13
|
+
set :user, 'deploy'
|
|
14
|
+
|
|
15
|
+
set :deploy_via, :remote_cache
|
|
16
|
+
set :pty, true
|
|
17
|
+
|
|
18
|
+
set :ssh_options, { forward_agent: true }
|
|
19
|
+
|
|
20
|
+
require 'docker_houston/capistrano'
|
|
21
|
+
|
|
22
|
+
set :working_dir, "/home/deploy/dockerised_apps/<%= app_name%>"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# set :rollbar_token, ENV['ROLLBAR_TOKEN']
|
|
26
|
+
# set :rollbar_env, Proc.new { fetch(:stage) }
|
|
27
|
+
# set :rollbar_role, Proc.new{ :app }
|
|
28
|
+
# set :linked_files, fetch(:linked_files, []).push('config/database.yml', '.env')
|
|
29
|
+
|
|
30
|
+
# Default branch is :master
|
|
31
|
+
# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp
|
|
32
|
+
|
|
33
|
+
# Default deploy_to directory is /var/www/my_app_name
|
|
34
|
+
# set :deploy_to, '/var/www/my_app_name'
|
|
35
|
+
|
|
36
|
+
# Default value for :scm is :git
|
|
37
|
+
# set :scm, :git
|
|
38
|
+
|
|
39
|
+
# Default value for :format is :pretty
|
|
40
|
+
# set :format, :pretty
|
|
41
|
+
|
|
42
|
+
# Default value for :log_level is :debug
|
|
43
|
+
# set :log_level, :debug
|
|
44
|
+
|
|
45
|
+
# Default value for :pty is false
|
|
46
|
+
# set :pty, true
|
|
47
|
+
|
|
48
|
+
# Default value for :linked_files is []
|
|
49
|
+
# set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml')
|
|
50
|
+
|
|
51
|
+
# Default value for linked_dirs is []
|
|
52
|
+
# set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system')
|
|
53
|
+
|
|
54
|
+
# Default value for default_env is {}
|
|
55
|
+
# set :default_env, { path: "/opt/ruby/bin:$PATH" }
|
|
56
|
+
|
|
57
|
+
# Default value for keep_releases is 5
|
|
58
|
+
# set :keep_releases, 5
|
|
59
|
+
|
|
60
|
+
namespace :deploy do
|
|
61
|
+
after :restart, :clear_cache do
|
|
62
|
+
on roles(:web), in: :groups, limit: 3, wait: 10 do
|
|
63
|
+
# Here we can do anything such as:
|
|
64
|
+
# within release_path do
|
|
65
|
+
# execute :rake, 'cache:clear'
|
|
66
|
+
# end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
postgresql:
|
|
2
|
+
image: postgres
|
|
3
|
+
ports:
|
|
4
|
+
- 5432
|
|
5
|
+
volumes:
|
|
6
|
+
- /home/deploy/db/data:/var/lib/postgresql/data
|
|
7
|
+
environment: &postgres
|
|
8
|
+
POSTGRES_USER: docker
|
|
9
|
+
POSTGRES_PASSWORD: docker
|
|
10
|
+
web:
|
|
11
|
+
build: .
|
|
12
|
+
volumes:
|
|
13
|
+
- /home/deploy/dockerised_apps/nginx-proxy/assets/<%= app_name %>.staging.touchtech.co.nz/public:/app/public/
|
|
14
|
+
- /home/deploy/dockerised_apps/logs/<%= app_name %>/:/app/log/
|
|
15
|
+
- /home/deploy/dockerised_apps/logs/<%= app_name %>/unicorn:/var/log/
|
|
16
|
+
ports:
|
|
17
|
+
- "3000"
|
|
18
|
+
links:
|
|
19
|
+
- postgresql
|
|
20
|
+
environment: &web
|
|
21
|
+
RAILS_ENV: staging
|
|
22
|
+
SECRET_KEY_BASE: 43834f4b48946cb62b30130a4577cec2d0a842fcf97095706ccf0de7f293689336c1c0f84a55a26a689ca8ca21edd6da477a9ba9adce48176fe0b23e17f16fd4
|
|
23
|
+
VIRTUAL_HOST: <%= app_name %>.staging.touchtech.co.nz
|
|
24
|
+
<<: *postgres
|
|
25
|
+
# env_file: ../shared/.env
|
|
26
|
+
command: ./bin/docker
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
|
2
|
+
|
|
3
|
+
# Your secret key is used for verifying the integrity of signed cookies.
|
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
|
5
|
+
|
|
6
|
+
# Make sure the secret is at least 30 characters and all random,
|
|
7
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
|
8
|
+
# You can use `rake secret` to generate a secure secret key.
|
|
9
|
+
|
|
10
|
+
# Make sure the secrets in this file are kept private
|
|
11
|
+
# if you're sharing your code publicly.
|
|
12
|
+
|
|
13
|
+
development:
|
|
14
|
+
secret_key_base: 267889dc6defcc3b00b98552b6cbb6b1a60280e790a26bc6b50d2f85c97e386cd1ecdd402c5a6eb603b270d4050bbdc4d9b3cbcd4f2ec01eca363452afdeda0e
|
|
15
|
+
|
|
16
|
+
test:
|
|
17
|
+
secret_key_base: 79bf161809073c0663fa21f78a1b538d32c426ef3ca359abf6e61dd706b85fad5c87d50557de0f69ade4b2211ba3e361f05c33804f8dcf7203b3a5e0903bc144
|
|
18
|
+
|
|
19
|
+
# Do not keep production secrets in the repository,
|
|
20
|
+
# instead read values from the environment.
|
|
21
|
+
staging:
|
|
22
|
+
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
|
23
|
+
|
|
24
|
+
# Do not keep production secrets in the repository,
|
|
25
|
+
# instead read values from the environment.
|
|
26
|
+
production:
|
|
27
|
+
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
role :web, "docker.touchtech.co.nz"
|
|
2
|
+
role :app, "docker.touchtech.co.nz"
|
|
3
|
+
|
|
4
|
+
set :app_name, "<%= @app_name %>"
|
|
5
|
+
|
|
6
|
+
set :rails_env, "staging"
|
|
7
|
+
server 'docker.touchtech.co.nz', user: 'deploy', roles: [:app, :install]
|
|
8
|
+
set :working_dir, "/home/deploy/dockerised_apps/#{fetch(:app_name)}/current"
|
|
9
|
+
set :deploy_to, "#{fetch(:working_dir).chomp('current')}"
|
|
10
|
+
set :release_dir, ->{Pathname.new("/home/deploy/dockerised_apps/#{fetch(:app_name)}/current")}
|
metadata
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: docker_houston
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- alex-zige
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2016-04-11 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.10'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.10'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '10.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rails
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: capistrano
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '3.1'
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '3.1'
|
|
69
|
+
description: Utilities for deploy docker builds.
|
|
70
|
+
email:
|
|
71
|
+
- alex.zige@gmail.com
|
|
72
|
+
executables: []
|
|
73
|
+
extensions: []
|
|
74
|
+
extra_rdoc_files: []
|
|
75
|
+
files:
|
|
76
|
+
- ".DS_Store"
|
|
77
|
+
- ".gitignore"
|
|
78
|
+
- ".travis.yml"
|
|
79
|
+
- Gemfile
|
|
80
|
+
- LICENSE.txt
|
|
81
|
+
- README.md
|
|
82
|
+
- Rakefile
|
|
83
|
+
- bin/console
|
|
84
|
+
- bin/docker
|
|
85
|
+
- bin/setup
|
|
86
|
+
- docker_houston.gemspec
|
|
87
|
+
- lib/docker_houston.rb
|
|
88
|
+
- lib/docker_houston/capistrano.rb
|
|
89
|
+
- lib/docker_houston/railtie.rb
|
|
90
|
+
- lib/docker_houston/version.rb
|
|
91
|
+
- lib/generators/.DS_Store
|
|
92
|
+
- lib/generators/docker_houston/install_generator.rb
|
|
93
|
+
- lib/generators/templates/Capfile
|
|
94
|
+
- lib/generators/templates/Dockerfile.erb
|
|
95
|
+
- lib/generators/templates/database.yml.docker.erb
|
|
96
|
+
- lib/generators/templates/deploy.rb.erb
|
|
97
|
+
- lib/generators/templates/docker-compose.yml.erb
|
|
98
|
+
- lib/generators/templates/secrets.yml
|
|
99
|
+
- lib/generators/templates/staging.rb.erb
|
|
100
|
+
- lib/generators/templates/unicorn.rb
|
|
101
|
+
homepage: http://www.google.com
|
|
102
|
+
licenses:
|
|
103
|
+
- MIT
|
|
104
|
+
metadata: {}
|
|
105
|
+
post_install_message:
|
|
106
|
+
rdoc_options: []
|
|
107
|
+
require_paths:
|
|
108
|
+
- lib
|
|
109
|
+
- bin
|
|
110
|
+
- tasks
|
|
111
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
112
|
+
requirements:
|
|
113
|
+
- - ">="
|
|
114
|
+
- !ruby/object:Gem::Version
|
|
115
|
+
version: '0'
|
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
|
+
requirements:
|
|
118
|
+
- - ">="
|
|
119
|
+
- !ruby/object:Gem::Version
|
|
120
|
+
version: '0'
|
|
121
|
+
requirements: []
|
|
122
|
+
rubyforge_project:
|
|
123
|
+
rubygems_version: 2.5.0
|
|
124
|
+
signing_key:
|
|
125
|
+
specification_version: 4
|
|
126
|
+
summary: Misson Control for docker builds.
|
|
127
|
+
test_files: []
|