Class: DokkuBackend

Inherits:
Object
  • Object
show all
Defined in:
lib/mobile_workflow_cli/dokku_backend.rb

Instance Method Summary collapse

Constructor Details

#initialize(dokku_host:, app_name:) ⇒ DokkuBackend

Returns a new instance of DokkuBackend.



2
3
4
5
# File 'lib/mobile_workflow_cli/dokku_backend.rb', line 2

def initialize(dokku_host:, app_name:)
  @dokku_host = dokku_host
  @dokku_app_name = app_name.gsub("_", "-")
end

Instance Method Details

#configure_activestorageObject



17
18
19
# File 'lib/mobile_workflow_cli/dokku_backend.rb', line 17

def configure_activestorage
 
end

#createObject



7
8
9
10
11
12
13
14
15
# File 'lib/mobile_workflow_cli/dokku_backend.rb', line 7

def create
  remote_command "dokku apps:create #{@dokku_app_name}"
  remote_command "dokku postgres:create #{@dokku_app_name}"
  remote_command "dokku postgres:link #{@dokku_app_name} #{@dokku_app_name}"
  remote_command "dokku domains:enable #{@dokku_app_name}"
  remote_command "dokku letsencrypt #{@dokku_app_name}"
  
  local_command "git remote add dokku dokku@#{@dokku_host}:#{@dokku_app_name}"
end

#deployObject



21
22
23
# File 'lib/mobile_workflow_cli/dokku_backend.rb', line 21

def deploy
  local_command "git push dokku master"
end

#destroyObject



31
32
33
# File 'lib/mobile_workflow_cli/dokku_backend.rb', line 31

def destroy
  remote_command "dokku apps:destroy #{@dokku_app_name}"
end

#dokku_app_hostObject



35
36
37
# File 'lib/mobile_workflow_cli/dokku_backend.rb', line 35

def dokku_app_host
  remote_command "dokku url #{@dokku_app_name}"
end

#notifications_endpointObject



39
40
41
# File 'lib/mobile_workflow_cli/dokku_backend.rb', line 39

def notifications_endpoint
  "https://#{dokku_app_host}/sns_notifications"
end

#sync_dotenvObject



25
26
27
28
29
# File 'lib/mobile_workflow_cli/dokku_backend.rb', line 25

def sync_dotenv
  env = File.read(".env").split.join(" ")
  puts "Setting env: #{env}"
  local_command "dokku config:set #{env}"
end