Class: Flydata::Command::Setup
- Includes:
- Helpers
- Defined in:
- lib/flydata/command/setup.rb
Constant Summary collapse
- LOG_PATH_EXAMPLES =
%w(/var/log/httpd/access_log /var/log/apache2/access.log /var/log/httpd-access.log /var/log/apache2/access_log /var/log/messages /var/log/maillog /var/log/mysql/error.log /home/*/deploy/shared/log/*.log)
- OTHER =
'-- None of above --'
- ENTER_TABLE_NAME =
'-- Create a table on Redshift from your logs --'
- ALL_DONE_MESSAGE_TEMPLATE =
<<-EOM Congratulations! FlyData has started uploading your data. To complete your installation and to add the `flydata` command, please run the following from the command line. $ source ~/.bashrc What's next? - Check data on Redshift (%s) - Check your FlyData usage on the FlyData Dashboard (%s) - To manage the FlyData Agent, use the 'flydata' command (type 'flydata' for help) - If you encounter an issue, please check our documentation (https://www.flydata.com/docs/) or contact our customer support team ([email protected]) Thank you for using FlyData! EOM
- INITIAL_SYNC_MESSAGE_TEMPLATE =
<<-EOM FlyData Agent has been installed on your server successfully. What's next? 1. Generate a script to create tables on Redshift by running the following command. $ flydata sync:generate_table_ddl > create_table.sql 2. Create tables on Redshift by running the 'create_table.sql' script on your Redshift cluster. The script is auto-generated from your MySQL tables. You can also edit the script to add extra Redshift parameters such as distkey and sortkey. Once you run the script and create tables in Redshift, you are ready for the next step. 3. Start Sync Run the following command on your server. The command will start synchronizing data between MySQL and Redshift! $ flydata sync EOM
- NO_DE_SYNC_CANCEL_MESSAGE_TEMPLATE =
<<-EOM FlyData Agent has been installed on your server successfully. What's next? 1. Create a data entry from the dashboard (%s) 2. Reinstall FlyData Agent by running the install command on the dashboard EOM
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods included from Helpers
development?, env_mode, env_suffix, flydata_api_host_file, flydata_conf_file, format_menu_list, parse_command, print_usage, retry_on, to_command_class, usage_text
Methods inherited from Base
#ask_input_table_name, #ask_yes_no, #choose_one, #flydata, #initialize, #newline, #register_crontab, #retrieve_data_entries, #separator
Constructor Details
This class inherits a constructor from Flydata::Command::Base
Instance Method Details
#initial_run ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/flydata/command/setup.rb', line 75 def initial_run data_port = flydata.data_port.get dashboard_url = "#{flydata.flydata_api_host}/data_ports/#{data_port['id']}" redshift_console_url = "#{flydata.flydata_api_host}/redshift_clusters/query/new" = ALL_DONE_MESSAGE_TEMPLATE % [redshift_console_url, dashboard_url] run(quiet: true) do Flydata::Command::Conf.new.copy_templates puts if has_registered_redshift_entries? Flydata::Command::Sender.new.stop(quiet: true) true elsif has_registered_redshift_mysql_data_entries? de = retrieve_data_entries.first if File.exists?(Flydata::FileUtil::SyncFileManager.new(de).binlog_path) Flydata::Command::Sender.new.stop(quiet: true) true else = INITIAL_SYNC_MESSAGE_TEMPLATE false end else need_restart = _run = NO_DE_SYNC_CANCEL_MESSAGE_TEMPLATE % [dashboard_url] unless need_restart need_restart end end puts end |