ishubin / schemio

Web based diagramming app that lets you build interactive diagrams and prototypes
https://schem.io
Mozilla Public License 2.0
89 stars 3 forks source link

How to run in a subfolder #703

Closed kabachello closed 1 month ago

kabachello commented 3 months ago

First of all, thank you for this impressive work!

I was easily able to run the app with local file storage. However, I would like to place it in a subfolder of my server. So instead http://localhost/ I would like it to be accessible via http://localhost/schemio/.

I see, it is pretty easy to modify the assetsPath and the rootPath, but I was unable to find a way to prefix the API calls with a subfolder: e.g. Instead of /v1/fs I need schemio/v1/fs? Is there a way to do this somehow?

MimikFc7 commented 3 months ago

I have the same trouble

ishubin commented 3 months ago

Hi @kabachello, thanks for your feedback! Yes, currently this is not possible. Could you please tell me what is the reason you want to have this? If you want to have other webapps on the same port and have schemio in the /schemio prefix I would suggest to put it behind an nginx, HAProxy or any other load balancer. Something like this in nginx should do the trick:

upstream schemio {
    server localhost:4010;
}

server {
    location /schemio {
        proxy_pass http://schemio;
    }
}

@MimikFc7 also could you please describe your use case?

MimikFc7 commented 2 months ago

Hi @kabachello, thanks for your feedback! Yes, currently this is not possible. Could you please tell me what is the reason you want to have this? If you want to have other webapps on the same port and have schemio in the /schemio prefix I would suggest to put it behind an nginx, HAProxy or any other load balancer. Something like this in nginx should do the trick:

upstream schemio {
    server localhost:4010;
}

server {
    location /schemio {
        proxy_pass http://schemio;
    }
}

@MimikFc7 also could you please describe your use case?

Hello, this is not working because schemio has link to other folders like as "assets" and this links started with /assets and when we use proxy_pass, then all assets does not load, and in my server have some other projects and folder assets busy

ishubin commented 2 months ago

@MimikFc7 ah, you are right! I see the problem now. Will try to address it soon

ishubin commented 2 months ago

@kabachello @MimikFc7 I have finally implemented custom route prefix in Schemio and release the new version 0.18.2 It works by specifying the ROUTE_PREFIX env variable.

e.g.

docker run -v "$(pwd):/opt/schemio" -p 4010:4010 -e FS_ROOT_PATH=/opt/schemio -e ROUTE_PREFIX=/schemio -e SERVER_PORT=4010 binshu/schemio:latest

Also documented this option here https://github.com/ishubin/schemio?tab=readme-ov-file#configuration-of-server-based-version-of-schemio

Please let me know if it works or if there are any issues with it. It took a while as I had to implement the propagation of the route prefix from the server to every part of the frontend that references any resources, so I could have missed something.

kabachello commented 3 weeks ago

@ishubin , thank you very much for the update! Works for me perfectly!