2017-08-18 09:54:27 +02:00
|
|
|
#! /usr/bin/env bash
|
|
|
|
|
2020-07-07 23:15:24 +02:00
|
|
|
RED='\033[0;31m'
|
|
|
|
GREEN='\033[0;32m'
|
|
|
|
NC='\033[0m' # No Color
|
|
|
|
|
2020-04-22 13:29:32 +02:00
|
|
|
PATH_TO_MONARC='/home/vagrant/monarc'
|
2019-10-30 10:53:05 +01:00
|
|
|
|
|
|
|
APPENV='local'
|
2019-10-28 13:23:06 +01:00
|
|
|
ENVIRONMENT='development'
|
2017-08-18 09:54:27 +02:00
|
|
|
|
2020-07-27 11:26:26 +02:00
|
|
|
# MariaDB database
|
2017-08-18 09:54:27 +02:00
|
|
|
DBHOST='localhost'
|
|
|
|
DBNAME_COMMON='monarc_common'
|
|
|
|
DBNAME_CLI='monarc_cli'
|
2018-01-15 13:45:06 +01:00
|
|
|
DBUSER_ADMIN='root'
|
2019-09-20 15:26:39 +02:00
|
|
|
DBPASSWORD_ADMIN="root"
|
2017-08-18 09:54:27 +02:00
|
|
|
DBUSER_MONARC='sqlmonarcuser'
|
2019-09-20 15:26:39 +02:00
|
|
|
DBPASSWORD_MONARC="sqlmonarcuser"
|
2017-08-18 09:54:27 +02:00
|
|
|
|
2020-07-27 11:26:26 +02:00
|
|
|
# PHP configuration
|
2017-08-18 09:54:27 +02:00
|
|
|
upload_max_filesize=200M
|
|
|
|
post_max_size=50M
|
|
|
|
max_execution_time=100
|
|
|
|
max_input_time=223
|
|
|
|
memory_limit=512M
|
2020-04-14 11:57:21 +02:00
|
|
|
# session expires in 1 week:
|
|
|
|
session.gc_maxlifetime=604800
|
|
|
|
session.gc_probability=1
|
|
|
|
session.gc_divisor=1000
|
2020-07-07 14:39:02 +02:00
|
|
|
|
2018-08-23 08:45:12 +02:00
|
|
|
PHP_INI=/etc/php/7.2/apache2/php.ini
|
2020-04-24 20:46:17 +02:00
|
|
|
XDEBUG_CFG=/etc/php/7.2/apache2/conf.d/20-xdebug.ini
|
2019-08-23 08:41:26 +02:00
|
|
|
MARIA_DB_CFG=/etc/mysql/mariadb.conf.d/50-server.cnf
|
2017-08-18 09:54:27 +02:00
|
|
|
|
2020-07-27 11:26:26 +02:00
|
|
|
# Stats service
|
|
|
|
STATS_PATH='/home/vagrant/stats-service'
|
2020-07-07 14:39:02 +02:00
|
|
|
STATS_HOST='0.0.0.0'
|
|
|
|
STATS_PORT='5005'
|
2020-07-27 11:26:26 +02:00
|
|
|
STATS_DB_NAME='statsservice'
|
|
|
|
STATS_DB_USER='sqlmonarcuser'
|
|
|
|
STATS_DB_PASSWORD="sqlmonarcuser"
|
|
|
|
STATS_SECRET_KEY="$(openssl rand -hex 32)"
|
|
|
|
|
2020-07-07 14:39:02 +02:00
|
|
|
|
2018-01-26 07:34:36 +01:00
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
|
|
export LANGUAGE=en_US.UTF-8
|
|
|
|
export LANG=en_US.UTF-8
|
|
|
|
export LC_ALL=en_US.UTF-8
|
2020-04-22 13:29:32 +02:00
|
|
|
sudo -E locale-gen en_US.UTF-8
|
|
|
|
sudo -E dpkg-reconfigure locales
|
2018-01-26 07:34:36 +01:00
|
|
|
|
2019-08-23 11:49:16 +02:00
|
|
|
|
2018-01-26 08:30:39 +01:00
|
|
|
echo -e "\n--- Installing now… ---\n"
|
2017-08-18 09:54:27 +02:00
|
|
|
|
2018-01-26 07:25:49 +01:00
|
|
|
echo -e "\n--- Updating packages list… ---\n"
|
2020-04-22 13:29:32 +02:00
|
|
|
sudo apt-get update && sudo apt-get upgrade
|
2017-08-18 09:54:27 +02:00
|
|
|
|
2018-01-26 07:25:49 +01:00
|
|
|
echo -e "\n--- Install base packages… ---\n"
|
2020-04-22 13:29:32 +02:00
|
|
|
sudo apt-get -y install vim zip unzip git gettext curl gsfonts > /dev/null
|
2017-08-18 09:54:27 +02:00
|
|
|
|
2019-08-23 11:49:16 +02:00
|
|
|
|
2018-01-26 07:25:49 +01:00
|
|
|
echo -e "\n--- Install MariaDB specific packages and settings… ---\n"
|
2020-04-22 13:29:32 +02:00
|
|
|
sudo apt-get -y install mariadb-server mariadb-client > /dev/null
|
2018-09-05 14:30:35 +02:00
|
|
|
# Secure the MariaDB installation (especially by setting a strong root password)
|
2020-04-22 13:29:32 +02:00
|
|
|
sudo systemctl restart mariadb.service > /dev/null
|
2018-01-25 22:57:11 +01:00
|
|
|
sleep 5
|
2020-04-22 13:29:32 +02:00
|
|
|
sudo apt-get -y install expect > /dev/null
|
2018-09-05 14:30:35 +02:00
|
|
|
## do we need to spawn mysql_secure_install with sudo in future?
|
|
|
|
expect -f - <<-EOF
|
|
|
|
set timeout 10
|
2020-04-22 13:29:32 +02:00
|
|
|
spawn sudo mysql_secure_installation
|
2018-09-05 14:30:35 +02:00
|
|
|
expect "Enter current password for root (enter for none):"
|
|
|
|
send -- "\r"
|
|
|
|
expect "Set root password?"
|
|
|
|
send -- "y\r"
|
|
|
|
expect "New password:"
|
|
|
|
send -- "${DBPASSWORD_ADMIN}\r"
|
|
|
|
expect "Re-enter new password:"
|
|
|
|
send -- "${DBPASSWORD_ADMIN}\r"
|
|
|
|
expect "Remove anonymous users?"
|
|
|
|
send -- "y\r"
|
|
|
|
expect "Disallow root login remotely?"
|
|
|
|
send -- "y\r"
|
|
|
|
expect "Remove test database and access to it?"
|
|
|
|
send -- "y\r"
|
|
|
|
expect "Reload privilege tables now?"
|
|
|
|
send -- "y\r"
|
|
|
|
expect eof
|
|
|
|
EOF
|
2019-10-30 11:59:44 +01:00
|
|
|
sudo apt-get purge -y expect php-xdebug > /dev/null 2>&1
|
2017-08-18 09:54:27 +02:00
|
|
|
|
2019-08-23 11:49:16 +02:00
|
|
|
echo -e "\n--- Configuring… ---\n"
|
2020-04-22 13:29:32 +02:00
|
|
|
sudo sed -i "s/skip-external-locking/#skip-external-locking/g" $MARIA_DB_CFG
|
|
|
|
sudo sed -i "s/.*bind-address.*/bind-address = 0.0.0.0/" $MARIA_DB_CFG
|
2019-08-23 08:41:26 +02:00
|
|
|
|
2019-08-23 11:49:16 +02:00
|
|
|
echo -e "\n--- Setting up our MariaDB user for MONARC… ---\n"
|
2020-04-22 13:29:32 +02:00
|
|
|
sudo mysql -u root -p$DBPASSWORD_ADMIN -e "CREATE USER '$DBUSER_MONARC'@'%' IDENTIFIED BY '$DBPASSWORD_MONARC';"
|
|
|
|
sudo mysql -u root -p$DBPASSWORD_ADMIN -e "GRANT ALL PRIVILEGES ON * . * TO '$DBUSER_MONARC'@'%';"
|
|
|
|
sudo mysql -u root -p$DBPASSWORD_ADMIN -e "FLUSH PRIVILEGES;"
|
|
|
|
sudo systemctl restart mariadb.service > /dev/null
|
2019-08-23 11:49:16 +02:00
|
|
|
|
2018-01-26 07:25:49 +01:00
|
|
|
echo -e "\n--- Installing PHP-specific packages… ---\n"
|
2020-06-30 21:18:06 +02:00
|
|
|
sudo apt-get -y install php apache2 libapache2-mod-php php-curl php-gd php-mysql php-pear php-apcu php-xml php-mbstring php-intl php-imagick php-zip php-xdebug php-bcmath > /dev/null
|
2017-08-18 09:54:27 +02:00
|
|
|
|
2018-01-26 07:25:49 +01:00
|
|
|
echo -e "\n--- Configuring PHP… ---\n"
|
2017-08-18 09:54:27 +02:00
|
|
|
for key in upload_max_filesize post_max_size max_execution_time max_input_time memory_limit
|
|
|
|
do
|
2020-04-22 13:29:32 +02:00
|
|
|
sudo sed -i "s/^\($key\).*/\1 = $(eval echo \${$key})/" $PHP_INI
|
2017-08-18 09:54:27 +02:00
|
|
|
done
|
|
|
|
|
2019-08-23 11:49:16 +02:00
|
|
|
echo -e "\n--- Configuring Xdebug for development ---\n"
|
2020-04-24 20:46:17 +02:00
|
|
|
sudo bash -c cat "<< EOF > $XDEBUG_CFG
|
2019-10-31 10:24:59 +01:00
|
|
|
zend_extension=xdebug.so
|
2019-08-23 08:41:26 +02:00
|
|
|
xdebug.remote_enable=1
|
|
|
|
xdebug.remote_connect_back=1
|
|
|
|
xdebug.idekey=IDEKEY
|
2020-04-22 13:29:32 +02:00
|
|
|
EOF"
|
2019-08-23 08:41:26 +02:00
|
|
|
|
2018-01-26 07:25:49 +01:00
|
|
|
echo -e "\n--- Enabling mod-rewrite and ssl… ---\n"
|
2020-04-22 13:29:32 +02:00
|
|
|
sudo a2enmod rewrite > /dev/null 2>&1
|
|
|
|
sudo a2enmod ssl > /dev/null 2>&1
|
|
|
|
sudo a2enmod headers > /dev/null 2>&1
|
2017-08-18 09:54:27 +02:00
|
|
|
|
|
|
|
echo -e "\n--- Allowing Apache override to all ---\n"
|
|
|
|
sudo sed -i "s/AllowOverride None/AllowOverride All/g" /etc/apache2/apache2.conf
|
|
|
|
|
|
|
|
|
2018-01-26 07:25:49 +01:00
|
|
|
echo -e "\n--- Installing composer… ---\n"
|
2017-08-18 09:54:27 +02:00
|
|
|
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer > /dev/null 2>&1
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "\nERROR: unable to install composer\n"
|
|
|
|
exit 1;
|
|
|
|
fi
|
2020-04-22 13:29:32 +02:00
|
|
|
# sudo composer self-update
|
2017-08-18 09:54:27 +02:00
|
|
|
|
2018-01-26 07:25:49 +01:00
|
|
|
echo -e "\n--- Installing MONARC… ---\n"
|
2017-08-18 09:54:27 +02:00
|
|
|
cd $PATH_TO_MONARC
|
|
|
|
git config core.fileMode false
|
2019-09-23 11:19:05 +02:00
|
|
|
|
2019-10-30 10:53:05 +01:00
|
|
|
echo -e "\n--- Installing the dependencies… ---\n"
|
2020-07-07 15:40:21 +02:00
|
|
|
composer ins
|
2017-08-18 09:54:27 +02:00
|
|
|
|
2019-10-30 10:53:05 +01:00
|
|
|
|
|
|
|
# Make modules symlinks.
|
2019-10-31 11:58:42 +01:00
|
|
|
mkdir -p module/Monarc
|
2019-09-23 08:50:20 +02:00
|
|
|
cd module/Monarc
|
2020-04-24 20:34:42 +02:00
|
|
|
ln -sfn ./../../vendor/monarc/core Core
|
|
|
|
ln -sfn ./../../vendor/monarc/frontoffice FrontOffice
|
2017-08-18 09:54:27 +02:00
|
|
|
cd $PATH_TO_MONARC
|
2019-09-23 08:50:20 +02:00
|
|
|
|
2019-09-20 15:26:39 +02:00
|
|
|
|
2019-11-21 08:31:22 +01:00
|
|
|
|
2019-08-23 11:49:16 +02:00
|
|
|
# Front-end
|
2020-04-24 20:34:42 +02:00
|
|
|
mkdir -p node_modules
|
2017-08-18 09:54:27 +02:00
|
|
|
cd node_modules
|
2020-04-24 20:34:42 +02:00
|
|
|
if [ ! -d "ng_client" ]; then
|
|
|
|
git clone --config core.fileMode=false https://github.com/monarc-project/ng-client.git ng_client > /dev/null 2>&1
|
|
|
|
fi
|
2017-08-18 09:54:27 +02:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "\nERROR: unable to clone the ng-client repository\n"
|
|
|
|
exit 1;
|
|
|
|
fi
|
2020-04-24 20:34:42 +02:00
|
|
|
if [ ! -d "ng_anr" ]; then
|
|
|
|
git clone --config core.fileMode=false https://github.com/monarc-project/ng-anr.git ng_anr > /dev/null 2>&1
|
|
|
|
fi
|
2017-08-18 09:54:27 +02:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "\nERROR: unable to clone the ng-anr repository\n"
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo -e "\n--- Add a VirtualHost for MONARC ---\n"
|
2020-04-22 13:29:32 +02:00
|
|
|
sudo bash -c "cat << EOF > /etc/apache2/sites-enabled/000-default.conf
|
2017-08-18 09:54:27 +02:00
|
|
|
<VirtualHost *:80>
|
|
|
|
ServerName localhost
|
|
|
|
DocumentRoot $PATH_TO_MONARC/public
|
|
|
|
|
|
|
|
<Directory $PATH_TO_MONARC/public>
|
|
|
|
DirectoryIndex index.php
|
|
|
|
AllowOverride All
|
|
|
|
Require all granted
|
|
|
|
</Directory>
|
|
|
|
|
2019-04-04 13:54:23 +02:00
|
|
|
<IfModule mod_headers.c>
|
|
|
|
Header always set X-Content-Type-Options nosniff
|
2020-04-22 13:29:32 +02:00
|
|
|
Header always set X-XSS-Protection '1; mode=block'
|
2019-04-04 13:54:23 +02:00
|
|
|
Header always set X-Robots-Tag none
|
|
|
|
Header always set X-Frame-Options SAMEORIGIN
|
|
|
|
</IfModule>
|
|
|
|
|
2019-10-30 10:53:05 +01:00
|
|
|
SetEnv APP_ENV $ENVIRONMENT
|
2017-12-06 16:01:45 +01:00
|
|
|
SetEnv APP_DIR $PATH_TO_MONARC
|
2017-08-18 09:54:27 +02:00
|
|
|
</VirtualHost>
|
2020-04-22 13:29:32 +02:00
|
|
|
EOF"
|
2018-01-26 07:25:49 +01:00
|
|
|
echo -e "\n--- Restarting Apache… ---\n"
|
2020-04-22 13:29:32 +02:00
|
|
|
sudo systemctl restart apache2.service > /dev/null
|
2017-08-18 09:54:27 +02:00
|
|
|
|
|
|
|
|
2020-11-13 14:52:37 +01:00
|
|
|
echo -e "\n--- Installing the stats service… ---\n"
|
|
|
|
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/python3 20
|
|
|
|
sudo -u postgres psql -c "CREATE USER $STATS_DB_USER WITH PASSWORD '$STATS_DB_PASSWORD';"
|
|
|
|
sudo -u postgres psql -c "ALTER USER $STATS_DB_USER WITH SUPERUSER;"
|
|
|
|
|
|
|
|
cd ~
|
|
|
|
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
|
|
|
|
echo 'export PATH="$PATH:$HOME/.poetry/bin"' >> ~/.bashrc
|
|
|
|
echo 'export FLASK_APP=runserver.py' >> ~/.bashrc
|
|
|
|
echo 'export STATS_CONFIG=production.py' >> ~/.bashrc
|
|
|
|
source ~/.bashrc
|
|
|
|
source $HOME/.poetry/env
|
|
|
|
|
|
|
|
git clone https://github.com/monarc-project/stats-service $STATS_PATH
|
|
|
|
cd $STATS_PATH
|
|
|
|
npm install
|
|
|
|
poetry install --no-dev
|
|
|
|
|
|
|
|
bash -c "cat << EOF > $STATS_PATH/instance/production.py
|
|
|
|
HOST = '$STATS_HOST'
|
|
|
|
PORT = $STATS_PORT
|
|
|
|
DEBUG = False
|
|
|
|
TESTING = False
|
|
|
|
INSTANCE_URL = 'http://127.0.0.1:$STATS_PORT'
|
|
|
|
|
|
|
|
ADMIN_EMAIL = 'info@cases.lu'
|
|
|
|
ADMIN_URL = 'https://www.cases.lu'
|
|
|
|
|
|
|
|
REMOTE_STATS_SERVER = 'https://dashboard.monarc.lu'
|
|
|
|
|
|
|
|
DB_CONFIG_DICT = {
|
|
|
|
'user': '$STATS_DB_USER',
|
|
|
|
'password': '$STATS_DB_PASSWORD',
|
|
|
|
'host': 'localhost',
|
|
|
|
'port': 5432,
|
|
|
|
}
|
|
|
|
DATABASE_NAME = '$STATS_DB_NAME'
|
|
|
|
SQLALCHEMY_DATABASE_URI = 'postgres://{user}:{password}@{host}:{port}/{name}'.format(
|
|
|
|
name=DATABASE_NAME, **DB_CONFIG_DICT
|
|
|
|
)
|
|
|
|
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
|
|
|
|
|
|
|
SECRET_KEY = '$STATS_SECRET_KEY'
|
|
|
|
|
|
|
|
LOG_PATH = './var/stats.log'
|
|
|
|
|
|
|
|
MOSP_URL = 'https://objects.monarc.lu'
|
|
|
|
EOF"
|
|
|
|
|
|
|
|
export FLASK_APP=runserver.py
|
|
|
|
export STATS_CONFIG=production.py
|
|
|
|
|
|
|
|
FLASK_APP=runserver.py poetry run flask db_create
|
|
|
|
FLASK_APP=runserver.py poetry run flask db_init
|
|
|
|
FLASK_APP=runserver.py poetry run flask client_create --name ADMIN --role admin
|
|
|
|
|
|
|
|
|
|
|
|
sudo bash -c "cat << EOF > /etc/systemd/system/statsservice.service
|
|
|
|
[Unit]
|
|
|
|
Description=MONARC Stats service
|
|
|
|
After=network.target
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
User=vagrant
|
|
|
|
Environment=LANG=en_US.UTF-8
|
|
|
|
Environment=LC_ALL=en_US.UTF-8
|
|
|
|
Environment=FLASK_APP=runserver.py
|
|
|
|
Environment=FLASK_ENV=production
|
|
|
|
Environment=STATS_CONFIG=production.py
|
|
|
|
Environment=FLASK_RUN_HOST=$STATS_HOST
|
|
|
|
Environment=FLASK_RUN_PORT=$STATS_PORT
|
|
|
|
WorkingDirectory=$STATS_PATH
|
|
|
|
ExecStart=/home/vagrant/.poetry/bin/poetry run flask run
|
|
|
|
Restart=always
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|
|
|
|
EOF"
|
|
|
|
|
|
|
|
sudo systemctl daemon-reload > /dev/null
|
|
|
|
sleep 1
|
|
|
|
sudo systemctl enable statsservice.service > /dev/null
|
|
|
|
sleep 3
|
|
|
|
sudo systemctl restart statsservice > /dev/null
|
|
|
|
#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
|
2019-08-23 11:49:16 +02:00
|
|
|
|
|
|
|
|
2019-10-30 10:53:05 +01:00
|
|
|
echo -e "\n--- Configuration of MONARC database connection ---\n"
|
2020-04-22 13:29:32 +02:00
|
|
|
sudo bash -c "cat << EOF > config/autoload/local.php
|
2017-08-18 09:54:27 +02:00
|
|
|
<?php
|
2020-05-12 18:25:51 +02:00
|
|
|
return [
|
|
|
|
'doctrine' => [
|
|
|
|
'connection' => [
|
|
|
|
'orm_default' => [
|
|
|
|
'params' => [
|
2017-08-18 09:54:27 +02:00
|
|
|
'host' => '$DBHOST',
|
|
|
|
'user' => '$DBUSER_MONARC',
|
|
|
|
'password' => '$DBPASSWORD_MONARC',
|
|
|
|
'dbname' => '$DBNAME_COMMON',
|
2020-05-12 18:25:51 +02:00
|
|
|
],
|
|
|
|
],
|
|
|
|
'orm_cli' => [
|
|
|
|
'params' => [
|
2017-08-18 09:54:27 +02:00
|
|
|
'host' => '$DBHOST',
|
|
|
|
'user' => '$DBUSER_MONARC',
|
|
|
|
'password' => '$DBPASSWORD_MONARC',
|
|
|
|
'dbname' => '$DBNAME_CLI',
|
2020-05-12 18:25:51 +02:00
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
|
|
|
|
'activeLanguages' => ['fr','en','de','nl'],
|
2017-10-20 22:26:05 +02:00
|
|
|
|
2020-04-24 11:49:44 +02:00
|
|
|
'appVersion' => '-master',
|
2017-12-15 15:19:00 +01:00
|
|
|
|
2018-07-04 14:54:46 +02:00
|
|
|
'checkVersion' => false,
|
2018-07-17 23:36:11 +02:00
|
|
|
'appCheckingURL' => 'https://version.monarc.lu/check/MONARC',
|
2018-07-04 14:54:46 +02:00
|
|
|
|
2017-10-20 22:26:05 +02:00
|
|
|
'email' => [
|
2020-05-12 18:25:51 +02:00
|
|
|
'name' => 'MONARC',
|
|
|
|
'from' => 'info@monarc.lu',
|
2017-10-20 22:26:05 +02:00
|
|
|
],
|
2017-08-18 09:54:27 +02:00
|
|
|
|
2019-04-04 07:56:39 +02:00
|
|
|
'mospApiUrl' => 'https://objects.monarc.lu/api/v1/',
|
|
|
|
|
2020-05-12 18:25:51 +02:00
|
|
|
'monarc' => [
|
2018-01-15 15:24:20 +01:00
|
|
|
'ttl' => 60, // timeout
|
2019-04-04 07:56:39 +02:00
|
|
|
'salt' => '', // private salt for password encryption
|
2020-05-12 18:25:51 +02:00
|
|
|
],
|
|
|
|
|
|
|
|
'statsApi' => [
|
2020-12-17 11:00:18 +01:00
|
|
|
'baseUrl' => 'http://127.0.0.1:$STATS_PORT',
|
2020-11-13 14:52:37 +01:00
|
|
|
'apiKey' => '$apiKey',
|
2020-05-12 18:25:51 +02:00
|
|
|
],
|
|
|
|
];
|
2020-04-22 13:29:32 +02:00
|
|
|
EOF"
|
2017-08-18 09:54:27 +02:00
|
|
|
|
|
|
|
|
2018-01-26 07:25:49 +01:00
|
|
|
echo -e "\n--- Creation of the data bases… ---\n"
|
2018-01-25 22:57:11 +01:00
|
|
|
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
|
2018-01-26 07:25:49 +01:00
|
|
|
echo -e "\n--- Populating MONARC DB… ---\n"
|
2018-01-25 22:57:11 +01:00
|
|
|
mysql -u $DBUSER_MONARC -p$DBPASSWORD_MONARC monarc_common < db-bootstrap/monarc_structure.sql > /dev/null
|
2018-01-26 07:25:49 +01:00
|
|
|
mysql -u $DBUSER_MONARC -p$DBPASSWORD_MONARC monarc_common < db-bootstrap/monarc_data.sql > /dev/null
|
2017-08-18 09:54:27 +02:00
|
|
|
|
|
|
|
|
2018-01-26 07:25:49 +01:00
|
|
|
echo -e "\n--- Installation of Grunt… ---\n"
|
2020-07-07 14:39:02 +02:00
|
|
|
curl -sL https://deb.nodesource.com/setup_14.x | sudo bash -
|
2019-11-21 08:34:50 +01:00
|
|
|
sudo apt-get install -y nodejs
|
|
|
|
sudo npm install -g grunt-cli
|
2017-08-18 09:54:27 +02:00
|
|
|
|
|
|
|
|
2020-04-24 15:55:29 +02:00
|
|
|
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
|
|
|
|
|
|
|
|
|
2018-01-26 07:25:49 +01:00
|
|
|
echo -e "\n--- Update the project… ---\n"
|
2020-04-24 11:49:44 +02:00
|
|
|
sudo chown -R $USER:$(id -gn $USER) /home/vagrant/.config
|
2020-07-08 09:42:49 +02:00
|
|
|
./scripts/update-all.sh -d > /dev/null
|
2017-08-18 09:54:27 +02:00
|
|
|
|
|
|
|
|
|
|
|
echo -e "\n--- Create initial user and client ---\n"
|
2019-09-12 14:38:30 +02:00
|
|
|
php ./bin/phinx seed:run -c ./module/Monarc/FrontOffice/migrations/phinx.php
|
2017-08-18 09:54:27 +02:00
|
|
|
|
|
|
|
|
2018-01-26 07:25:49 +01:00
|
|
|
echo -e "\n--- Restarting Apache… ---\n"
|
2020-04-22 13:29:32 +02:00
|
|
|
sudo systemctl restart apache2.service > /dev/null
|
2017-08-18 09:54:27 +02:00
|
|
|
|
|
|
|
|
2020-07-07 23:15:24 +02:00
|
|
|
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"
|