scirius icon indicating copy to clipboard operation
scirius copied to clipboard

Compilation from source gives strange layout

Open KoffieNu opened this issue 6 years ago • 18 comments

Hi, I'me attempting to get scirius running on CentOS 7.5 and although I managed to get something up and running, the user interface is not working as expected. I'm not experienced in application development (especially node.js application), so I don't exclude me messing up somewhere, but I find it strange that the hunt interface is wirking as expected, but the main page and administration isn't. The system where it's supposed to land is an isolated, unconnected, system, so I expected the method of getting it there could be the cause. Just tested it on a connected, Debian, system, and I get the same results. Systems:

  • code gatherer (and debian test system): Debian buster, latest updates (yesterday), Lenovo P50
  • target system: RedHat 7.5 vm, minimal install

Method of deployment:

  1. get code from github
  2. follow manual https://scirius.readthedocs.io/en/latest/installation-ce.html#installing-scirius-ce
  3. do pip download on gatherer, move python install on target system from webbased directory --no-index, find-links,...
  4. npm install modules as described
  5. Get missing dependencies with in both main and hunt dir: npm list --depth=9999 2>&1 | awk '/^npm ERR! missing:/ { print $4 }' | awk -F'@' '{ print $1 }' | sort -u | xargs npm install
  6. npm run build in hunt dir
  7. tar complete scirius dir, move to target, unpack
  8. configure as described in manual

Expected result:

  • Working web interface with consistent behaviour throughout the enabled sections.

Result found:

  • main page has a non working header. ('on mouse over' makes text darker, drop-down menu doesn't work (https://jan.huijsmans.nu/tmp/scirius/3.2.0-index.png)
  • administration page has no layout (css missing?), however, all links work. (https://jan.huijsmans.nu/tmp/scirius/3.2.0-administration.png)
  • Hunt page, works completely as expected (https://jan.huijsmans.nu/tmp/scirius/3.2.0-hunt.png)

I get the same result on both systems, the Debian and the CentOS system. Screenshots are taken from Debian with the 3.2.0 version. (current state of the master tree last pull today about 13:00 UTC)

Browser used:

  • Debian: Chrome 75.0.3770.100 (Official Build) (64-bit)
  • CentOS (Windows Client):
    • IE 11.0.9600.19362
    • Chrome 69.0.3497.100 (Official Build) (64-bit)

Versions tested:

  • 3.2.0 (master in current codebase)
  • 3.1.0 (tag 3.1.0)

All environments and versions give the same issue, so I'm concluding that it's either the code or me messing up on the deployment. (kinda expecting the latter, pevma on irc channel SELKS asked me to post an issue) When it's me, I'm overlooking something in the manual (did the webpack) or a step is missing which is logical for node.js developers.

KoffieNu avatar Jun 28 '19 16:06 KoffieNu

Does anything happen if you clear the full browser cache on Chrome/FF ? for IE I know it could be tricky.

pevma avatar Jun 30 '19 07:06 pevma

Nop, nothing, not even clearing all user settings. Looks like the index page gets another header then the hunt page.

KoffieNu avatar Jul 01 '19 08:07 KoffieNu

Are you sure you have setup STATIC_ROOT correctly? I had the same problem but fixed it by adding the following to local_settings.py (in the root directory of the project). Replace 'static' with the directory the static files are stored if you don't store them in the directory 'static'.

import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

jorgenbele avatar Jul 01 '19 12:07 jorgenbele

The difference between the scirius and hunt environment I can think of is that the hunt page needs an additional run of the build script after npm installs the modules. It looks like that build.js run ties all the code and loose npm modules into 1 nice package. I'm trying to compare the layout with the debian iso and there the 3.1.0 version looks like I expect it to. On the Debian iso it's running in gunicorn.

KoffieNu avatar Jul 01 '19 14:07 KoffieNu

@jorgenbele Thanks for the tip, the index page looks a bit better. BTW should the local_settings.py be in / (relative of the scirius project) or the scirius subdir? (same level as hunt) BTW administration intrerface is still missing all it's layout... at least I have a kind of a clue in which direction to look.

KoffieNu avatar Jul 01 '19 15:07 KoffieNu

@KoffieNu Np. It should be in / (root of the scirius project).

jorgenbele avatar Jul 01 '19 16:07 jorgenbele

The value of STATIC_ROOT can be any valid directory on your system to which you have write access. After setting the value to something reasonable like basedir /static as @jorgenbele suggested, you must run

python manage.py collectstatic

This will copy all static files to the right directory on the format that it expects Make sure you have already build the static files with

~$ webpack

and

~$ cd hunt
~/hunt$ npm run build

Potrik98 avatar Jul 02 '19 07:07 Potrik98

It seems we need a doc update in the case - correct ?

-- Regards, Peter Manev

On 2 Jul 2019, at 10:19, Potrik98 [email protected] wrote:

The value of STATIC_ROOT can be any valid directory on your system to which you have write access. After setting the value to something reasonable like basedir /static as @jorgenbele suggested, you must run

python manage.py collectstatic This will copy all static files to the right directory on the format that it expects Make sure you have already build the static files with

~$ webpack and

~$ cd hunt ~/hunt$ npm run build — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

pevma avatar Jul 02 '19 07:07 pevma

That would probably be wise. #149 adds a default value to STATIC_ROOT, but

python manage.py collectstatic

would have to be run regardless.

It seems we need a doc update in the case - correct ? -- Regards, Peter Manev On 2 Jul 2019, at 10:19, Potrik98 @.***> wrote: The value of STATIC_ROOT can be any valid directory on your system to which you have write access. After setting the value to something reasonable like basedir /static as @jorgenbele suggested, you must run python manage.py collectstatic This will copy all static files to the right directory on the format that it expects Make sure you have already build the static files with ~$ webpack and ~$ cd hunt ~/hunt$ npm run build — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

Potrik98 avatar Jul 02 '19 08:07 Potrik98

See #179

Potrik98 avatar Jul 02 '19 09:07 Potrik98

I just noticed I get errors in npm install due to missing bdist_wheel command. package python-wheel is a dependency. It's probably a package recommended by either python-dev or python-pip. However, when someone has the lines below in apt.conf, they won't get installed on a debian system.

APT::Install-Recommends "0";
APT::Install-Suggests "0";

CentOS doesn't have the dependency.

KoffieNu avatar Jul 02 '19 10:07 KoffieNu

Do you mind doing a pull request to adjust the install instructions to the scirius-3.1.0 tag ?

pevma avatar Jul 02 '19 12:07 pevma

Do you mind doing a pull request to adjust the install instructions to the scirius-3.1.0 tag ?

I don't quite understand. Could you explain how this is different from what I did in #179 ?

Potrik98 avatar Jul 02 '19 13:07 Potrik98

No - that's what i had in mind.Thanks!

pevma avatar Jul 02 '19 13:07 pevma

I added the local_config.py (changed the BASE_DIR to os.path.dirname(file)so static ends up in the project dir, not outside it), the index page looks a tad better, but still the top bar doesn't respond and rules subdir is missing it's style sheet (css). The Hunt section had it's own build, rules doesn't. Should rules build be triggered from something in the root dir? (or by a tool that I'm missing?) Could it be that the layout is a problem when one of the backend components isn't configured correctly?

The result I get: https://jan.huijsmans.nu/tmp/scirius/Scirius_3.2.0_on_CentOS.png The result I hope to get (layout wise to start): https://jan.huijsmans.nu/tmp/scirius/Scirius_3.1.0_on_Selks_Debian.png

KoffieNu avatar Jul 03 '19 08:07 KoffieNu

I finally managed to build a working scirius. The main requirement is Debian Stretch. Didn't manage to get something looking as expected with Debian Buster or CentOS 7.

After build, you can tar the tree on Debian and untar on CentOS (and do the pip install) and it'll look as expected and I hope it'll work as well. Needs to be tested.

KoffieNu avatar Jul 19 '19 13:07 KoffieNu

Thank you for your feedback ! What problems / errs did you encounter in Buster ?

-- Regards, Peter Manev

On 19 Jul 2019, at 15:23, Jan Huijsmans [email protected] wrote:

I finally managed to build a working scirius. The main requirement is Debian Stretch. Didn't manage to get something looking as expected with Debian Buster or CentOS 7.

After build, you can tar the tree on Debian and untar on CentOS (and do the pip install) and it'll look as expected and I hope it'll work as well. Needs to be tested.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

pevma avatar Jul 20 '19 23:07 pevma

Sorry for the late response. I was getting the same issues with buster as with compilation on CentOS, layout 'strange' due to some dependencies missing or getting nodejs modules that weren't compatible with the code.

Looks like the build of scirius (long ago) relied on Stretch and defaults of the npm/pip packages. I have to admit we abandoned the route to have scirius 'compiled' on Debian and then used on CentOS and switched to evaluating the EE version to see if that would help.

KoffieNu avatar Nov 18 '19 15:11 KoffieNu