More work on setup/installation process
This commit is contained in:
parent
6fd3acf651
commit
9fed113f74
19 changed files with 1072 additions and 198 deletions
50
airtime_mvc/build/airtime-setup/forms/database-settings.php
Normal file
50
airtime_mvc/build/airtime-setup/forms/database-settings.php
Normal file
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
?>
|
||||
|
||||
<form action="#" role="form" id="dbSettingsForm">
|
||||
<h3 class="form-title">Database Settings</h3>
|
||||
<span id="helpBlock" class="help-block help-message"></span>
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="dbUser">Username</label>
|
||||
<input required class="form-control" type="text" name="dbUser" id="dbUser" placeholder="Username"/>
|
||||
<span class="glyphicon glyphicon-remove form-control-feedback"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="dbPass">Password</label>
|
||||
<input required class="form-control" type="password" name="dbPass" id="dbPass" placeholder="Password"/>
|
||||
<span class="glyphicon glyphicon-remove form-control-feedback"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="dbName">Name</label>
|
||||
<input required class="form-control" type="text" name="dbName" id="dbName" placeholder="Name" value="airtime"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="dbHost">Host</label>
|
||||
<input required class="form-control" type="text" name="dbHost" id="dbHost" placeholder="Host" value="localhost"/>
|
||||
<span class="glyphicon glyphicon-remove form-control-feedback"></span>
|
||||
</div>
|
||||
<input class="form-control" type="hidden" name="dbErr" id="dbErr" aria-describedby="helpBlock"/>
|
||||
<div>
|
||||
<input type="submit" formtarget="dbSettingsForm" class="btn btn-primary btn-next" value="Next ❱"/>
|
||||
<input type="button" class="btn btn-primary btn-back btn-disabled" value="❰ Back"/>
|
||||
<input type="button" class="btn btn-default btn-skip" value="Skip this step ❱"/>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$("#dbSettingsForm").submit(function(e) {
|
||||
resetFeedback();
|
||||
e.preventDefault();
|
||||
var d = $('#dbSettingsForm').serializeArray();
|
||||
addOverlay();
|
||||
// Append .promise().done() rather than using a
|
||||
// callback to avoid weird alert duplication
|
||||
$("#overlay, #loadingImage").fadeIn(500).promise().done(function() {
|
||||
// Proxy function for passing the event to the cleanup function
|
||||
var cleanupProxy = function(data) {
|
||||
cleanupStep.call(this, data, e);
|
||||
};
|
||||
$.post('setup/setup-functions.php?obj=DatabaseSetup', d, cleanupProxy, "json");
|
||||
});
|
||||
});
|
||||
</script>
|
76
airtime_mvc/build/airtime-setup/forms/rabbitmq-settings.php
Normal file
76
airtime_mvc/build/airtime-setup/forms/rabbitmq-settings.php
Normal file
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
?>
|
||||
|
||||
<form action="#" role="form" id="rmqSettingsForm">
|
||||
<h3 class="form-title">RabbitMQ Settings</h3>
|
||||
<span id="helpBlock" class="help-block help-message"></span>
|
||||
<p>
|
||||
RabbitMQ is an AMQP-based messaging system used by Airtime. You should only edit these settings
|
||||
if you have changed the defaults since running the installer, or if you've opted to install RabbitMQ manually.
|
||||
</p>
|
||||
<p>
|
||||
In either case, we recommend that you change at least the default password provided -
|
||||
you can do this by running the following line from the command line:<br/>
|
||||
<code>sudo rabbitmqctl change_password <username> <newpassword></code>
|
||||
</p>
|
||||
<div id="rmqSlideToggle">
|
||||
<span><strong>Advanced </strong></span><span id="advCaret" class="caret"></span><hr/>
|
||||
</div>
|
||||
<div id="rmqFormBody">
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="rmqUser">Username</label>
|
||||
<input required class="form-control" type="text" name="rmqUser" id="rmqUser" placeholder="Username" value="airtime"/>
|
||||
<span class="glyphicon glyphicon-remove form-control-feedback"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="rmqPass">Password</label>
|
||||
<input class="form-control" type="password" name="rmqPass" id="rmqPass" placeholder="Password" value="airtime"/>
|
||||
<span class="glyphicon glyphicon-remove form-control-feedback"></span>
|
||||
<span id="rmqHelpBlock" class="help-block">
|
||||
You probably want to change this!
|
||||
</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="rmqHost">Host</label>
|
||||
<input required class="form-control" type="text" name="rmqHost" id="rmqHost" placeholder="Host" value="127.0.0.1"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="rmqPort">Port</label>
|
||||
<input required class="form-control" type="text" name="rmqPort" id="rmqPort" placeholder="Port" value="5672"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="rmqVHost">Virtual Host</label>
|
||||
<input required class="form-control" type="text" name="rmqVHost" id="rmqVHost" placeholder="VHost" value="/airtime"/>
|
||||
<span class="glyphicon glyphicon-remove form-control-feedback"></span>
|
||||
</div>
|
||||
<input class="form-control" type="hidden" name="rmqErr" id="rmqErr" aria-describedby="helpBlock"/>
|
||||
</div>
|
||||
<div>
|
||||
<input type="submit" formtarget="rmqSettingsForm" class="btn btn-primary btn-next" value="Next ❱"/>
|
||||
<input type="button" class="btn btn-primary btn-back" value="❰ Back"/>
|
||||
<input type="button" class="btn btn-default btn-skip" value="Skip this step ❱"/>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$("#rmqSlideToggle").click(function() {
|
||||
$("#rmqFormBody").slideToggle(500);
|
||||
$("#advCaret").toggleClass("caret-up");
|
||||
});
|
||||
|
||||
$("#rmqSettingsForm").submit(function(e) {
|
||||
resetFeedback();
|
||||
e.preventDefault();
|
||||
var d = $('#rmqSettingsForm').serializeArray();
|
||||
addOverlay();
|
||||
// Append .promise().done() rather than using a
|
||||
// callback to avoid weird alert duplication
|
||||
$("#overlay, #loadingImage").fadeIn(500).promise().done(function() {
|
||||
// Proxy function for passing the event to the cleanup function
|
||||
var cleanupProxy = function(data) {
|
||||
cleanupStep.call(this, data, e);
|
||||
};
|
||||
$.post('setup/setup-functions.php?obj=RabbitMQSetup', d, cleanupProxy, "json");
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -6,9 +6,9 @@
|
|||
* @return boolean true if all Airtime dependencies and services are
|
||||
* properly configured and running
|
||||
*/
|
||||
function airtimeCheckConfiguration() {
|
||||
return airtimeCheckPhpDependencies()
|
||||
&& airtimeCheckDatabaseConfiguration();
|
||||
function checkConfiguration() {
|
||||
return checkPhpDependencies()
|
||||
&& checkDatabaseConfiguration();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -17,10 +17,10 @@ function airtimeCheckConfiguration() {
|
|||
*
|
||||
* @return array associative array of dependency check results
|
||||
*/
|
||||
function airtimeCheckPhpDependencies() {
|
||||
function checkPhpDependencies() {
|
||||
return array(
|
||||
"zend" => airtimeCheckMvcDependencies(),
|
||||
"postgres" => airtimeCheckDatabaseDependencies()
|
||||
"zend" => checkMvcDependencies(),
|
||||
"postgres" => checkDatabaseDependencies()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ function airtimeCheckPhpDependencies() {
|
|||
*
|
||||
* @return boolean true if Zend exists in /usr/share/php
|
||||
*/
|
||||
function airtimeCheckMvcDependencies() {
|
||||
function checkMvcDependencies() {
|
||||
return file_exists('/usr/share/php/libzend-framework-php')
|
||||
|| file_exists('/usr/share/php/zendframework'); // Debian version
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ function airtimeCheckMvcDependencies() {
|
|||
*
|
||||
* @return boolean true if the database dependencies exist
|
||||
*/
|
||||
function airtimeCheckDatabaseDependencies() {
|
||||
function checkDatabaseDependencies() {
|
||||
global $extensions;
|
||||
// Check the PHP extension list for the Postgres db extensions
|
||||
return (in_array('pdo_pgsql', $extensions)
|
||||
|
@ -51,8 +51,8 @@ function airtimeCheckDatabaseDependencies() {
|
|||
*
|
||||
* @return boolean true if a connection is made to the database
|
||||
*/
|
||||
function airtimeCheckDatabaseConfiguration() {
|
||||
airtimeConfigureDatabase();
|
||||
function checkDatabaseConfiguration() {
|
||||
configureDatabase();
|
||||
|
||||
try {
|
||||
// Try to establish a database connection. If something goes
|
||||
|
@ -69,6 +69,10 @@ function airtimeCheckDatabaseConfiguration() {
|
|||
/**
|
||||
* Initialize Propel to configure the Airtime database
|
||||
*/
|
||||
function airtimeConfigureDatabase() {
|
||||
function configureDatabase() {
|
||||
Propel::init(CONFIG_PATH . 'airtime-conf-production.php');
|
||||
}
|
||||
|
||||
function validateDatabaseSchema() {
|
||||
|
||||
}
|
|
@ -1,75 +1,43 @@
|
|||
<?php
|
||||
|
||||
require_once ROOT_PATH . 'public/setup/functions.php';
|
||||
|
||||
?>
|
||||
|
||||
<html style="background-color: #111141;">
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="css/bootstrap-3.3.1.min.css">
|
||||
<script type="text/javascript" src="js/libs/jquery-1.8.3.min.js"></script>
|
||||
<script type="text/javascript" src="js/libs/jquery-ui-1.8.24.min.js"></script>
|
||||
<script type="text/javascript" src="js/setup/setup-config.js"></script>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="css/bootstrap-3.3.1.min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/setup/setup-config.css" />
|
||||
</head>
|
||||
<body style="background-color: #111141; color: white; padding: 2em 0; min-width: 400px; width: 30%; text-align: center; margin: 3em auto;">
|
||||
<img src="css/images/airtime_logo_jp.png" style="margin-bottom: .5em;" /><br/>
|
||||
<form action="#" role="form" style="width: 50%; margin: auto;" id="dbSettingsForm">
|
||||
<h3 style="margin: 1em 0;">Database Settings</h3>
|
||||
<div class="form-group">
|
||||
<label class="sr-only" for="dbUser">Database Username</label>
|
||||
<input required class="form-control" type="text" name="dbUser" id="dbUser" placeholder="Username"/>
|
||||
<body>
|
||||
<div class="header">
|
||||
<h3 class="logo">
|
||||
<img src="css/images/airtime_logo_jp.png" id="airtimeLogo" /><br/>
|
||||
<strong>Setup</strong>
|
||||
</h3>
|
||||
<strong>Step <span id="stepCount">1</span> of 4</strong>
|
||||
</div>
|
||||
|
||||
<div class="viewport">
|
||||
<div class="form-slider">
|
||||
<div id="databaseSettings" class="form-wrapper">
|
||||
<?php
|
||||
require_once SETUP_PATH . "forms/database-settings.php";
|
||||
?>
|
||||
</div>
|
||||
<div id="rabbitmqSettings" class="form-wrapper">
|
||||
<?php
|
||||
require_once SETUP_PATH . "forms/rabbitmq-settings.php";
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="sr-only" for="dbPass">Database Password</label>
|
||||
<input required class="form-control" type="password" name="dbPass" id="dbPass" placeholder="Password"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="sr-only" for="dbName">Database Name</label>
|
||||
<input required class="form-control" type="text" name="dbName" id="dbName" placeholder="Name"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="sr-only" for="dbHost">Database Host</label>
|
||||
<input required class="form-control" type="text" name="dbHost" id="dbHost" placeholder="Host" value="localhost"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="submit" class="btn btn-default"/>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$("#dbSettingsForm").submit(function(e) {
|
||||
e.preventDefault();
|
||||
var d = $('#dbSettingsForm').serializeArray();
|
||||
// First, check if the db user exists (if not, we're done)
|
||||
$.post('setup/functions.php?fn=airtimeValidateDatabaseUser', d, function(result) {
|
||||
if (result == true) {
|
||||
// We know that the user credentials check out, so check if the database exists
|
||||
$.post('setup/functions.php?fn=airtimeValidateDatabaseSettings', d, function(result) {
|
||||
if (result == true) {
|
||||
// The database already exists, so we can just set up the schema
|
||||
// TODO change alerts to actually useful things
|
||||
alert("Setting up airtime schema...");
|
||||
} else {
|
||||
// The database doesn't exist, so check if the user can create databases
|
||||
$.post('setup/functions.php?fn=airtimeCheckUserCanCreateDb', d, function(result) {
|
||||
if (result == true) {
|
||||
// The user can create a database, so ask if they want to create it
|
||||
if (confirm("Create database '" + $("#dbName").val() + "' on " + $("#dbHost").val()
|
||||
+ " as user " + $("#dbUser").val() + "?")) {
|
||||
// TODO create the database...
|
||||
alert("Creating airtime database...");
|
||||
}
|
||||
} else {
|
||||
// The user can't create databases, so we're done
|
||||
alert("No database " + $("#dbName").val() + " exists; user " + $("#dbUser").val()
|
||||
+ " does not have permission to create databases on " + $("#dbHost").val());
|
||||
}
|
||||
}, "json");
|
||||
}
|
||||
}, "json");
|
||||
} else {
|
||||
alert("User credentials are invalid!");
|
||||
}
|
||||
}, "json");
|
||||
});
|
||||
$(".btn-skip").click(nextSlide);
|
||||
$(".btn-back").click(prevSlide);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -51,20 +51,20 @@ dbpass = airtime
|
|||
# The default is 5672.
|
||||
#
|
||||
# user: The username for the RabbitMQ user.
|
||||
# The default is guest.
|
||||
# The default is airtime.
|
||||
#
|
||||
# password: The password for the RabbitMQ user.
|
||||
# The default is guest.
|
||||
# The default is airtime.
|
||||
#
|
||||
# vhost: The virtual host for the RabbitMQ service database.
|
||||
# The default is /.
|
||||
# The default is /airtime.
|
||||
#
|
||||
[rabbitmq]
|
||||
host = 127.0.0.1
|
||||
port = 5672
|
||||
user = guest
|
||||
password = guest
|
||||
vhost = /
|
||||
user = airtime
|
||||
password = airtime
|
||||
vhost = /airtime
|
||||
#
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue