Install JavaScript engine in Matrix test virtual machine


(Jackson Harold) #1

I've download the demo virtual machine of Matrix to test out some new features locally but the REST JS asset doesn't work because the VM has no JavaScript engine installed. Shouldn't the test VM have all non-premium features ready to go or am I missing a step?

 

I can log into to the system just fine and do things as expected but server side JS isn't one of them.

 

Can anyone explain how to install one of these engines (Spidermonkey, V8js) to get things going?

 

I have not touched the VM install in any way so it's still in the same state as provided by Squiz as a download.

 

Disclaimer: I don't know much about Linux admin, so apologies for being a bit dense in advance.


(Marcus Fong) #2

Ah... looks like the latest version of the VM only has SpiderMonkey 24, but Matrix is still configured for the old SpiderMonkey 1.7.

 

Edit /var/www/matrix/data/private/conf/tools.inc and change the line:

 

define('SQ_TOOL_JS_PATH', '/usr/bin/js');

 

to read:

 

define('SQ_TOOL_JS_PATH', '/usr/bin/js24');

 

Then try again (making sure your REST JS assets are set to SpiderMonkey and not V8JS).


(Nick Papadatos) #3

mfong,
How do I get to the above to make the changes from define(‘SQ_TOOL_JS_PATH’, ‘/usr/bin/js’);
to read
define(‘SQ_TOOL_JS_PATH’, ‘/usr/bin/js24’);
??

I don’t have linux on my machine/PC.
I currently have Squiz Matrix v5.4.0.3 VM

Thanks


(Bart Banda) #4

You basically have to find the following file on the VM server: /var/www/matrix/data/private/conf/tools.inc

Basically in the installation directory of Matrix, and then edit the file via a text/code editor and save. That should be it.

Also double check that the server actually has a dir/file under ‘/usr/bin/js24’.


(Nick Papadatos) #5

Thanks Bart
I have gone to C:\Users\xxxxxx\VirtualBox VMs\matrixdemo.squiz.net but but can’t find /var/www/matrix/data/private/conf/tools.inc ??

Thanks
Nick


(Marcus Fong) #6

When Bart said “on the VM server” he meant “inside the (Linux) VM”, not on your Windows drive.


(Nick Papadatos) #7

I don’t have Linux nor do I have a Linux background. Maybe in the future the Squiz Matrix Virtual Machine downloads could have the JS engine enabled?

Thanks
Nick


(Marcus Fong) #8

Yes, it seems to have been an oversight in the VM where the SpiderMonkey version was upgraded at some point, but tools.inc wasn’t updated to match.


(David Schoen) #9

I’d encourage anyone manually installing the JS engine to enable V8JS instead of SpiderMonkey.

In the current (5.4.0.3) public demo VM that can be done by just installing the package (it’s in our Squiz repos, but they’re enabled in the VM):

[root@matrixdemo ~]# yum install -y php54-php-pecl-v8js
[...]
Installed:
  php54-php-pecl-v8js.x86_64 0:0.1.3-2.el6

Dependency Installed:
  libicu.x86_64 0:4.2.1-14.el6    v8.x86_64 1:3.14.5.10-9.el6

Complete!

Once that’s done php-fpm needs to be restarted:

[root@matrixdemo ~]# service php-fpm restart
Stopping php-fpm:                                          [  OK  ]
Starting php-fpm:                                          [  OK  ]

V8JS should “just work” at this point, e.g a basic hello world SSJS:

<script runat="server">
print("hello world");
</script>

Should render server side and contain the plain string “hello world” if checked via the browsers view-source option.

I’ll try to ensure we have V8JS correctly installed in any future VMs.