Merge branch 'feature/stats' of https://github.com/monarc-project/MonarcAppFO into feature/stats

pull/316/head
Juan Rocha 2020-11-17 10:14:39 +01:00
commit 0b7b1ae89c
3 changed files with 1056 additions and 689 deletions

View File

@ -52,7 +52,7 @@
"laminas/laminas-log": "^2.11", "laminas/laminas-log": "^2.11",
"laminas/laminas-i18n": "^2.9", "laminas/laminas-i18n": "^2.9",
"symfony/console": "^5.0", "symfony/console": "^5.0",
"laminas/laminas-dependency-plugin": "^1.0", "laminas/laminas-dependency-plugin": "2.0.0beta1",
"ocramius/proxy-manager": "<2.3", "ocramius/proxy-manager": "<2.3",
"ocramius/package-versions": "<1.5" "ocramius/package-versions": "<1.5"
}, },

1546
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -199,107 +199,6 @@ echo -e "\n--- Restarting Apache… ---\n"
sudo systemctl restart apache2.service > /dev/null sudo systemctl restart apache2.service > /dev/null
echo -e "\n--- Configuration of MONARC database connection ---\n"
sudo bash -c "cat << EOF > config/autoload/local.php
<?php
return [
'doctrine' => [
'connection' => [
'orm_default' => [
'params' => [
'host' => '$DBHOST',
'user' => '$DBUSER_MONARC',
'password' => '$DBPASSWORD_MONARC',
'dbname' => '$DBNAME_COMMON',
],
],
'orm_cli' => [
'params' => [
'host' => '$DBHOST',
'user' => '$DBUSER_MONARC',
'password' => '$DBPASSWORD_MONARC',
'dbname' => '$DBNAME_CLI',
],
],
],
],
'activeLanguages' => ['fr','en','de','nl'],
'appVersion' => '-master',
'checkVersion' => false,
'appCheckingURL' => 'https://version.monarc.lu/check/MONARC',
'email' => [
'name' => 'MONARC',
'from' => 'info@monarc.lu',
],
'mospApiUrl' => 'https://objects.monarc.lu/api/v1/',
'monarc' => [
'ttl' => 60, // timeout
'salt' => '', // private salt for password encryption
],
'statsApi' => [
'baseUrl' => 'http://127.0.0.1:$STATS_PORT'
],
];
EOF"
echo -e "\n--- Creation of the data bases… ---\n"
mysql -u $DBUSER_MONARC -p$DBPASSWORD_MONARC -e "CREATE DATABASE monarc_cli DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;" > /dev/null
mysql -u $DBUSER_MONARC -p$DBPASSWORD_MONARC -e "CREATE DATABASE monarc_common DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;" > /dev/null
echo -e "\n--- Populating MONARC DB… ---\n"
mysql -u $DBUSER_MONARC -p$DBPASSWORD_MONARC monarc_common < db-bootstrap/monarc_structure.sql > /dev/null
mysql -u $DBUSER_MONARC -p$DBPASSWORD_MONARC monarc_common < db-bootstrap/monarc_data.sql > /dev/null
echo -e "\n--- Installation of Grunt… ---\n"
curl -sL https://deb.nodesource.com/setup_14.x | sudo bash -
sudo apt-get install -y nodejs
sudo npm install -g grunt-cli
echo -e "\n--- Creating cache folders for backend… ---\n"
mkdir -p $PATH_TO_MONARC/data/cache
mkdir -p $PATH_TO_MONARC/data/LazyServices/Proxy
mkdir -p $PATH_TO_MONARC/data/DoctrineORMModule/Proxy
echo -e "\n--- Adjusting user mod… ---\n"
sudo usermod -aG www-data vagrant
sudo usermod -aG vagrant www-data
echo -e "\n--- Update the project… ---\n"
sudo chown -R $USER:$(id -gn $USER) /home/vagrant/.config
./scripts/update-all.sh -d > /dev/null
echo -e "\n--- Create initial user and client ---\n"
php ./bin/phinx seed:run -c ./module/Monarc/FrontOffice/migrations/phinx.php
echo -e "\n--- Restarting Apache… ---\n"
sudo systemctl restart apache2.service > /dev/null
echo -e "\n--- Installing the stats service… ---\n" echo -e "\n--- Installing the stats service… ---\n"
sudo apt-get -y install postgresql python3-pip python3-venv sudo apt-get -y install postgresql python3-pip python3-venv
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 10 sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 10
@ -388,6 +287,100 @@ sleep 3
sudo systemctl restart statsservice > /dev/null sudo systemctl restart statsservice > /dev/null
#systemctl status statsservice.service #systemctl status statsservice.service
# Create a new client and set the apiKey.
cd $STATS_PATH ; apiKey=$(poetry run flask client_create --name admin_localhost | sed -nr 's/Token: (.*)$/\1/p')
cd $PATH_TO_MONARC
echo -e "\n--- Configuration of MONARC database connection ---\n"
sudo bash -c "cat << EOF > config/autoload/local.php
<?php
return [
'doctrine' => [
'connection' => [
'orm_default' => [
'params' => [
'host' => '$DBHOST',
'user' => '$DBUSER_MONARC',
'password' => '$DBPASSWORD_MONARC',
'dbname' => '$DBNAME_COMMON',
],
],
'orm_cli' => [
'params' => [
'host' => '$DBHOST',
'user' => '$DBUSER_MONARC',
'password' => '$DBPASSWORD_MONARC',
'dbname' => '$DBNAME_CLI',
],
],
],
],
'activeLanguages' => ['fr','en','de','nl'],
'appVersion' => '-master',
'checkVersion' => false,
'appCheckingURL' => 'https://version.monarc.lu/check/MONARC',
'email' => [
'name' => 'MONARC',
'from' => 'info@monarc.lu',
],
'mospApiUrl' => 'https://objects.monarc.lu/api/v1/',
'monarc' => [
'ttl' => 60, // timeout
'salt' => '', // private salt for password encryption
],
'statsApi' => [
'baseUrl' => 'http://127.0.0.1:$STATS_PORT'
'apiKey' => '$apiKey',
],
];
EOF"
echo -e "\n--- Creation of the data bases… ---\n"
mysql -u $DBUSER_MONARC -p$DBPASSWORD_MONARC -e "CREATE DATABASE monarc_cli DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;" > /dev/null
mysql -u $DBUSER_MONARC -p$DBPASSWORD_MONARC -e "CREATE DATABASE monarc_common DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;" > /dev/null
echo -e "\n--- Populating MONARC DB… ---\n"
mysql -u $DBUSER_MONARC -p$DBPASSWORD_MONARC monarc_common < db-bootstrap/monarc_structure.sql > /dev/null
mysql -u $DBUSER_MONARC -p$DBPASSWORD_MONARC monarc_common < db-bootstrap/monarc_data.sql > /dev/null
echo -e "\n--- Installation of Grunt… ---\n"
curl -sL https://deb.nodesource.com/setup_14.x | sudo bash -
sudo apt-get install -y nodejs
sudo npm install -g grunt-cli
echo -e "\n--- Creating cache folders for backend… ---\n"
mkdir -p $PATH_TO_MONARC/data/cache
mkdir -p $PATH_TO_MONARC/data/LazyServices/Proxy
mkdir -p $PATH_TO_MONARC/data/DoctrineORMModule/Proxy
echo -e "\n--- Adjusting user mod… ---\n"
sudo usermod -aG www-data vagrant
sudo usermod -aG vagrant www-data
echo -e "\n--- Update the project… ---\n"
sudo chown -R $USER:$(id -gn $USER) /home/vagrant/.config
./scripts/update-all.sh -d > /dev/null
echo -e "\n--- Create initial user and client ---\n"
php ./bin/phinx seed:run -c ./module/Monarc/FrontOffice/migrations/phinx.php
echo -e "\n--- Restarting Apache… ---\n"
sudo systemctl restart apache2.service > /dev/null
echo -e "MONARC is ready and avalable at http://127.0.0.1:5001" echo -e "MONARC is ready and avalable at http://127.0.0.1:5001"
echo -e "Stats service is ready and available at http://127.0.0.1:$STATS_PORT" echo -e "Stats service is ready and available at http://127.0.0.1:$STATS_PORT"