This commit is contained in:
MatteoGheza 2021-03-16 11:10:38 +00:00
parent 8f3c7adc28
commit c822ddfe4b
3 changed files with 33 additions and 12 deletions

1
.gitignore vendored
View File

@ -521,6 +521,7 @@ sw.js
!/server/cypress/videos/.gitkeep
deployment_remotes.php
adminer.php
/server/resources/images/logo.png
/server/resources/images/owner.png

View File

@ -1,5 +1,3 @@
#Inspired from
image:
file: .gitpod.dockerfile
ports:
@ -10,9 +8,12 @@ ports:
tasks:
- name: Apache
command: >
touch /var/log/apache2/error.log;
touch /var/log/apache2/access.log;
multitail /var/log/apache2/error.log -I /var/log/apache2/access.log
mkdir /tmp/apache;
touch /tmp/apache/error.log;
touch /tmp/apache/access.log;
export APACHE_PID_FILE="/tmp/apache/PID" APACHE_RUN_USER="gitpod" APACHE_RUN_GROUP="gitpod" APACHE_SERVER_NAME="localhost" APACHE_LOG_DIR="/tmp/apache";
apache2;
multitail /tmp/apache/error.log -I /tmp/apache/access.log;
- name: Allerta
init: >
cd server;
@ -29,6 +30,14 @@ tasks:
mysql -e "CREATE USER 'allerta'@'localhost' IDENTIFIED BY 'allerta_pwd';";
mysql -e "GRANT ALL PRIVILEGES ON * . * TO 'allerta'@'localhost';";
mysqladmin reload;
php install.php config -n "allerta" -u "allerta" -a "allerta_pwd" -o "127.0.0.1" -r "DEV_ENV";
php install.php populate -m "admin" -b -s "password" -w "owner" -e "mail@mailserver.local";
apachectl start;
php install.php config -n "allerta" -u "allerta" -a "allerta_pwd" -o $WORKSPACE_URL -r "DEV_ENV";
php install.php populate -m "admin" -b -d -s "password" -w "owner" -e "mail@mailserver.local";
cd ..;
wget https://github.com/vrana/adminer/releases/download/v4.8.0/adminer-4.8.0.php;
mv adminer-4.8.0.php adminer.php
vscode:
extensions:
- gruntfuggly.todo-tree@0.0.205:sbsZJOTJzKZtMVHQuS2iPw==
- coenraads.bracket-pair-colorizer-2@0.1.4:+JUeb/jFYZt2/0MS/gUllA==
- shelex.vscode-cy-helper@1.1.0:U9ok2y1bSmqn17OMuRMOfw==
- hookyqr.beautify@1.4.11:n9DJEUFbYD/YHaBXxm+pYw==

View File

@ -461,7 +461,7 @@ function full_path()
return $url;
}
function initOptions($name, $visible, $developer, $password, $report_email, $owner)
function initOptions($name, $visible, $developer, $password, $report_email, $owner, $url=null)
{
try{
include_once "../config.php";
@ -508,7 +508,10 @@ INSERT INTO `".$prefix."_profiles` (`id`, `hidden`) VALUES (NULL, :hidden);".$qu
$prep->bindValue(':hidden', ($visible ? 0 : 1), PDO::PARAM_INT);
$prep->bindValue(':report_email', $report_email, PDO::PARAM_STR);
$prep->bindValue(':owner', $owner, PDO::PARAM_STR);
$prep->bindValue(':web_url', str_replace("install/install.php", "", full_path()), PDO::PARAM_STR);
if(is_null($url)){
$url = str_replace("install/install.php", "", full_path());
}
$prep->bindValue(':web_url', $url, PDO::PARAM_STR);
$prep->bindValue(':cron_job_code', str_replace(".", "", bin2hex(random_bytes(10)).base64_encode(openssl_random_pseudo_bytes(30))), PDO::PARAM_STR);
$prep->bindValue(':cron_job_time', "01;00:00", PDO::PARAM_STR);
$prep->execute();
@ -564,11 +567,13 @@ function cli_helper($action, $options)
case "populate":
$name = validate_arg($options, "name", "admin");
$visible = array_key_exists("visible", $options);
$developer = array_key_exists("developer", $options);
$password = validate_arg($options, "password", "password");
$report_email = validate_arg($options, "report_email", "postmaster@localhost.local");
$owner = validate_arg($options, "owner", "Owner");
$url = validate_arg($options, "url", "htp://localhost/");
initDB();
initOptions($name, $visible, $password, $report_email, $owner);
initOptions($name, $visible, $developer, $password, $report_email, $owner, $url);
t("DB Populated successful");
finalInstallationHelperStep();
exit(0);
@ -612,6 +617,9 @@ function run_cli()
\GetOpt\Option::create('b', 'visible', \GetOpt\GetOpt::NO_ARGUMENT)
->setDescription(t("Is admin visible?", false))
->setArgumentName(t("Is admin visible?", false)),
\GetOpt\Option::create('d', 'developer', \GetOpt\GetOpt::NO_ARGUMENT)
->setDescription(t("Enable devmode per the user", false))
->setArgumentName(t("Enable devmode per the user", false)),
\GetOpt\Option::create('s', 'password', \GetOpt\GetOpt::OPTIONAL_ARGUMENT)
->setDescription(t("Admin password", false))
->setArgumentName(t("Admin password", false)),
@ -620,7 +628,10 @@ function run_cli()
->setArgumentName(t("Owner", false)),
\GetOpt\Option::create('e', 'report_email', \GetOpt\GetOpt::OPTIONAL_ARGUMENT)
->setDescription(t("Report email", false))
->setArgumentName(t("Report email", false))
->setArgumentName(t("Report email", false)),
\GetOpt\Option::create('u', 'url', \GetOpt\GetOpt::OPTIONAL_ARGUMENT)
->setDescription(t("App url", false))
->setArgumentName(t("App url", false)),
]
)->setDescription(
t("Populate Allerta database", false) . "." . PHP_EOL .