deployless 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/dpls +17 -0
- data/lib/deployless/providers/dokku_provider.rb +13 -21
- data/lib/deployless/version.rb +2 -1
- 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: 0e90092e1f7b282631146db071f6f160f6710b9c9d5e0c0e91a2f4d8c213a2af
|
4
|
+
data.tar.gz: 43f10ccfb7c4c22c391a72006f4c7a034b43f0b1716a1c65afa064e72ae0d138
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b630343cce61bb6a67f1429701e22fbaf92df7d73057f268a87eb9186189aabf77e2f1b5fbe00b6e11f9af2864e70cfa4a92e2e50b2992dafad8bfc6f33e8e1e
|
7
|
+
data.tar.gz: acfb13ca4f5040f3a44c776cd9370d42e995b156851230020d9810ae4f58e7eefb0e2c043a209c54b734466fd18f13b7b2a15a561b1eb1e04961a96db3a2398d
|
data/bin/dpls
CHANGED
@@ -39,6 +39,14 @@ when 'init'
|
|
39
39
|
key(:email).ask("Email:", required: true)
|
40
40
|
key(:domain).ask("Domain:", required: true)
|
41
41
|
end
|
42
|
+
|
43
|
+
configuration[environment][:environment_variables] = {
|
44
|
+
secret_key_base: SecureRandom.hex(64),
|
45
|
+
rails_env: environment,
|
46
|
+
rake_env: environment,
|
47
|
+
rails_log_to_stdout: 'enabled',
|
48
|
+
rails_serve_static_files: 'enabled'
|
49
|
+
}
|
42
50
|
end
|
43
51
|
|
44
52
|
TTY::File.create_file('.deployless.yml', configuration.to_yaml)
|
@@ -63,6 +71,15 @@ when 'production', 'staging'
|
|
63
71
|
environment: command.params['command']
|
64
72
|
)
|
65
73
|
provider.configure_environment
|
74
|
+
when 'update-env'
|
75
|
+
config = YAML.load_file('.deployless.yml')
|
76
|
+
raise ArgumentError, "Environment #{command.params['command']} is not configured" if config[command.params['command'].to_sym].nil?
|
77
|
+
|
78
|
+
provider = ::Deployless::Providers::DokkuProvider.new(
|
79
|
+
config: config,
|
80
|
+
environment: command.params['command']
|
81
|
+
)
|
82
|
+
provider.update_environment_variables
|
66
83
|
else
|
67
84
|
puts 'Unknown task'
|
68
85
|
end
|
@@ -14,6 +14,7 @@ module Deployless
|
|
14
14
|
def initialize(config:, environment:)
|
15
15
|
@config = config
|
16
16
|
@environment = environment
|
17
|
+
configure
|
17
18
|
end
|
18
19
|
|
19
20
|
def run_console
|
@@ -24,11 +25,10 @@ module Deployless
|
|
24
25
|
end
|
25
26
|
|
26
27
|
def configure_environment
|
27
|
-
configure
|
28
28
|
install
|
29
29
|
add_ssh_key
|
30
30
|
create_app
|
31
|
-
|
31
|
+
update_environment_variables
|
32
32
|
install_postgres
|
33
33
|
install_redis if @config.fetch(:background_job_processor) == 'Sidekiq'
|
34
34
|
|
@@ -47,6 +47,15 @@ module Deployless
|
|
47
47
|
print_instructions
|
48
48
|
end
|
49
49
|
|
50
|
+
def update_environment_variables
|
51
|
+
environment_variables = env_config.fetch(:environment_variables)
|
52
|
+
|
53
|
+
app = app_name
|
54
|
+
on [env_config.fetch(:server_ip)] do |host|
|
55
|
+
execute :dokku, 'config:set', app, environment_variables.map { |key, value| "#{key.to_s.upcase}=#{value}" }.join(' ')
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
50
59
|
private
|
51
60
|
|
52
61
|
def configure
|
@@ -54,9 +63,9 @@ module Deployless
|
|
54
63
|
ssh.connection_timeout = 30
|
55
64
|
ssh.ssh_options = {
|
56
65
|
user: env_config.fetch(:server_username),
|
57
|
-
keys:
|
66
|
+
keys: [env_config.fetch(:ssh_key_path)], # Fixed array syntax for keys
|
58
67
|
forward_agent: false,
|
59
|
-
auth_methods: %w(publickey)
|
68
|
+
auth_methods: %w(publickey password keyboard-interactive) # Added additional auth methods
|
60
69
|
}
|
61
70
|
end
|
62
71
|
end
|
@@ -91,23 +100,6 @@ module Deployless
|
|
91
100
|
end
|
92
101
|
end
|
93
102
|
|
94
|
-
def set_initial_environment_variables
|
95
|
-
secret_key_base = SecureRandom.hex(64)
|
96
|
-
|
97
|
-
environment_variables = {
|
98
|
-
'SECRET_KEY_BASE' => secret_key_base,
|
99
|
-
'RAILS_ENV' => @environment,
|
100
|
-
'RAKE_ENV' => @environment,
|
101
|
-
'RAILS_LOG_TO_STDOUT' => 'enabled',
|
102
|
-
'RAILS_SERVE_STATIC_FILES' => 'enabled'
|
103
|
-
}
|
104
|
-
|
105
|
-
app = app_name
|
106
|
-
on [env_config.fetch(:server_ip)] do |host|
|
107
|
-
execute :dokku, 'config:set', app, environment_variables.map { |key, value| "#{key}=#{value}" }.join(' ')
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
103
|
def install_postgres
|
112
104
|
app = app_name
|
113
105
|
on [env_config.fetch(:server_ip)] do |host|
|
data/lib/deployless/version.rb
CHANGED