syncloud / platform

Run popular services on your device with one click
https://syncloud.org
GNU General Public License v3.0
396 stars 40 forks source link

Web hosting through Syncloud? Feature request #536

Closed chegeiser closed 1 year ago

chegeiser commented 4 years ago

It would be great to be able to harness Syncloud SSL cert processing to be able to set up additional custom webpages/web apps at custom sub domains. For example, if I own myaddress.com and want to host mywebapp.myaddress.com I’d like to use Syncloud to set this up. This could be hosted on the Syncloud file server or on another file server behind my firewall with Syncloud pointing to it.

Is this a possible new feature for Syncloud?

Thank you!

cyberb commented 4 years ago

Currently domain names are automatically mapped to a http web socket.

[name] => /var/snap/[name]/common/web.socket

For example a request to test123.[syncloud domain] is forwarded to /var/snap/test123/common/web.socket

https://github.com/syncloud/platform/blob/master/config/nginx/public.conf#L135

So all you need to do is run a webserver of your choice and listen on a socket file.

chegeiser commented 4 years ago

Would there be a way to harness Syncloud’s ssl creation for this custom address?

On Aug 23, 2020, at 9:08 AM, Boris Rybalkin notifications@github.com wrote:

 Currently domain names are automatically mapped to a http web socket.

[name] => /var/snap/[name]/common/web.socket

For example a request to test123.[syncloud domain] is forwarded to /var/snap/test123/common/web.socket

https://github.com/syncloud/platform/blob/master/config/nginx/public.conf#L135

So all you need to do is run a webserver of your choice and listen on a socket file.

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

cyberb commented 4 years ago

Right, https certificate is actually not wildcard right now so it will not cover random app names.

Wildcard support should arrive after this ticket (https://github.com/syncloud/platform/issues/461).

Another question, do you want to host only static files or alsp dynamic like php? If only static probably there is some.app wich simplifies static file hpsting which we can package as an app.

chegeiser commented 4 years ago

My web app syncs data to CouchDB. Currently this is not hosted on the Syncloud device, but leveraging the wildcard ssl cert would be very useful. I could still keep CouchDB on another device and have the webhook point to that machine.

On Aug 24, 2020, at 12:35 AM, Boris Rybalkin notifications@github.com wrote:

 Right, https certificate is actually not wildcard right now so it will not cover random app names.

Wildcard support should arrive after this ticket (#461).

Another question, do you want to host only static files or alsp dynamic like php? If only static probably there is some.app wich simplifies static file hpsting which we can package as an app.

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

cyberb commented 4 years ago

If certificate is the only problem should we close the request?

chegeiser commented 4 years ago

I think so, as long as the outline below is accurate.

  1. Currently can edit platform/config/nginx/public.conf to add custom web app subdomain name: [test123] => /var/snap/[name]/common/web.socket and nginx will then point that subdomain to /var/snap/test123/common/web.socket
  2. Support for ssl wildcard for subdomains will be added per ticket #461.
cyberb commented 4 years ago

There is no need to edit anything, name to web socket is already dynamic in the config.

chegeiser commented 4 years ago

Got it. When I look at the web.socket files for installed apps (like Gogs, Files, etc) the web.socket file is empty. How do I get thisapp.mydomain.com to direct to an index.html file like `/var/snap/thisapp/common/index.html'

cyberb commented 4 years ago

web.socket file is a a special unix domain socket created by a web server (of test app) for serving files. You will have to start a web server (nginx for example) and listen on this file. Then you can configure this web server to serve your files.

Example of an app nginx config: https://github.com/syncloud/users/blob/master/config/nginx.conf#L25

chegeiser commented 4 years ago

So it can’t be served by the nginx instance running all the Syncloud apps?

My web app is static and is all in one index.html file. I was hoping to just have nginx point to /var/snap/myapp/common/index.html

On Aug 24, 2020, at 9:43 PM, Boris Rybalkin notifications@github.com wrote:

 web.socket file is a a special unix domain socket created by a web server (of test app) for serving files. You will have to start a web server (nginx for example) and listen on this file. Then you can configure this web server to serve your files.

Example of an app nginx config: https://github.com/syncloud/users/blob/master/config/nginx.conf#L25

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

cyberb commented 3 years ago

Platform nginx is only service its web files under /snap/platform/current/www but this is read-only file system for security reasons.

You could probably change nginx config to add another location as a test (it will reset every system upgrade)

Ideally we can find some open-source project that simplifies static html hosting and uploading of hosted files using http protocol, package it as an app called www and that will be nice www.[device] domain name with some custom user html.

cyberb commented 3 years ago

Or you run nginx with a simple config to serve files from where ever you want and listen on any name you like.

chegeiser commented 3 years ago

The first option sounds great as it would provide the simplest method for users posting their own static pages using Syncloud as a tool to do that. The second option could work, but does require the user to really understand what they are doing. (I fall in the category of partially understanding some of what is needed to meet option 2).

cyberb commented 3 years ago

One more thing, existing tools like WordPress can actually serve static html files, have you tried that:

https://blog.hubspot.com/website/upload-html-file-to-wordpress

cyberb commented 3 years ago

WordPress login is /wp-login.php For example: https://wordpress.[device].syncloud.it/wp-login.php

I think they had a button before but not now, somehting must have changed in the latest update.