Class: Deployless::Providers::DokkuProvider
- Inherits:
-
Object
- Object
- Deployless::Providers::DokkuProvider
- Includes:
- SSHKit::DSL
- Defined in:
- lib/deployless/providers/dokku_provider.rb
Constant Summary collapse
- AppAlreadyExists =
Class.new(StandardError)
- VERSION =
'0.35.12'
Instance Method Summary collapse
- #configure_environment ⇒ Object
-
#initialize(config:, environment:) ⇒ DokkuProvider
constructor
A new instance of DokkuProvider.
- #run_console ⇒ Object
- #update_environment_variables ⇒ Object
Constructor Details
#initialize(config:, environment:) ⇒ DokkuProvider
Returns a new instance of DokkuProvider.
14 15 16 17 18 |
# File 'lib/deployless/providers/dokku_provider.rb', line 14 def initialize(config:, environment:) @config = config @environment = environment configure end |
Instance Method Details
#configure_environment ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/deployless/providers/dokku_provider.rb', line 27 def configure_environment install add_ssh_key create_app update_environment_variables install_postgres install_redis if @config.fetch(:background_job_processor) == 'Sidekiq' result = "No" prompt = TTY::Prompt.new while result == "No" result = prompt.enum_select("Add DNS record for the domain #{env_config.fetch(:domain)} - type: A, value: #{env_config.fetch(:server_ip)}. Is it done?", ["Yes", "No"], required: true) if result == "No" puts "Please add DNS record for the domain #{env_config.fetch(:domain)} - type: A, value: #{env_config.fetch(:server_ip)} and confirm when done." end end configure_domain configure_ssl print_instructions end |
#run_console ⇒ Object
20 21 22 23 24 25 |
# File 'lib/deployless/providers/dokku_provider.rb', line 20 def run_console server_ip = env_config.fetch(:server_ip) puts "Connecting to #{@environment} rails console..." system("ssh -t dokku@#{server_ip} enter #{app_name} web rails c") end |
#update_environment_variables ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/deployless/providers/dokku_provider.rb', line 50 def update_environment_variables environment_variables = env_config.fetch(:environment_variables) app = app_name on [env_config.fetch(:server_ip)] do |host| execute :dokku, 'config:set', app, environment_variables.map { |key, value| "#{key.to_s.upcase}=#{value}" }.join(' ') end end |