Skip to content
Snippets Groups Projects
Commit b8db0d6f authored by Marco Malavolti's avatar Marco Malavolti
Browse files

Fixed date issue. FistDate and LastDate are provided by output dir

parent 84480476
No related branches found
No related tags found
No related merge requests found
...@@ -42,21 +42,45 @@ ...@@ -42,21 +42,45 @@
7. Create link of Python3.8 for scripts: 7. Create link of Python3.8 for scripts:
* `sudo ln -s /usr/local/bin/python3.8 /usr/bin/python3.8` * `sudo ln -s /usr/local/bin/python3.8 /usr/bin/python3.8`
# Install Apache Web Server + WSGI for ECCS2 API
* `sudo apt install libapache2-mod-wsgi-py3 python3-dev`
* `sudo a2enmod wsgi`
# Install requirements for uWSGI used by ECCS2 API:
* `sudo apt-get install libpcre3 libpcre3-dev libapache2-mod-proxy-uwsgi build-essentials python-dev`
# Install Chromium used by Selenium
* `sudo apt install chromium chromium-l10n git jq` * `sudo apt install chromium chromium-l10n git jq`
* `python3 -m pip install --user --upgrade pip virtualenv`
* `python3 -m venv eccs2venv` # Install ECCS2
* `cd ~ ; git clone https://github.com/malavolti/eccs2.git`
* `cd eccs2`
* `python3.8 -m pip install --user --upgrade virtualenv`
* `virtualenv -p python38 eccs2venv`
* `source eccs2venv/bin/activate` (`deactivate` to exit Virtualenv) * `source eccs2venv/bin/activate` (`deactivate` to exit Virtualenv)
* `python3 -m pip install --upgrade wheel setuptools certifi selenium urllib3 flask flask-jsonpify flask-restful` * `pip install --upgrade pip uwsgi`
* `cd ~ ; git clone https://github.com/malavolti/eccs2.git` * `pip install -r requirements.txt`
* `cd eccs2`
* `cp eccs2properties.py.template eccs2properties.py` (and change it with your needs) # Configure ECCS2
* `./runEccs2.py`
* `cp eccs2properties.py.template eccs2properties.py` (and change it on your needs)
* `sudo cp eccs2.service /etc/systemd/system/eccs2.service`
* `sudo systemctl daemon-reload`
* `sudo systemctl enable eccs2.service`
* `sudo crontab -u debian -e`
```bash
0 0 * * * /bin/bash /opt/eccs2/cleanAndRunEccs2.sh > /opt/eccs2/logs/eccs2cron.log 2>&1
```
# Run ECCS2
* `./runEccs2.py` or `./cleanAndRunEccs2.py`
# API Development Server # API Development Server
* `sudo apt install libapache2-mod-wsgi-py3 python3-dev`
* `sudo a2enmod wsgi`
* `cd ~/eccs2 ; ./api.py` * `cd ~/eccs2 ; ./api.py`
# API # API
...@@ -96,3 +120,7 @@ ...@@ -96,3 +120,7 @@
* `sudo a2ensite eccs2.conf` * `sudo a2ensite eccs2.conf`
* `sudo systemctl reload apache2.service` * `sudo systemctl reload apache2.service`
# UTILITY FOR WEB INTERFACE
The available dates are provided by the first and the last file created into the `output/` directory
<?php
$directory = "../output";
$files = scandir ($directory);
$firstFile = $files[3]; // [0] = '.' ; [1] = '..' ; [2] = '.gitignore'
$str2strip = array("eccs2_", ".log");
$firstDate = str_replace($str2strip, "", $firstFile);
$latest_ctime = 0;
$latest_filename = '';
$d = dir($directory);
while (false !== ($entry = $d->read())) {
$filepath = "{$directory}/{$entry}";
//Check whether the entry is a file etc.:
if(is_file($filepath) && filectime($filepath) > $latest_ctime) {
$latest_ctime = filectime($filepath);
$latest_filename = $entry;
}//end if is file etc.
}//end while going over files in excel_uploads dir.
$lastDate = str_replace($str2strip, "", $latest_filename);
?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.js" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.21/js/jquery.dataTables.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.21/css/jquery.dataTables.min.css"/>
<script type="text/javascript" src="script.js"></script>
<link href="style.css" rel="stylesheet" type="text/css" />
<meta charset=utf-8 /> <meta charset=utf-8 />
<script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.js" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.21/js/jquery.dataTables.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.21/css/jquery.dataTables.min.css"/>
<link href="style.css" rel="stylesheet" type="text/css" />
<title>eduGAIN Connectivity Check Service 2</title> <title>eduGAIN Connectivity Check Service 2</title>
</head> </head>
<body> <body>
...@@ -19,7 +37,7 @@ ...@@ -19,7 +37,7 @@
<input type="checkbox" name="status" value="OK">OK</input> <input type="checkbox" name="status" value="OK">OK</input>
<input type="checkbox" name="status" value="DISABLE">DISABLE</input> <input type="checkbox" name="status" value="DISABLE">DISABLE</input>
<button style="float:right;" onclick="getPastResults()">Go</button> <button style="float:right;" onclick="getPastResults()">Go</button>
<input style="float:right;" type="date" id="myDate" min="2020-07-03" max="<?php echo date("Y-m-d")?>" value="<?php echo date("Y-m-d")?>"/> <input style="float:right;" type="date" id="myDate" min="<?php echo $firstDate ?>" max="<?php echo $lastDate ?>" value="<?php echo $lastDate ?>"/>
</div> </div>
<hr> <hr>
<button id="btn-show-all-children" type="button">Expand All</button> <button id="btn-show-all-children" type="button">Expand All</button>
...@@ -39,5 +57,8 @@ ...@@ -39,5 +57,8 @@
</thead> </thead>
</table> </table>
</div> </div>
<script type="text/javascript" src="script.js" /></script>
</body> </body>
</html> </html>
// Global URL // Global URL
var url = "/eccs2/api/eccsresults?eccsdt=1"; //var url = "/eccs2/api/eccsresults?eccsdt=1";
var url = "/eccs2/api/eccsresults?eccsdt=1&date=" + document.getElementById("myDate").value;
var table; var table;
// use URL constructor and return hostname // use URL constructor and return hostname
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment