Merge pull request #130 from allerta-vvf/MatteoGheza/gitpod-setup
Support for gitpod.io
This commit is contained in:
commit
a8561cfca1
|
@ -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
|
|
@ -0,0 +1,11 @@
|
|||
#Inspired from https://github.com/koel/koel/blob/master/.gitpod.dockerfile
|
||||
|
||||
FROM gitpod/workspace-mysql:latest
|
||||
|
||||
ENV APACHE_DOCROOT_IN_REPO="server"
|
||||
|
||||
USER root
|
||||
RUN apt-get remove composer -y \
|
||||
&& php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
|
||||
&& php composer-setup.php --install-dir=/usr/local/bin --filename=composer
|
||||
USER gitpod
|
|
@ -0,0 +1,44 @@
|
|||
image:
|
||||
file: .gitpod.dockerfile
|
||||
ports:
|
||||
- port: 8001
|
||||
onOpen: ignore
|
||||
- port: 3306
|
||||
onOpen: ignore
|
||||
tasks:
|
||||
- name: Apache
|
||||
command: >
|
||||
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;
|
||||
composer install;
|
||||
composer update;
|
||||
cd resources;
|
||||
npm install;
|
||||
npm run prod;
|
||||
cd ../..;
|
||||
command: >
|
||||
cd server/install;
|
||||
WORKSPACE_URL=$(gp url 8001 | sed -E s/\\/$//);
|
||||
mysql -e "CREATE DATABASE IF NOT EXISTS allerta";
|
||||
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 -d -s "password" -w "owner" -e "mail@mailserver.local" -u $WORKSPACE_URL;
|
||||
touch runInstall.php;
|
||||
gp await-port 8001; gp preview "$(gp url 8001)";
|
||||
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==
|
||||
- shelex.vscode-cy-helper@1.1.0:U9ok2y1bSmqn17OMuRMOfw==
|
||||
- hookyqr.beautify@1.4.11:n9DJEUFbYD/YHaBXxm+pYw==
|
|
@ -1,5 +1,5 @@
|
|||
# allerta-vvf
|
||||
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fallerta-vvf%2Fallerta-vvf.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fallerta-vvf%2Fallerta-vvf?ref=badge_shield) ![PHP Code Testing](https://github.com/allerta-vvf/allerta-vvf/workflows/PHP%20Code%20Testing/badge.svg) ![Languages count](https://img.shields.io/github/languages/count/allerta-vvf/allerta-vvf) ![Top language](https://img.shields.io/github/languages/top/allerta-vvf/allerta-vvf) ![GitHub issues](https://img.shields.io/github/issues-raw/allerta-vvf/allerta-vvf) ![GitHub pull requests](https://img.shields.io/github/issues-pr-raw/allerta-vvf/allerta-vvf) ![GitHub stars](https://img.shields.io/github/stars/allerta-vvf/allerta-vvf?style=social)
|
||||
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fallerta-vvf%2Fallerta-vvf.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fallerta-vvf%2Fallerta-vvf?ref=badge_shield) ![PHP Code Testing](https://github.com/allerta-vvf/allerta-vvf/workflows/PHP%20Code%20Testing/badge.svg) ![Languages count](https://img.shields.io/github/languages/count/allerta-vvf/allerta-vvf) ![Top language](https://img.shields.io/github/languages/top/allerta-vvf/allerta-vvf) ![GitHub issues](https://img.shields.io/github/issues-raw/allerta-vvf/allerta-vvf) ![GitHub pull requests](https://img.shields.io/github/issues-pr-raw/allerta-vvf/allerta-vvf) ![GitHub stars](https://img.shields.io/github/stars/allerta-vvf/allerta-vvf?style=social) [![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/allerta-vvf/allerta-vvf)
|
||||
|
||||
**Coming soon, stay tuned!** :thumbsup:
|
||||
|
||||
|
|
|
@ -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 .
|
||||
|
|
Loading…
Reference in New Issue