Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-site hosting #132

Open
DanielHeath opened this issue Apr 26, 2018 · 5 comments
Open

Multi-site hosting #132

DanielHeath opened this issue Apr 26, 2018 · 5 comments

Comments

@DanielHeath
Copy link
Collaborator

I'd like to let my friends use my server for their own wikis.

I could just run a bunch of copies of cowyo on different ports, but I'm already low on RAM.

One alternative would be to refactor cowyo to support running multiple sites alongside one another.

This would be a pretty invasive change (getting rid of all the global variables), so I'd want to be sure it's welcome before trying it.

@schollz
Copy link
Owner

schollz commented Apr 26, 2018

I think that would be a great change - I always like to move towards encapsulating the data structures.

This would definitely be a cowyo 3.0 change, so there could be some heavy refactoring if you see fit. I know there are places I'd like to improve still (templating, the switches in the / handler), so I'd be happy to work on this too.

@DanielHeath
Copy link
Collaborator Author

I think it'll need a configuration file to meaningfully support it. I propose the following format (with one or two wishful features like letsencrypt support):

defaults:
  cookieSecret: "EZUvlyegpu3+4t4cC2X3f7GzsLZ+wtST67qoLuErpugJz06ZIpdDHEjcMxR+XOLM"
parentDataDir: "root_data"
sites:
  "nerdy.party:80":
    dataDir: "somewhere else"
    TLS:
      certPath: ""
      keyPath: ""
      port: 443
    theme: "custom.css"
    defaultPage: "welcome"
    allowInsecureMarkup: true
    defaultLockPin: "1234"
    debounceSave: 600
    diary: true
    accessCode: "correct horse battery staple"
    fileUploadsAllowed: true
    maxFileUploadMb: 6
  "cowyo.com:80":
    # dataDir: "defaults to root_data/cowyo.com:80"
    allowInsecureMarkup: false
    fileUploadsAllowed: false
    TLS:
      letsEncrypt: true
      port: 443
  "*:80":
    # dataDir: "defaults to root_data/<domain>:<port>"
    # Setting '*:80' lets you host arbitrary wikis on port 80
    cookieSecret: "ASADFGKLJSH+4t4cC2X3f7GzsLZ+wtST67qoLuErpugJz06ZIpdDHEjcMxR+XOLM"

@schollz
Copy link
Owner

schollz commented Apr 30, 2018

@DanielHeath I think that looks great. I'm not sure how to do letsEncrypt (I have Caddy do that stuff for me), but I'm sure that there is a Go library for it

@DanielHeath
Copy link
Collaborator Author

If you're not bothered about formats I might do it with toml instead - easier on the eyes.

@schollz
Copy link
Owner

schollz commented May 2, 2018

Oh yeah, definitely toml is a plus. I thought maybe you preferred yaml!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants