notesnook-sync-server icon indicating copy to clipboard operation
notesnook-sync-server copied to clipboard

How to expose services using ngnix or caddy

Open valantur opened this issue 1 year ago • 4 comments

I know the documentation on how to self-host is being written, but I couldn't help myself and tried to set this up on my own! Can anybody tell me how to properly expose the sync server, event server and auth server URLs using Caddy or Nginx? I believe the desktop client requires these three services to be published, is that right?

Thanks in advance!

valantur avatar Oct 30 '24 17:10 valantur

I just use nginx with a separate config for each subdomain

for example, here's my app subdomain (this is without https, since certbot takes care of that)

you can do the same thing for all the subdomains, just take note of which port you need to proxy for each subdomain, which are:

app: 5364 event: 7264 auth: 8264

optional subdomains/ports: attachments: 9000 monograph: 6264

server {
    server_name app.domain.com;

    location / {
        proxy_pass http://localhost:5264;
        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-Proto $scheme;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

    }
}

0xGingi avatar Oct 30 '24 20:10 0xGingi

That's a lot of ports to expose! Anyone tried running everything on 443 but with one virtual host per service?

guiand888 avatar Nov 30 '24 15:11 guiand888

I'm using caddy within docker and I'm hoping I can do something similar to:

notes.mydomain.net {
    import logs
    route /monograph* {
        reverse_proxy monograph-server:6264
    }
    route /auth* {
        reverse_proxy identity-server:8264
    }
    route /attachments* {
        reverse_proxy notesnook-s3:9000
    }
    route /* {
        @sse {
            header Accept text/event-stream
        }
        reverse_proxy @sse sse-server:7264
        reverse_proxy notesnook-server:5264
    }
}

But it will depend on if this would be supported?

NOTESNOOK_APP_PUBLIC_URL=https://notes.mydomain.net
# Description: This is the public URL for the monograph frontend.
# Required: yes
# Example: https://monogr.ph
MONOGRAPH_PUBLIC_URL=https://notes.mydomain.net/monograph
# Description: This is the public URL for the Authentication server. Used for generating email confirmation & password reset URLs.
# Required: yes
# Example: https://auth.streetwriters.co
AUTH_SERVER_PUBLIC_URL=https://notes.mydomain.net/auth
# Description: This is the public URL for the S3 attachments server (minio). It'll be used by the Notesnook clients for uploading/downloading attachments.
# Required: yes
# Example: https://attachments.notesnook.com
ATTACHMENTS_SERVER_PUBLIC_URL=https://notes.mydomain.net/attachments

SinisterSpatula avatar Mar 21 '25 19:03 SinisterSpatula

Plz take a look, i hope this would help: https://github.com/streetwriters/notesnook-sync-server/issues/20#issuecomment-2763248500

devkamiki avatar Mar 29 '25 09:03 devkamiki