KETSE / casebox

Casebox: Secure all your information and team communication in one place
https://www.casebox.org
216 stars 120 forks source link

Casebox and Filepreview/Download (Libreoffice&unoconv) - Ubuntu Server 14.04 #16

Closed lolziac closed 8 years ago

lolziac commented 8 years ago

Dear All,

I installed casebox on Ubuntu 14.04, but i'm encountering problems with file preview...Libreoffice and unoconv (I can't make it work...through casebox...I guess I'm missing something in the procedure ). Even though when I click on the file after I upload...it just shows the Edit window...I even can't download (see img).

casebox

If anybody who made it work on Ubuntu, please can you share the procedure with us, I really would appreciate some help, as when I try manually to convert files through the tools...everything works.

I followed these two Install Procedures: https://www.casebox.org/dev/install/ https://github.com/KETSE/casebox/wiki/How-to-install-Casebox-on-a-fresh-Ubuntu-14.04

Note: I downloaded unoconv from the source v7.0

Here are some details of my system.

#uname -a
Linux casebox 3.16.0-30-generic #40~14.04.1-Ubuntu SMP Thu Jan 15 17:43:14 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

=================================
CaseBox 1.9.498 (2015-07-27)
=================================

root@casebox:/var/www/html/casebox/httpsdocs/libx# ./unoconv --version
unoconv 0.7
Written by Dag Wieers <dag@wieers.com>
Homepage at http://dag.wieers.com/home-made/unoconv/

platform posix/linux
python 3.4.0 (default, Jun 19 2015, 14:20:21) 
[GCC 4.8.2]
LibreOffice 4.4.4.3
================================
root@casebox:# sudo su - www-data -s /bin/bash
www-data@casebox:/var/www/html/casebox/httpsdocs/libx# ./unoconv --listener &
www-data@casebox:# ps -ef | grep soffice
www-data  3135  3133  0 16:13 pts/0    00:00:00 /usr/lib/libreoffice/program/soffice.bin --headless --invisible --nocrashreport --nodefault --nologo --nofirststartwizard --norestore --accept=socket,host=127.0.0.1,port=2002,tcpNoDelay=1;urp;StarOffice.ComponentContext
www-data  3136  3135  0 16:13 pts/0    00:00:00 [soffice.bin] <defunct>

================================
root@casebox:# ls -la /usr/bin/python
lrwxrwxrwx 1 root root 7 Kor 27 20:13 /usr/bin/python -> python3
================================
root@casebox:/var/www/html/casebox/httpsdocs/libx# ./unoconv -f pdf temp.doc 
root@casebox:/var/www/html/casebox/httpsdocs/libx# ls -la *pdf
-rw-r--r-- 1 root root 35855 Kor 28 17:23 temp.pdf

Thanks, lolziac

lolziac commented 8 years ago

Dear All,

I have to confirm that this issue is happening also in CentOS 6 and 7. I guess something changed on the code/install script ...

From Ext JS UI I can upload the file...but no file preview or Download (same as on Ubuntu)

Whereas from terminal I can convert files with no issues...

================
[box]# whoami
apache

[box]# python /var/www/casebox/httpsdocs/libx/unoconv -v -f html -o /var/www/casebox/data/test/1_.html /var/www/casebox/data/test/test.odt
Input file: /var/www/casebox/data/test/test.odt
Selected output format: HTML Document (OpenOffice.org Writer) [.html]
Output file: /var/www/casebox/data/test/1_.html
===============

Can somebody try this new release and confirm that it works... Please follow the setup with install script https://www.casebox.org/dev/install/

Regards, lolziac

lolziac commented 8 years ago

Dear Community,

Definitively somethings is wrong on recent commit-changes. I tested the code backward and I found out that the latest code that is working is:

https://github.com/KETSE/casebox/commit/344e34bca8f69238fb65e0e0afcdd7190a674283

Commits on Jul 15, 2015
tvitalie authored 19 days ago
importing process consolidation
344e34bca8f69238fb65e0e0afcdd7190a674283

From this one till current the filepreview/download is not working: https://github.com/KETSE/casebox/commit/f348712488fb0f6eee8feb401a2dbbcc273b831a

I'll continue to find and narrow down where this issue is, but I would appreciate if somebody with more experience with casebox code can check this out ?!!

Regards, lolziac

tvitalie commented 8 years ago

Hi lolziac, I've just made a commit related to this issue. Can you please test and confirm if everything is ok?

Best regards.

lolziac commented 8 years ago

HI tvitalie,

NOTE: I'm trying now on CentOS (Ill try this also on Ubuntu) It seems better at least PDF/PNG files I can preview...but not yet the DOC/DOCX/EXCEL (I can only download them). When trying to preview doc/docx/excel I get this message:

Preview not available at this moment, please download the file.

If I go an check at the logs:

cat /var/www/casebox/logs/cb_fix_debug_log
2015-08-03 14:30:42: UNOCONV execution error, please check if python accesible through command line and if correctly specified in config.ini: "python" "/var/www/casebox/httpsdocs/libx/unoconv" -v -f html -o /var/www/casebox/data/files/fix/preview/3_.html /var/www/casebox/data/files/fix/preview/3_.docx

When I check on the folder /var/www/casebox/data/files/fix/preview/ I can see that file 3_.html is created but 0bytes (empty)

If I try to run the cmd manually with root and also apache user It will generate the html file with NO problem. I tried also to start the unoconv listener with apache user before uploading DOC/DOCX/EXCEL

-bash-4.1$ whoami
apache
-bash-4.1$ python /var/www/casebox/httpsdocs/libx/unoconv --listener&
-bash-4.1$ ps -ef | grep soffice
apache    2934  2932  1 16:30 pts/1    00:00:00 /opt/libreoffice4.4/program/soffice.bin --headless --invisible --nocrashreport --nodefault --nologo --nofirststartwizard --norestore --accept=socket,host=127.0.0.1,port=2002,tcpNoDelay=1;urp;StarOffice.ComponentContext
apache    2936  2934  0 16:30 pts/1    00:00:00 [soffice.bin] <defunct>
-bash-4.1$ ps -ef | grep unoconv
apache    2932     1  0 16:30 pts/1    00:00:00 /opt/libreoffice4.4/program/python.bin /var/www/casebox/httpsdocs/libx/unoconv --listener

Same issue...

Regards, lolziac

lolziac commented 8 years ago

Dear tvitalie,

I tested on Bare Ubuntu 14.04 Install again following the wiki: https://github.com/KETSE/casebox/wiki/How-to-install-Casebox-on-a-fresh-Ubuntu-14.04

I will list some things I did different from previous install and from the wiki (maybe you can update the wiki for others):

  1. I got libreoffice from apt repository. sudo apt-get install libreoffice
  2. I created an extra folder www-data in home directory and changed the path for the user sudo mkdir /home/www-data sudo chown -R www-data:www-data /home/www-data sudo usermod -d /home/www-data www-data
  3. during install I supplied python3 and not python (which is symlink to python2.7) php bin/install.php

and voila now is working ... on Ubuntu 14.04 (but still on Centos6 with changes nr 2 and 3...im having issues).

Hope it helps others.

Regards, lolz

tvitalie commented 8 years ago

Hi lolziac, So in conclusion the preview is failing because of issues related to unoconv, which rely on open office distribution.

Usually the command from logs, when run with same credentials as apache - points to the problem.

lolziac commented 8 years ago

Hi tvitalie,

After your latest commit, things for sure seems better and yes it seems the issue is with unoconv/python/libreoffice-openoffice paths ...

Furthermore another error I encounter and it is missing on how to install wiki is php5-curl I get this error

04-Aug-2015 12:57:49 UTC] PHP Fatal error:  Call to undefined function CB\Solr\curl_init() in /var/www/html/casebox/httpsdocs/classes/CB/Solr/Service.php on line 187
[04-Aug-2015 12:59:12 UTC] PHP Fatal error:  Call to undefined function CB\Solr\curl_init() in /var/www/html/casebox/httpsdocs/classes/CB/Solr/Service.php on line 187

To fix it please issue the following: sudo apt-get install php5-curl sudo service apache2 restart

Regards, lolz

lolziac commented 8 years ago

I'm closing this issue as it was resolved for Ubuntu 14.04...following the procedure that Is documented here. Regards, lolz