Skip to content

Commit 7980c10

Browse files
authored
Merge pull request #13 from seamplex/feature/check
check deps and check
2 parents 3864bd2 + a416eec commit 7980c10

6 files changed

Lines changed: 89 additions & 8 deletions

File tree

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
SunCAE is a web-based front end and a cloud-based back end to perform finite-element calculations directly on the browser.
1010

11-
* The front end is an HTML client with plain vanilla javascript code (i.e. no Angular, no React, not even jQuery) that provide interactivity by sending JSON-based AJAX request to the server backe end.
12-
* The back end is written in PHP and responds to the client requests by creating the input files, executing the appropriate binaries and returning back 3D data to the client.
11+
* The front end is an HTML client with plain vanilla javascript code (i.e. no Angular, no React, not even jQuery) that provide interactivity by sending JSON-based AJAX request to the server back end.
12+
* The back end is written in PHP and responds to the client requests by creating the input files, executing the appropriate binaries and returning back 3D data to the client (browser).
1313

1414
Both front end and back ends are free software, released under the terms of the [AGPLv3](https://www.gnu.org/licenses/agpl-3.0.en.html). See the [licenses table](LICENSES.md) and [licensing details](#licensing) below for more information.
1515

@@ -66,6 +66,9 @@ You can use SunCAE either by...
6666
6767
For more detailed instructions including setting up production web servers and using virtualization tools (e.g. docker and/or virtual machines) read the [installation guide](doc/INSTALL.md).
6868
69+
> [!TIP]
70+
> If you have trouble getting SunCAE up and running in your server, please state your situation in the [community](https://github.com/seamplex/suncae/discussions).
71+
6972
7073
### Configuration
7174

deps.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,18 @@ for i in wget tar unzip python3; do
1919
fi
2020
done
2121

22-
# create gitignored directories
23-
mkdir -p deps bin
24-
2522
# this one needs to be either world writable or owned by the user running the web server
2623
# we start with 0777 but a sane admin would change it back to 0744 (or less)
2724
if [ ! -d data ]; then
2825
mkdir -p data
2926
chmod 0777 data
3027
fi
3128

29+
# mark that deps.sh has been run (not that it succeeded yet)
30+
touch data/deps-run
31+
32+
# create gitignored directories
33+
mkdir -p deps bin
3234

3335

3436
# Function to compare versions
@@ -44,3 +46,6 @@ version_ge() {
4446
. meshers/gmsh/deps.sh
4547
. solvers/feenox/deps.sh
4648
. solvers/ccx/deps.sh
49+
50+
# mark that deps.sh has been succeeded
51+
touch data/deps-ok

html/check.php

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
<?php
22

3+
function check_error($level = 255) {
4+
?>
5+
6+
<p>
7+
There is something off with your setup.
8+
Please post these results
9+
</p>
10+
11+
<?php
12+
exit($level);
13+
}
14+
315
// --- data dir ----------------------------------
416
$data_dir = __DIR__ . "/../data";
517
echo "[info] data_dir is {$data_dir}<br>\n";
@@ -195,6 +207,34 @@
195207
}
196208

197209
// TODO: check python and binary versions match
198-
199-
200210
}
211+
212+
213+
// feenox
214+
if (file_exists("{$bin_dir}/feenox")) {
215+
echo "[good] feenox binary exists<br>\n";
216+
echo "[info] " . shell_exec("ls -la {$bin_dir}/feenox") . "<br>\n";
217+
} else {
218+
echo "[error] feenox binary does not exist<br>\n";
219+
exit(19);
220+
}
221+
$exec_output = [];
222+
exec("{$bin_dir}/feenox --version 2>&1", $exec_output, $err);
223+
// TODO: check version is good enough
224+
if ($err == 0) {
225+
echo "[good] feenox version is {$exec_output[0]}<br>\n";
226+
} else {
227+
echo "[error] feenox binary does not work<br>\n";
228+
for ($i = 0; $i < count($exec_output); $i++) {
229+
echo "[info] {$exec_output[$i]}<br>\n";
230+
}
231+
exit(20);
232+
}
233+
234+
// great!
235+
touch("{$data_dir}/check-ok");
236+
?>
237+
238+
<p>
239+
[good] all set! <a href="<?=$_SERVER['HTTP_REFERER']?>">Proceed to SunCAE</a>
240+
</p>

html/index.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,21 @@
66
include("../conf.php");
77
include("../auths/{$auth}/auth.php");
88
include("common.php");
9+
10+
if (file_exists("{$data_dir}/deps-run") == false) {
11+
echo "run ./deps.sh first, see installation instructions";
12+
exit();
13+
}
14+
15+
if (file_exists("{$data_dir}/deps-run") == false) {
16+
echo "./deps.sh did not succeed, ask for help";
17+
exit();
18+
}
19+
20+
if (file_exists("{$data_dir}/check-ok") == false) {
21+
header("Location: check.php");
22+
exit();
23+
}
24+
925
include("case.php");
1026
include("../uxs/{$ux}/index.php");

html/new/index.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,21 @@
66
include("../../conf.php");
77
include("../../auths/{$auth}/auth.php");
88
include("../common.php");
9+
10+
if (file_exists("{$data_dir}/deps-run") == false) {
11+
echo "run ./deps.sh first, see installation instructions";
12+
exit();
13+
}
14+
15+
if (file_exists("{$data_dir}/deps-run") == false) {
16+
echo "./deps.sh did not succeed, ask for help";
17+
exit();
18+
}
19+
20+
if (file_exists("{$data_dir}/check-ok") == false) {
21+
header("Location: ../check.php");
22+
exit();
23+
}
24+
25+
926
include("../../uxs/{$ux}/new.php");

solvers/feenox/deps.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/false
22

33
feenox_version=1.2.1
4-
feenox_version_min=1.72
4+
feenox_version_min=1.72 # minimum version that supports MESH in PROBLEM
55

66
# feenox
77
# Function to extract version from binary

0 commit comments

Comments
 (0)