From ddca7f3434b15efc6a1b4f33b1e76aa870c87e78 Mon Sep 17 00:00:00 2001 From: Juan Rocha Date: Tue, 18 Apr 2023 12:02:19 +0200 Subject: [PATCH] [WSL]Updated FO install --- wsl/installFO.sh | 49 +++++++++++----------------------------------- wsl/installFull.sh | 2 +- 2 files changed, 12 insertions(+), 39 deletions(-) diff --git a/wsl/installFO.sh b/wsl/installFO.sh index f73edb3..a82ebca 100644 --- a/wsl/installFO.sh +++ b/wsl/installFO.sh @@ -27,11 +27,9 @@ MARIA_DB_CFG=/etc/mysql/mariadb.conf.d/50-server.cnf # Stats service STATS_PATH=$HOME/stats-service -STATS_HOST='0.0.0.0' -STATS_PORT='5005' STATS_DB_NAME='statsservice' -STATS_DB_USER='sqlmonarcuser' -STATS_DB_PASSWORD="sqlmonarcuser" +STATS_DB_USER='statsserviceuser' +STATS_DB_PASSWORD="password" STATS_SECRET_KEY="$(openssl rand -hex 32)" echo -e "\n--- Installing now… ---\n" @@ -105,8 +103,9 @@ fi echo -e "\n--- Installing MONARC… ---\n" +git clone --config core.fileMode=false https://github.com/monarc-project/MonarcAppFO $PATH_TO_MONARC > /dev/null 2>&1 + cd $PATH_TO_MONARC -git config core.fileMode false echo -e "\n--- Installing the dependencies… ---\n" composer ins > /dev/null 2>&1 @@ -195,38 +194,12 @@ export PATH="$PATH:$HOME/.local/bin" export FLASK_APP=runserver.py export STATS_CONFIG=production.py npm ci > /dev/null 2>&1 -poetry install --no-dev > /dev/null +poetry install > /dev/null 2>&1 +cp instance/production.py.cfg instance/production.py -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 = 'postgresql://{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" +sed -i "s/\"postgres\"/\"$STATS_DB_USER\"/" instance/production.py +sed -i "s/password/$STATS_DB_PASSWORD/" instance/production.py +sed -i "s/SECRET_KEY.*/SECRET_KEY = \"$STATS_SECRET_KEY\"/" instance/production.py FLASK_APP=runserver.py poetry run flask db_create FLASK_APP=runserver.py poetry run flask db_init @@ -290,7 +263,7 @@ return [ ], 'statsApi' => [ - 'baseUrl' => 'http://127.0.0.1:$STATS_PORT', + 'baseUrl' => 'http://127.0.0.1:5000', 'apiKey' => '$apiKey', ], @@ -341,5 +314,5 @@ cd ~ EOF echo -e "MONARC FO is ready and available at http://localhost" -echo -e "Stats service is ready and available at http://localhost:$STATS_PORT" +echo -e "Stats service is ready and available at http://localhost:5000" echo -e "user: admin@admin.localhost / password: admin" diff --git a/wsl/installFull.sh b/wsl/installFull.sh index f484255..62367d2 100644 --- a/wsl/installFull.sh +++ b/wsl/installFull.sh @@ -257,7 +257,7 @@ export PATH="$PATH:$HOME/.local/bin" export FLASK_APP=runserver.py export STATS_CONFIG=production.py npm ci > /dev/null 2>&1 -poetry install > /dev/null +poetry install > /dev/null 2>&1 cp instance/production.py.cfg instance/production.py sed -i "s/\"postgres\"/\"$STATS_DB_USER\"/" instance/production.py