etesync / etesync-web

An EteSync web client
https://www.etesync.com
GNU Affero General Public License v3.0
243 stars 30 forks source link

How to use this with an existing installation? #250

Closed ItsIgnacioPortal closed 1 year ago

ItsIgnacioPortal commented 1 year ago

The guide for the etesync server recommends that we use this stack for production:

the web client <-> Nginx <-> the socket <-> uvicorn <-> fastapi/Django

How can etesync-web be deployed with this stack? I've tried to extract the files in /home/pinkdev1/etesync/etesync-web and then adding an alias to the main server block but that doesn't work:

# etebase_nginx.conf

# the upstream component nginx needs to connect to
upstream etebase {
    # server unix:///tmp/etebase_server.sock; # for a file socket
    server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}

# configuration of the server
server {
    # the port your site will be served on
    listen      8000 ssl;
    # the domain name it will serve for
    server_name internal.etesync.hax.vip etesync.hax.vip; # substitute your machine's IP address or domain name
    charset     utf-8;

    #SSL
    ssl_certificate /home/pinkdev1/etebase/cert/server.crt;
    ssl_certificate_key /home/pinkdev1/etebase/cert/server.key;

    # max upload size
    client_max_body_size 75M;   # adjust to taste

    location /static/ {
        alias /home/pinkdev1/etesync/static; # Project's static files
    }

    location /web/ {
        alias /home/pinkdev1/etesync/etesync-web; # Web interface  <----- THIS
     }

    location / {
        proxy_pass https://etebase;

        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Host $server_name;
    }
}

Going to https://internal.etesync.hax.vip:8001/web/ just shows me a 404 not found page. How can I set this up? I don't want to have to run another web server when I already have an nginx instance

ItsIgnacioPortal commented 1 year ago

nvm I figured it out. You just have to add this to the bottom of the nginx config file:

server {
    # the port your site will be served on
    listen      8002;
    # the domain name it will serve for
    server_name internal.etesync.hax.vip; # substitute your machine's IP address or domain name
    charset     utf-8;

    # Uncomment this to enable access logs
    # access_log /home/pinkdev1/web-access-log.log;

    location / {
        alias /home/pinkdev1/etebase/etesync-web/;
    }
}

And the contents of the zip should be in /home/pinkdev1/etebase/etesync-web/

Don't forget to run sudo service nginx reload after modifying the config file!