[WSL]Updated FO install

pull/494/head
Juan Rocha 2023-04-18 12:02:19 +02:00
parent 611b1c28a0
commit ddca7f3434
No known key found for this signature in database
GPG Key ID: 8EFED3A40E4D6B9F
2 changed files with 12 additions and 39 deletions

View File

@ -27,11 +27,9 @@ MARIA_DB_CFG=/etc/mysql/mariadb.conf.d/50-server.cnf
# Stats service # Stats service
STATS_PATH=$HOME/stats-service STATS_PATH=$HOME/stats-service
STATS_HOST='0.0.0.0'
STATS_PORT='5005'
STATS_DB_NAME='statsservice' STATS_DB_NAME='statsservice'
STATS_DB_USER='sqlmonarcuser' STATS_DB_USER='statsserviceuser'
STATS_DB_PASSWORD="sqlmonarcuser" STATS_DB_PASSWORD="password"
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"
@ -105,8 +103,9 @@ fi
echo -e "\n--- Installing MONARC… ---\n" 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 cd $PATH_TO_MONARC
git config core.fileMode false
echo -e "\n--- Installing the dependencies… ---\n" echo -e "\n--- Installing the dependencies… ---\n"
composer ins > /dev/null 2>&1 composer ins > /dev/null 2>&1
@ -195,38 +194,12 @@ 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
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 sed -i "s/\"postgres\"/\"$STATS_DB_USER\"/" instance/production.py
HOST = '$STATS_HOST' sed -i "s/password/$STATS_DB_PASSWORD/" instance/production.py
PORT = $STATS_PORT sed -i "s/SECRET_KEY.*/SECRET_KEY = \"$STATS_SECRET_KEY\"/" instance/production.py
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"
FLASK_APP=runserver.py poetry run flask db_create 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 db_init
@ -290,7 +263,7 @@ return [
], ],
'statsApi' => [ 'statsApi' => [
'baseUrl' => 'http://127.0.0.1:$STATS_PORT', 'baseUrl' => 'http://127.0.0.1:5000',
'apiKey' => '$apiKey', 'apiKey' => '$apiKey',
], ],
@ -341,5 +314,5 @@ cd ~
EOF EOF
echo -e "MONARC FO is ready and available at http://localhost" 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" echo -e "user: admin@admin.localhost / password: admin"

View File

@ -257,7 +257,7 @@ 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
poetry install > /dev/null poetry install > /dev/null 2>&1
cp instance/production.py.cfg instance/production.py cp instance/production.py.cfg instance/production.py
sed -i "s/\"postgres\"/\"$STATS_DB_USER\"/" instance/production.py sed -i "s/\"postgres\"/\"$STATS_DB_USER\"/" instance/production.py