[WSL]Updated WSL Full install

pull/494/head
Juan Rocha 2023-04-18 09:52:13 +02:00
parent c4bec38520
commit 317480ed26
No known key found for this signature in database
GPG Key ID: 8EFED3A40E4D6B9F
1 changed files with 12 additions and 6 deletions

View File

@ -37,6 +37,7 @@ STATS_DB_PASSWORD="sqlmonarcuser"
STATS_SECRET_KEY="$(openssl rand -hex 32)" STATS_SECRET_KEY="$(openssl rand -hex 32)"
echo -e "\n--- Installing now… ---\n" echo -e "\n--- Installing now… ---\n"
sudo chmod 755 $HOME
sudo apt-get update > /dev/null 2>&1 sudo apt-get update > /dev/null 2>&1
echo -e "\n--- Updating packages list… ---\n" echo -e "\n--- Updating packages list… ---\n"
@ -49,7 +50,7 @@ sudo apt-get -y install vim zip unzip git gettext curl gsfonts > /dev/null
echo -e "\n--- Install MariaDB specific packages and settings… ---\n" echo -e "\n--- Install MariaDB specific packages and settings… ---\n"
sudo apt-get -y install mariadb-server mariadb-client > /dev/null sudo apt-get -y install mariadb-server mariadb-client > /dev/null
# Secure the MariaDB installation (especially by setting a strong root password) # Secure the MariaDB installation (especially by setting a strong root password)
sudo service mysql restart > /dev/null sudo service mariadb restart > /dev/null
sleep 5 sleep 5
sudo mysql_secure_installation > /dev/null 2>&1 <<EOF sudo mysql_secure_installation > /dev/null 2>&1 <<EOF
@ -70,10 +71,10 @@ echo -e "\n--- Setting up our MariaDB user for MONARC… ---\n"
sudo mysql -u root -p$DBPASSWORD_ADMIN -e "CREATE USER '$DBUSER_MONARC'@'%' IDENTIFIED BY '$DBPASSWORD_MONARC';" 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 "GRANT ALL PRIVILEGES ON * . * TO '$DBUSER_MONARC'@'%';"
sudo mysql -u root -p$DBPASSWORD_ADMIN -e "FLUSH PRIVILEGES;" sudo mysql -u root -p$DBPASSWORD_ADMIN -e "FLUSH PRIVILEGES;"
sudo service mysql restart > /dev/null sudo service mariadb restart > /dev/null
echo -e "\n--- Installing PHP-specific packages… ---\n" echo -e "\n--- Installing PHP-specific packages… ---\n"
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 2>&1 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-zip php-xdebug php-bcmath > /dev/null 2>&1
echo -e "\n--- Configuring PHP… ---\n" echo -e "\n--- Configuring PHP… ---\n"
for key in upload_max_filesize post_max_size max_execution_time max_input_time memory_limit for key in upload_max_filesize post_max_size max_execution_time max_input_time memory_limit
@ -248,13 +249,13 @@ sudo -u postgres psql -c "ALTER USER $STATS_DB_USER WITH SUPERUSER;" > /dev/null
cd ~ cd ~
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python > /dev/null curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python > /dev/null
echo 'export PATH="$PATH:$HOME/.poetry/bin"' >> ~/.bashrc echo 'export PATH="$PATH:$HOME/.local/bin"' >> ~/.bashrc
echo 'export FLASK_APP=runserver.py' >> ~/.bashrc echo 'export FLASK_APP=runserver.py' >> ~/.bashrc
echo 'export STATS_CONFIG=production.py' >> ~/.bashrc echo 'export STATS_CONFIG=production.py' >> ~/.bashrc
git clone https://github.com/monarc-project/stats-service $STATS_PATH > /dev/null 2>&1 git clone https://github.com/monarc-project/stats-service $STATS_PATH > /dev/null 2>&1
cd $STATS_PATH cd $STATS_PATH
export PATH="$PATH:$HOME/.poetry/bin" export PATH="$PATH:$HOME/.local/bin"
export FLASK_APP=runserver.py export FLASK_APP=runserver.py
export STATS_CONFIG=production.py export STATS_CONFIG=production.py
npm ci > /dev/null 2>&1 npm ci > /dev/null 2>&1
@ -354,6 +355,11 @@ return [
'baseUrl' => 'http://127.0.0.1:$STATS_PORT', 'baseUrl' => 'http://127.0.0.1:$STATS_PORT',
'apiKey' => '$apiKey', 'apiKey' => '$apiKey',
], ],
'import' => [
'uploadFolder' => '$appdir/data/import/files',
'isBackgroundProcessActive' => false,
],
]; ];
EOF EOF
@ -444,7 +450,7 @@ sudo service apache2 restart > /dev/null
echo -e "\n--- Adding autostart Services ---\n" echo -e "\n--- Adding autostart Services ---\n"
cat >> ~/.bashrc <<EOF cat >> ~/.bashrc <<EOF
# Autostart services # Autostart services
wsl.exe -u root service mysql start > /dev/null wsl.exe -u root service mariadb start > /dev/null
wsl.exe -u root service apache2 start > /dev/null wsl.exe -u root service apache2 start > /dev/null
wsl.exe -u root service postgresql start > /dev/null wsl.exe -u root service postgresql start > /dev/null
cd ~/stats-service/ ; poetry run nohup python runserver.py > /dev/null 2>&1 & cd ~/stats-service/ ; poetry run nohup python runserver.py > /dev/null 2>&1 &