Class: Karafka::Web::Installer
- Inherits:
-
Object
- Object
- Karafka::Web::Installer
- Includes:
- Helpers::Colorize
- Defined in:
- lib/karafka/web/installer.rb
Overview
Responsible for setup of the Web UI and Karafka Web-UI related components initialization.
Instance Method Summary collapse
-
#enable! ⇒ Object
Enables the Web-UI in the karafka app.
-
#install(replication_factor: 1) ⇒ Object
Creates needed topics and the initial zero state, so even if no
karafka server
processes are running, we can still display the empty UI. -
#migrate(replication_factor: 1) ⇒ Object
Creates missing topics and missing zero states.
-
#reset(replication_factor: 1) ⇒ Object
Removes all the Karafka topics and creates them again with the same replication factor.
-
#uninstall ⇒ Object
Removes all the Karafka Web topics and cleans after itself.
Instance Method Details
#enable! ⇒ Object
Enables the Web-UI in the karafka app. Sets up needed routes and listeners.
88 89 90 |
# File 'lib/karafka/web/installer.rb', line 88 def enable! Management::Actions::Enable.new.call end |
#install(replication_factor: 1) ⇒ Object
Creates needed topics and the initial zero state, so even if no karafka server
processes are running, we can still display the empty UI. Also adds needed code to the karafka.rb
file.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/karafka/web/installer.rb', line 14 def install(replication_factor: 1) enable! puts puts 'Installing Karafka Web UI...' puts Management::Actions::ExtendBootFile.new.call puts puts 'Creating necessary topics and populating state data...' puts Management::Actions::CreateTopics.new.call(replication_factor) wait_for_topics Management::Actions::CreateInitialStates.new.call puts puts 'Running data migrations...' Management::Actions::MigrateStatesData.new.call puts puts("Installation #{green('completed')}. Have fun!") puts end |
#migrate(replication_factor: 1) ⇒ Object
Creates missing topics and missing zero states. Needs to run for each environment where we want to use Web-UI
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/karafka/web/installer.rb', line 38 def migrate(replication_factor: 1) enable! puts puts 'Creating necessary topics and populating state data...' puts Management::Actions::CreateTopics.new.call(replication_factor) wait_for_topics Management::Actions::CreateInitialStates.new.call puts puts 'Running data migrations...' Management::Actions::MigrateStatesData.new.call puts puts("Migration #{green('completed')}. Have fun!") puts end |
#reset(replication_factor: 1) ⇒ Object
Removes all the Karafka topics and creates them again with the same replication factor
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/karafka/web/installer.rb', line 56 def reset(replication_factor: 1) enable! puts puts 'Resetting Karafka Web UI...' puts Management::Actions::DeleteTopics.new.call puts Management::Actions::CreateTopics.new.call(replication_factor) wait_for_topics Management::Actions::CreateInitialStates.new.call puts puts 'Running data migrations...' Management::Actions::MigrateStatesData.new.call puts puts("Resetting #{green('completed')}. Have fun!") puts end |
#uninstall ⇒ Object
Removes all the Karafka Web topics and cleans after itself.
75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/karafka/web/installer.rb', line 75 def uninstall enable! puts puts 'Uninstalling Karafka Web UI...' puts Management::Actions::DeleteTopics.new.call Management::Actions::CleanBootFile.new.call puts puts("Uninstalling #{green('completed')}. Goodbye!") puts end |