rails_dokku 0.1.0
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/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +33 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/rails_dokku.rb +5 -0
- data/lib/rails_dokku/version.rb +3 -0
- data/lib/tasks/dokku.rake +94 -0
- data/rails_dokku.gemspec +25 -0
- metadata +99 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e743e732b62bf038fbaa2271a64ad379422ebd91
|
4
|
+
data.tar.gz: ef2f699c7bfd55fcc01ebe6c868fe5d8338f8b48
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c46358a969e9a708cbfdb6c2a91fdc428175fe07efcbfe6bfcae3df36be0cd04f307ef316ee0d91c51da8d30f7670955168b78a78404bd2687dacd3e31ccbb35
|
7
|
+
data.tar.gz: 78349aad3b7fdcbc73d218e52fa6545aef412b8ff3ede86f56962dbcad7ef0d134fdbcb671f3cf8225d50c5a60d2714f8ecedc14d2a09ed690baa0180c28573b
|
data/.gitignore
ADDED
data/.rspec
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 Alexandr Bobrov
|
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,33 @@
|
|
1
|
+
# RailsDokku
|
2
|
+
|
3
|
+
Rails dokku is tasks collection for (dokku)[https://github.com/dokku/dokku]
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'rails_dokku'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ rake -T
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install rails_dokku
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Please look at rake -T.
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
|
27
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/itbeaver/rails_dokku. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
28
|
+
|
29
|
+
|
30
|
+
## License
|
31
|
+
|
32
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
33
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "rails_dokku"
|
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/setup
ADDED
data/lib/rails_dokku.rb
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
namespace :dokku do
|
2
|
+
@app_name_stage = '' # default
|
3
|
+
@app_domain_stage = '' # default
|
4
|
+
@app_name_production = ''
|
5
|
+
@app_domain_production = ''
|
6
|
+
|
7
|
+
if Rails.env.production?
|
8
|
+
@app_name = @app_name_production
|
9
|
+
@app_domain = @app_domain_production
|
10
|
+
else
|
11
|
+
@app_name = @app_name_stage
|
12
|
+
@app_domain = @app_domain_stage
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'Dokku migrate'
|
16
|
+
task :migrate do
|
17
|
+
run_in_dokku "run #{@app_name} rake db:migrate"
|
18
|
+
end
|
19
|
+
|
20
|
+
desc 'Dokku logs'
|
21
|
+
task :logs do
|
22
|
+
run_in_dokku "logs #{@app_name}"
|
23
|
+
end
|
24
|
+
|
25
|
+
desc 'Install plugins'
|
26
|
+
task :install_plugins do
|
27
|
+
run_in_dokku_as_root 'dokku plugin:install https://github.com/dokku/dokku-postgres.git postgres'
|
28
|
+
end
|
29
|
+
|
30
|
+
desc 'Create app and PG databse'
|
31
|
+
task :setup do
|
32
|
+
run_in_dokku "apps:create #{@app_name}"
|
33
|
+
run_in_dokku "postgres:create #{@app_name}"
|
34
|
+
run_in_dokku "postgres:link #{@app_name} #{@app_name}"
|
35
|
+
end
|
36
|
+
|
37
|
+
desc 'Deploy'
|
38
|
+
task :deploy do
|
39
|
+
if Rails.env.production?
|
40
|
+
system 'git push production master'
|
41
|
+
else
|
42
|
+
system 'git push stage master'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
desc 'Add remote to git'
|
47
|
+
task :git_add do
|
48
|
+
if Rails.env.production?
|
49
|
+
system "git remote add production dokku@#{@app_domain}:#{@app_name}"
|
50
|
+
else
|
51
|
+
system "git remote add stage dokku@#{@app_domain}:#{@app_name}"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
desc 'Databse from production to stage'
|
56
|
+
task :pg_db_push_to_stage do
|
57
|
+
name = @app_name_production + Time.now.strftime("%F-%H%M") + '.dump'
|
58
|
+
system "ssh -t root@#{@app_domain_production} dokku postgres:export #{@app_name_production} > #{name}"
|
59
|
+
system "ssh -t root@#{@app_domain_stage} dokku postgres:import #{@app_name_stage} < #{args[:arg1]}"
|
60
|
+
end
|
61
|
+
|
62
|
+
desc 'Get database to local'
|
63
|
+
task :export_pg do
|
64
|
+
name = @app_name + Time.now.strftime("%F-%H%M") + '.dump'
|
65
|
+
run_in_dokku_as_root "dokku postgres:export #{@app_name} > #{name}"
|
66
|
+
end
|
67
|
+
|
68
|
+
desc 'Push database to server'
|
69
|
+
task :import_pg, [:arg1] do |t, args|
|
70
|
+
run_in_dokku_as_root "dokku postgres:import #{@app_name} < #{args[:arg1]}"
|
71
|
+
end
|
72
|
+
|
73
|
+
desc 'show config without params or add config: rake dokku:config[PARAM=PARAM]'
|
74
|
+
task :config, [:arg1] do |t, args|
|
75
|
+
if args[:arg1].blank?
|
76
|
+
run_in_dokku "config #{@app_name}"
|
77
|
+
else
|
78
|
+
run_in_dokku "config:set #{@app_name} #{args[:arg1]}"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
desc 'add credentials to dokku'
|
83
|
+
task :add_credentials do
|
84
|
+
run_in_dokku_as_root 'cat /root/.ssh/authorized_keys | sshcommand acl-add dokku dokku'
|
85
|
+
end
|
86
|
+
|
87
|
+
def run_in_dokku_as_root(command = 'logs')
|
88
|
+
system "ssh -t root@#{@app_domain} " + command
|
89
|
+
end
|
90
|
+
|
91
|
+
def run_in_dokku(command = 'logs')
|
92
|
+
system "ssh -t dokku@#{@app_domain} " + command
|
93
|
+
end
|
94
|
+
end
|
data/rails_dokku.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rails_dokku/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'rails_dokku'
|
8
|
+
spec.version = RailsDokku::VERSION
|
9
|
+
spec.authors = ['Alexandr Bobrov']
|
10
|
+
spec.email = ["al.bobrov@itbeaver.co"]
|
11
|
+
|
12
|
+
spec.summary = %q{Rake tasks for dokku.}
|
13
|
+
spec.description = %q{Rake tasks for dokku.}
|
14
|
+
spec.homepage = "https://github.com/itbeaver/rails_dokku"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails_dokku
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alexandr Bobrov
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-01 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.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
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: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
description: Rake tasks for dokku.
|
56
|
+
email:
|
57
|
+
- al.bobrov@itbeaver.co
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".travis.yml"
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- bin/console
|
70
|
+
- bin/setup
|
71
|
+
- lib/rails_dokku.rb
|
72
|
+
- lib/rails_dokku/version.rb
|
73
|
+
- lib/tasks/dokku.rake
|
74
|
+
- rails_dokku.gemspec
|
75
|
+
homepage: https://github.com/itbeaver/rails_dokku
|
76
|
+
licenses:
|
77
|
+
- MIT
|
78
|
+
metadata: {}
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options: []
|
81
|
+
require_paths:
|
82
|
+
- lib
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
requirements: []
|
94
|
+
rubyforge_project:
|
95
|
+
rubygems_version: 2.4.5.1
|
96
|
+
signing_key:
|
97
|
+
specification_version: 4
|
98
|
+
summary: Rake tasks for dokku.
|
99
|
+
test_files: []
|