CADViewer / NextCloud

CAD viewing, markup and collaboration on NextCloud for AutoCAD, MicroStation and advanced raster graphics.
GNU Affero General Public License v3.0
23 stars 3 forks source link

Clarification on Editing Settings for CADViewer Integration in NextCloud AIO Docker Setup #50

Closed SinghNanak closed 1 year ago

SinghNanak commented 1 year ago

I am currently using Ubuntu 22.04 and have NextCloud AIO set up using Docker. I have a question regarding the process of editing the settings for CADViewer integration. Specifically, I would like to know whether I should make these edits inside the Docker container or on the Ubuntu host system. Could you please provide me with a step-by-step guide to clarify this?

CADViewer commented 1 year ago

Hello @nanaksingh13 , there are two things that needs to be done, possibly you have to change the permissions of the back-end CAD converter and folders where the conversion takes place, you can see that in: https://github.com/CADViewer/NextCloud/blob/main/README.md , all is happening in the /apps/ folder from NextCloud, so /apps/cadviewer. This will likely be inside your docker container. Secondly, the php scripts that CADViewer uses to communicate with the back-end needs to be properly redirected, therefore you may need to update the rewrite rules in the .htaccess file. (yes, we are due to make an updated user guide available on our site). Hope this helps, please get in touch as you move forward.

SinghNanak commented 1 year ago

I am getting confused. I download cad viewer from Appstore inside nextcloud and there is no cadviewer

0.0.0.0:443->443/tcp, :::443->443/tcp   nextcloud-aio-apache
root@user1:~# docker ps
CONTAINER ID   IMAGE                             COMMAND                  CREATED        STATUS                  PORTS                                                                                                                               NAMES
efe9b5e60cc4   nextcloud/aio-apache:latest       "/start.sh /usr/bin/…"   19 hours ago   Up 19 hours (healthy)   80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp                                                                                       nextcloud-aio-apache
7f6cac2c8896   nextcloud/aio-nextcloud:latest    "/start.sh /usr/bin/…"   19 hours ago   Up 19 hours (healthy)   9000/tcp                                                                                                                            nextcloud-aio-nextcloud
8f772d384ee0   nextcloud/aio-imaginary:latest    "imaginary -return-s…"   19 hours ago   Up 19 hours (healthy)                                                                                                                                       nextcloud-aio-imaginary
46ae01da4e9b   nextcloud/aio-clamav:latest       "/init"                  19 hours ago   Up 19 hours (healthy)   3310/tcp, 7357/tcp                                                                                                                  nextcloud-aio-clamav
14022d803ad9   nextcloud/aio-redis:latest        "start.sh"               19 hours ago   Up 19 hours (healthy)   6379/tcp                                                                                                                            nextcloud-aio-redis
ffb608503336   nextcloud/aio-postgresql:latest   "/start.sh"              19 hours ago   Up 19 hours (healthy)   5432/tcp                                                                                                                            nextcloud-aio-database
3d44c4625c77   nextcloud/aio-talk:latest         "start.sh /usr/bin/s…"   19 hours ago   Up 19 hours (healthy)   0.0.0.0:3478->3478/tcp, 0.0.0.0:3478->3478/udp, :::3478->3478/tcp, :::3478->3478/udp, 5349/tcp, 5349/udp                            nextcloud-aio-talk
41e616ce78a6   nextcloud/aio-collabora:latest    "/start-collabora-on…"   19 hours ago   Up 19 hours (healthy)   9980/tcp                                                                                                                            nextcloud-aio-collabora
f5e24a9b07f4   nextcloud/all-in-one:latest       "/start.sh /usr/bin/…"   20 hours ago   Up 20 hours (healthy)   0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp, 0.0.0.0:8443->8443/tcp, :::8443->8443/tcp, 9000/tcp   nextcloud-aio-mastercontainer
root@user1:~# docker exec -it 7f6cac2c8896 /bin/bash
bash-5.1# ls -al
total 188
drwxrwxrwt 16 www-data root      4096 May 31 12:37 .
drwxrwxr-x  1 www-data root      4096 May 26 09:49 ..
-rw-r--r--  1 www-data www-data  4388 May 31 12:38 .htaccess
-rw-r--r--  1 www-data www-data   101 May 31 12:37 .user.ini
drwxr-xr-x 47 www-data www-data  4096 May 31 12:37 3rdparty
-rw-r--r--  1 www-data www-data 19327 May 31 12:37 AUTHORS
-rw-r--r--  1 www-data www-data 34520 May 31 12:37 COPYING
drwxr-xr-x 50 www-data www-data  4096 May 31 12:37 apps
drwxr-xr-x  2 www-data www-data  4096 May 31 12:54 config
-rw-r--r--  1 www-data www-data  4095 May 31 12:37 console.php
drwxr-xr-x 23 www-data www-data  4096 May 31 12:37 core
-rw-r--r--  1 www-data www-data  6317 May 31 12:37 cron.php
drwxr-xr-x 19 www-data www-data  4096 Jun  1 04:16 custom_apps
drwxr-xr-x  2 www-data www-data  4096 May 31 12:38 data
drwxr-xr-x  2 www-data www-data 12288 May 31 12:37 dist
-rw-r--r--  1 www-data www-data   156 May 31 12:37 index.html
-rw-r--r--  1 www-data www-data  3456 May 31 12:37 index.php
drwxr-xr-x  6 www-data www-data  4096 May 31 12:37 lib
-rwxr-xr-x  1 www-data www-data   283 May 31 12:37 occ
drwxr-xr-x  2 www-data www-data  4096 May 31 12:37 ocm-provider
drwxr-xr-x  2 www-data www-data  4096 May 31 12:37 ocs
drwxr-xr-x  2 www-data www-data  4096 May 31 12:37 ocs-provider
-rw-r--r--  1 www-data www-data  3187 May 31 12:37 public.php
-rw-r--r--  1 www-data www-data  5597 May 31 12:37 remote.php
drwxr-xr-x  4 www-data www-data  4096 May 31 12:37 resources
-rw-r--r--  1 www-data www-data    26 May 31 12:37 robots.txt
-rw-r--r--  1 www-data www-data  2452 May 31 12:37 status.php
drwxr-xr-x  3 www-data www-data  4096 May 31 12:37 themes
drwxr-xr-x  2 www-data www-data  4096 May 31 12:37 updater
-rw-r--r--  1 www-data www-data   383 May 31 12:37 version.php
bash-5.1# cd apps
bash-5.1# ls -al
total 200
drwxr-xr-x 50 www-data www-data 4096 May 31 12:37 .
drwxrwxrwt 16 www-data root     4096 May 31 12:37 ..
drwxr-xr-x 11 www-data www-data 4096 May 31 12:37 activity
drwxr-xr-x  6 www-data www-data 4096 May 31 12:37 admin_audit
drwxr-xr-x  9 www-data www-data 4096 May 31 12:37 bruteforcesettings
drwxr-xr-x 12 www-data www-data 4096 May 31 12:37 circles
drwxr-xr-x  6 www-data www-data 4096 May 31 12:37 cloud_federation_api
drwxr-xr-x  7 www-data www-data 4096 May 31 12:37 comments
drwxr-xr-x  6 www-data www-data 4096 May 31 12:37 contactsinteraction
drwxr-xr-x  8 www-data www-data 4096 May 31 12:37 dashboard
drwxr-xr-x  9 www-data www-data 4096 May 31 12:37 dav
drwxr-xr-x 10 www-data www-data 4096 May 31 12:37 encryption
drwxr-xr-x  9 www-data www-data 4096 May 31 12:37 federatedfilesharing
drwxr-xr-x 10 www-data www-data 4096 May 31 12:37 federation
drwxr-xr-x 11 www-data www-data 4096 May 31 12:37 files
drwxr-xr-x 11 www-data www-data 4096 May 31 12:37 files_external
drwxr-xr-x  8 www-data www-data 4096 May 31 12:37 files_pdfviewer
drwxr-xr-x  8 www-data www-data 4096 May 31 12:37 files_rightclick
drwxr-xr-x 10 www-data www-data 4096 May 31 12:37 files_sharing
drwxr-xr-x  8 www-data www-data 4096 May 31 12:37 files_trashbin
drwxr-xr-x  7 www-data www-data 4096 May 31 12:37 files_versions
drwxr-xr-x  9 www-data www-data 4096 May 31 12:37 firstrunwizard
drwxr-xr-x 10 www-data www-data 4096 May 31 12:37 logreader
drwxr-xr-x  6 www-data www-data 4096 May 31 12:37 lookup_server_connector
drwxr-xr-x  6 www-data www-data 4096 May 31 12:37 nextcloud-aio
drwxr-xr-x  8 www-data www-data 4096 May 31 12:37 nextcloud_announcements
drwxr-xr-x  9 www-data www-data 4096 May 31 12:37 notifications
drwxr-xr-x  7 www-data www-data 4096 May 31 12:37 oauth2
drwxr-xr-x  9 www-data www-data 4096 May 31 12:37 password_policy
drwxr-xr-x 10 www-data www-data 4096 May 31 12:37 photos
drwxr-xr-x  8 www-data www-data 4096 May 31 12:37 privacy
drwxr-xr-x  7 www-data www-data 4096 May 31 12:37 provisioning_api
drwxr-xr-x  6 www-data www-data 4096 May 31 12:37 recommendations
drwxr-xr-x  8 www-data www-data 4096 May 31 12:37 related_resources
drwxr-xr-x  9 www-data www-data 4096 May 31 12:37 serverinfo
drwxr-xr-x 11 www-data www-data 4096 May 31 12:37 settings
drwxr-xr-x  8 www-data www-data 4096 May 31 12:37 sharebymail
drwxr-xr-x 10 www-data www-data 4096 May 31 12:37 support
drwxr-xr-x  9 www-data www-data 4096 May 31 12:37 survey_client
drwxr-xr-x 11 www-data www-data 4096 May 31 12:37 suspicious_login
drwxr-xr-x 10 www-data www-data 4096 May 31 12:37 systemtags
drwxr-xr-x  9 www-data www-data 4096 May 31 12:37 text
drwxr-xr-x 10 www-data www-data 4096 May 31 12:37 theming
drwxr-xr-x  8 www-data www-data 4096 May 31 12:37 twofactor_backupcodes
drwxr-xr-x 11 www-data www-data 4096 May 31 12:37 twofactor_totp
drwxr-xr-x 11 www-data www-data 4096 May 31 12:37 user_ldap
drwxr-xr-x  8 www-data www-data 4096 May 31 12:37 user_status
drwxr-xr-x  7 www-data www-data 4096 May 31 12:37 viewer
drwxr-xr-x  6 www-data www-data 4096 May 31 12:37 weather_status
drwxr-xr-x  8 www-data www-data 4096 May 31 12:37 workflowengine
CADViewer commented 1 year ago

Hello @nanaksingh13 , so NextCloud will have a folder called /apps/ which contains all the apps that are installed into NextCloud, so you need to locate that folder. FYI: I am running NextCloud on Ubuntu 20.04 WSL, and there the path structure is /var/www/html/(nextcloud)/apps/cadviewer. I can check with a developer who is running docker, but I think you will have to step inside the container image nextcloud/aio-nextcloud.

SinghNanak commented 1 year ago

will try, better if i know about AIO docker. I couldn't find it last time.

SinghNanak commented 1 year ago

@CADViewer waiting for your clarification

SinghNanak commented 1 year ago

any updates? how to configure in nextcloud AIO

kevmax1 commented 1 year ago

Hi @nanaksingh13, can you tell me exactly where you're having trouble getting Cadviewer to work on a docker AIO install?

SinghNanak commented 1 year ago

can you provide details for CADViewer installation on Docker AIO. I am using app store to install CADViewer. In which container, Excecute permission script is available?

kevmax1 commented 1 year ago

You need to connect interactively to the nextcloud docker container with the command docker exec -it id_of_container (you get the id with docker ps) and once inside you need to modify the .htaccess file with vim (you install it with these 2 commands: apt-get update, apt-get install vim) and the content to put in your .htaccess is as follows:

<IfModule mod_headers.c>
  <IfModule mod_setenvif.c>
    <IfModule mod_fcgid.c>
       SetEnvIfNoCase ^Authorization$ "(.+)" XAUTHORIZATION=$1
       RequestHeader set XAuthorization %{XAUTHORIZATION}e env=XAUTHORIZATION
    </IfModule>
    <IfModule mod_proxy_fcgi.c>
       SetEnvIfNoCase Authorization "(.+)" HTTP_AUTHORIZATION=$1
    </IfModule>
    <IfModule mod_lsapi.c>
      SetEnvIfNoCase ^Authorization$ "(.+)" XAUTHORIZATION=$1
      RequestHeader set XAuthorization %{XAUTHORIZATION}e env=XAUTHORIZATION
    </IfModule>
  </IfModule>

  <IfModule mod_env.c>
    # Add security and privacy related headers

    # Avoid doubled headers by unsetting headers in "onsuccess" table,
    # then add headers to "always" table: https://github.com/nextcloud/server/pull/19002
    Header onsuccess unset Referrer-Policy
    Header always set Referrer-Policy "no-referrer"

    Header onsuccess unset X-Content-Type-Options
    Header always set X-Content-Type-Options "nosniff"

    Header onsuccess unset X-Frame-Options
    Header always set X-Frame-Options "SAMEORIGIN"

    Header onsuccess unset X-Permitted-Cross-Domain-Policies
    Header always set X-Permitted-Cross-Domain-Policies "none"

    Header onsuccess unset X-Robots-Tag
    Header always set X-Robots-Tag "none"

    Header onsuccess unset X-XSS-Protection
    Header always set X-XSS-Protection "1; mode=block"

    SetEnv modHeadersAvailable true
  </IfModule>

  # Add cache control for static resources
  <FilesMatch "\.(css|js|svg|gif|png|jpg|ico|wasm|tflite)$">
    Header set Cache-Control "max-age=15778463"
  </FilesMatch>

  <FilesMatch "\.(css|js|svg|gif|png|jpg|ico|wasm|tflite)(\?v=.*)?$">
    Header set Cache-Control "max-age=15778463, immutable"
  </FilesMatch>

  # Let browsers cache WOFF files for a week
  <FilesMatch "\.woff2?$">
    Header set Cache-Control "max-age=604800"
  </FilesMatch>
</IfModule>

# PHP 7.x
<IfModule mod_php7.c>
  php_value mbstring.func_overload 0
  php_value default_charset 'UTF-8'
  php_value output_buffering 0
  <IfModule mod_env.c>
    SetEnv htaccessWorking true
  </IfModule>
</IfModule>

# PHP 8+
<IfModule mod_php.c>
  php_value mbstring.func_overload 0
  php_value default_charset 'UTF-8'
  php_value output_buffering 0
  <IfModule mod_env.c>
    SetEnv htaccessWorking true
  </IfModule>
</IfModule>

<IfModule mod_mime.c>
  AddType image/svg+xml svg svgz
  AddType application/wasm wasm
  AddEncoding gzip svgz
</IfModule>

<IfModule mod_dir.c>
  DirectoryIndex index.php index.html
</IfModule>

<IfModule pagespeed_module>
  ModPagespeed Off
</IfModule>

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{HTTP_USER_AGENT} DavClnt
  RewriteRule ^$ /remote.php/webdav/ [L,R=302]
  RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
  RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]
  RewriteRule ^remote/(.*) remote.php [QSA,L]
  RewriteRule ^(?:build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]
  RewriteRule ^\.well-known/(?!acme-challenge|pki-validation) /index.php [QSA,L]
  RewriteRule ^(?:\.(?!well-known)|autotest|occ|issue|indie|db_|console).* - [R=404,L]
</IfModule>

AddDefaultCharset utf-8
Options -Indexes
#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####

ErrorDocument 403 //
ErrorDocument 404 //
<IfModule mod_rewrite.c>
  Options -MultiViews
  RewriteRule ^core/js/oc.js$ index.php [PT,E=PATH_INFO:$1]
  RewriteRule ^core/preview.png$ index.php [PT,E=PATH_INFO:$1]
  RewriteCond %{REQUEST_FILENAME} !\.(css|js|svg|gif|png|html|ttf|woff2?|ico|jpg|jpeg|map|webm|mp4|mp3|ogg|wav|wasm|tflite)$
  RewriteCond %{REQUEST_FILENAME} !/core/ajax/update\.php
  RewriteCond %{REQUEST_FILENAME} !/core/img/(favicon\.ico|manifest\.json)$
  RewriteCond %{REQUEST_FILENAME} !/(cron|public|remote|status)\.php
  RewriteCond %{REQUEST_FILENAME} !/ocs/v(1|2)\.php
  RewriteCond %{REQUEST_FILENAME} !/robots\.txt
  RewriteCond %{REQUEST_FILENAME} !/(ocm-provider|ocs-provider|updater)/
  RewriteCond %{REQUEST_URI} !^/\.well-known/(acme-challenge|pki-validation)/.*
  RewriteCond %{REQUEST_FILENAME} !/richdocumentscode(_arm64)?/proxy.php$
  RewriteCond %{REQUEST_FILENAME} !/apps/cadviewer/converter/php/*\.*
  RewriteRule . index.php [PT,E=PATH_INFO:$1]
  RewriteBase /
  <IfModule mod_env.c>
    SetEnv front_controller_active true
    <IfModule mod_dir.c>
      DirectorySlash off
    </IfModule>
  </IfModule>
</IfModule>

and then you just have to follow the instructions in the doc to set permissions on the right file and folder

SinghNanak commented 1 year ago

thx will try it