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/resources/) 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. To complete your installation and to add the `flydata` command, please run the following from the command line. $ source ~/.bashrc 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 start EOM
- NO_DE_CANCEL_MESSAGE_TEMPLATE =
<<-EOM FlyData Agent has been installed on your server successfully. However, you need to create at least a data entry before you can start using FlyData. 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
Constants included from Helpers
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods included from Helpers
as_size, development?, env_mode, env_suffix, flydata_api_host_file, flydata_conf_file, flydata_version, format_menu_list, retry_on, to_command_class, usage_text
Methods inherited from Base
#ask_input_table_name, #ask_yes_no, #choose_one, #data_entry, #flydata, #initialize, #newline, #register_crontab, #retrieve_data_entries, #separator, #show_purpose_name
Methods included from Flydata::CommandLoggable
#before_logging, #log_error_stderr, #log_info_stdout, #log_warn_stderr
Constructor Details
This class inherits a constructor from Flydata::Command::Base
Instance Method Details
#initial_run ⇒ Object
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/flydata/command/setup.rb', line 86 def initial_run data_port = flydata.data_port.get dashboard_url = "#{flydata.flydata_api_host}/dashboard" 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::SyncFileManager.new(de).binlog_path) sender = Flydata::Command::Sender.new if sender.process_exist? sender.stop(quiet: true) true else false end else = INITIAL_SYNC_MESSAGE_TEMPLATE false end else = NO_DE_CANCEL_MESSAGE_TEMPLATE % [dashboard_url] false end end puts end |