capistrano-teller 0.1.0 → 0.2.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 +4 -4
- data/README.md +34 -10
- data/lib/capistrano/teller/capistrano/tasks/teller.rake +2 -5
- data/lib/capistrano/teller/version.rb +1 -1
- data/lib/capistrano/teller.rb +4 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae704f6188f3a40cc6b873f99217152b4b882fd2c7bea412ab46ae0f082dbd6c
|
4
|
+
data.tar.gz: c58692379d8070192bbf55d429d2335d3f154b7909546e08de17c4d7d3b5eaf5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95c4ff7e40c83c0f195f7047682f2c5543d0fda6afd890002606474cbe5ac28e52fd323c946099a9caa79c5ce7d24d60b78320631c1bc5a5b9bc10fdf20a23f3
|
7
|
+
data.tar.gz: cffe4244a22d48eb7615ea14ca7591492814781dc82e62c6299325a8f58d81224ae74c0d732da6a1e36187f4b51eea5d3c318efcb74c4d95db6372c2975371d0
|
data/README.md
CHANGED
@@ -1,24 +1,48 @@
|
|
1
1
|
# Capistrano::Teller
|
2
2
|
|
3
|
-
|
3
|
+
## Installation
|
4
4
|
|
5
|
-
|
5
|
+
```
|
6
|
+
bundle add capistrano-teller
|
7
|
+
```
|
6
8
|
|
7
|
-
|
9
|
+
**Add .teller.yml**
|
10
|
+
```
|
11
|
+
providers:
|
12
|
+
aws_secretsmanager:
|
13
|
+
kind: aws_secretsmanager
|
14
|
+
maps:
|
15
|
+
- id: aws
|
16
|
+
path: {{ get_env(name="RAILS_ENV", default="development") }}/{{get_env(name="NORMALIZED_REPO", default='application')}}/environment
|
17
|
+
dotenv:
|
18
|
+
kind: dotenv
|
19
|
+
maps:
|
20
|
+
- id: 'dotenv'
|
21
|
+
path: .env.{{ get_env(name="RAILS_ENV", default="development") }}
|
22
|
+
```
|
8
23
|
|
9
|
-
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
10
24
|
|
11
|
-
Install the gem and add to the application's Gemfile by executing:
|
12
25
|
|
13
|
-
|
26
|
+
## Usage
|
14
27
|
|
15
|
-
|
28
|
+
deploy.rb
|
29
|
+
```
|
30
|
+
set :rails_env, -> { fetch(:stage) }
|
16
31
|
|
17
|
-
|
32
|
+
set :teller_config, -> { File.join(Dir.pwd, '.teller.yml')}
|
33
|
+
set :teller_environment, -> { fetch(:rails_env) }
|
34
|
+
set :teller_source_provider, 'aws_secretsmanager/aws'
|
35
|
+
set :teller_target_provider, 'dotenv/dotenv'
|
36
|
+
set :teller_identifier, -> { fetch(:application) }
|
18
37
|
|
19
|
-
|
38
|
+
server 'i-404004040b', roles: [:whenever, :app, :web, :teller]
|
39
|
+
```
|
40
|
+
|
41
|
+
```
|
42
|
+
cap staging deploy
|
43
|
+
```
|
20
44
|
|
21
|
-
|
45
|
+
Will generate `.env.#{:rails_env}` locally and copy it to the `shared_path` and link to the `current_release`
|
22
46
|
|
23
47
|
## Development
|
24
48
|
|
@@ -2,14 +2,13 @@
|
|
2
2
|
namespace :teller do
|
3
3
|
|
4
4
|
def teller(*args)
|
5
|
-
puts "Executing: #{fetch(:teller_command)}"
|
6
5
|
execute fetch(:teller_command), *args
|
7
6
|
end
|
8
7
|
|
9
8
|
desc "Copy the .env.environment to the server"
|
10
9
|
task :copy do
|
11
10
|
run_locally do
|
12
|
-
with
|
11
|
+
with(rails_env: fetch(:teller_environment), normalized_repo: fetch(:teller_identifier) )do
|
13
12
|
execute :touch, ".env.#{fetch(:teller_environment)}"
|
14
13
|
teller "--config #{fetch(:teller_config)}", :copy, "--from #{fetch(:teller_source_provider)}", "--to #{fetch(:teller_target_provider)}"
|
15
14
|
end
|
@@ -18,12 +17,9 @@ namespace :teller do
|
|
18
17
|
|
19
18
|
task :upload_environment_file do
|
20
19
|
on roles(:teller) do
|
21
|
-
puts "Uploading .env.#{fetch(:teller_environment)} to #{fetch(:teller_shared_path)}/config/teller.yml"
|
22
20
|
upload! ".env.#{fetch(:teller_environment)}", "#{fetch(:teller_shared_path)}/config/teller.yml"
|
23
21
|
end
|
24
22
|
|
25
|
-
puts "#{fetch(:linked_files)}"
|
26
|
-
|
27
23
|
run_locally do
|
28
24
|
execute :rm, ".env.#{fetch(:teller_environment)}"
|
29
25
|
end
|
@@ -45,6 +41,7 @@ namespace :load do
|
|
45
41
|
set :teller_command, ->{ fetch(:teller_command_path).chomp }
|
46
42
|
set :teller_environment, ->{ fetch :rails_env, fetch(:stage, "production") }
|
47
43
|
set :teller_shared_path, ->{ fetch(:shared_path) }
|
44
|
+
set :teller_identifier, ->{ fetch(:application) }
|
48
45
|
append :linked_files, ".env.#{fetch(:teller_environment)}"
|
49
46
|
end
|
50
47
|
end
|
data/lib/capistrano/teller.rb
CHANGED
@@ -1,18 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
2
|
require "zeitwerk"
|
4
|
-
loader = Zeitwerk::Loader.for_gem_extension(Capistrano::Teller)
|
5
|
-
loader.setup # ready!
|
6
3
|
|
7
4
|
module Capistrano
|
8
5
|
module Teller
|
9
6
|
class Error < StandardError; end
|
10
|
-
|
11
|
-
|
12
7
|
end
|
13
8
|
end
|
14
9
|
|
15
10
|
|
11
|
+
loader = Zeitwerk::Loader.for_gem_extension(Capistrano::Teller)
|
12
|
+
loader.setup # ready!
|
13
|
+
|
14
|
+
|
16
15
|
if defined?(Capistrano::VERSION) && Gem::Version.new(Capistrano::VERSION).release >= Gem::Version.new('3.0.0')
|
17
16
|
load File.expand_path("../teller/capistrano/tasks/teller.rake", __FILE__)
|
18
17
|
end
|