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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bcace00a79090e96ceb2880e81bd88b47135f8bc24a7df05ade8c8d74c80eeff
4
- data.tar.gz: b45efffec748c79fb102ca229eb920fccc0fa3acc1ef92f89a902d5ad16f43cc
3
+ metadata.gz: 0e90092e1f7b282631146db071f6f160f6710b9c9d5e0c0e91a2f4d8c213a2af
4
+ data.tar.gz: 43f10ccfb7c4c22c391a72006f4c7a034b43f0b1716a1c65afa064e72ae0d138
5
5
  SHA512:
6
- metadata.gz: 34f41ca5148c5e350a054900788f8ec2530bd1fdca6d8df4086d19b465e0d34d096d4c8ac07f1de06859d211baa0466640365d03bedbab7c3329ce80ebbb8b9f
7
- data.tar.gz: 86fd43372c7603a8695dafa02545e435b5cc3396720998c2ecd90fe80bac8e9792aee6ce8fc063fa0751d8f7158a3ec1952328eaec10e2764eacc3d989204044
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
- set_initial_environment_variables
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: %w(env_config.fetch(:ssh_key_path)),
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|
@@ -3,7 +3,8 @@ module Deployless
3
3
  module_function
4
4
 
5
5
  def to_s
6
- '0.0.3'
6
+ '0.0.4'
7
7
  end
8
8
  end
9
9
  end
10
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deployless
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paweł Dąbrowski