Class: MobileWorkflow::Cli::DokkuBackend
- Inherits:
-
Object
- Object
- MobileWorkflow::Cli::DokkuBackend
- Defined in:
- lib/mobile_workflow/cli/dokku_backend.rb
Instance Method Summary collapse
- #configure_activestorage ⇒ Object
- #create ⇒ Object
- #deploy ⇒ Object
- #destroy ⇒ Object
- #dokku_app_host ⇒ Object
-
#initialize(dokku_host:, app_name:) ⇒ DokkuBackend
constructor
A new instance of DokkuBackend.
- #notifications_endpoint ⇒ Object
- #sync_dotenv ⇒ Object
Constructor Details
#initialize(dokku_host:, app_name:) ⇒ DokkuBackend
Returns a new instance of DokkuBackend.
6 7 8 9 |
# File 'lib/mobile_workflow/cli/dokku_backend.rb', line 6 def initialize(dokku_host:, app_name:) @dokku_host = dokku_host @dokku_app_name = app_name.gsub('_', '-') end |
Instance Method Details
#configure_activestorage ⇒ Object
21 |
# File 'lib/mobile_workflow/cli/dokku_backend.rb', line 21 def configure_activestorage; end |
#create ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/mobile_workflow/cli/dokku_backend.rb', line 11 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 |
#deploy ⇒ Object
23 24 25 |
# File 'lib/mobile_workflow/cli/dokku_backend.rb', line 23 def deploy local_command 'git push dokku master' end |
#destroy ⇒ Object
33 34 35 |
# File 'lib/mobile_workflow/cli/dokku_backend.rb', line 33 def destroy remote_command "dokku apps:destroy #{@dokku_app_name}" end |
#dokku_app_host ⇒ Object
37 38 39 |
# File 'lib/mobile_workflow/cli/dokku_backend.rb', line 37 def dokku_app_host remote_command "dokku url #{@dokku_app_name}" end |
#notifications_endpoint ⇒ Object
41 42 43 |
# File 'lib/mobile_workflow/cli/dokku_backend.rb', line 41 def notifications_endpoint "https://#{dokku_app_host}/sns_notifications" end |
#sync_dotenv ⇒ Object
27 28 29 30 31 |
# File 'lib/mobile_workflow/cli/dokku_backend.rb', line 27 def sync_dotenv env = File.read('.env').split.join(' ') puts "Setting env: #{env}" local_command "dokku config:set #{env}" end |