top | item 30676595

Show HN: I built an open-source web hosting platform for static sites

217 points| symkat | 4 years ago |github.com | reply

HI Hacker News!

I’m very excited to show you this project I have been working on, MarkdownSite.com.

For folks who interact with the website, it is a web hosting platform where you can add your repository and have a website built from the `public/` directory. Files in `site/` with an `.md` extension are rendered from markdown to HTML, and the website is then available at a random subdomain.

For folks that set up their own instance, it can also become a framework for customized building. The entire project is open source and I tried my best to document and explain the structure of the machines and how they interact in various mermaid graphs in the readme files under the `devops/` folder.

There is still a lot of work to be done, I hope that you find this useful. It's been super fun to work on!

38 comments

order
[+] HeckFeck|4 years ago|reply
Sweet, a roll-your-own Geocities but in Markdown! I'd like it if this approach took off for personal websites/blogs/social media. Maybe share it with some of those lists of self-hosted alternatives? Like here: https://github.com/awesome-selfhosted/awesome-selfhosted

I've actually been working on my own static website builder in Perl too - though it is nowhere near as sophisticated as a whole hosting platform. Being able to feed these beasts directories of text files, hitting enter and watching it do all the work (using your work) is a pleasure all on its own.

[+] symkat|4 years ago|reply
Thanks! I would love if this approach took off too. I think it could be pretty good — the friend who runs networking stuff could give people access to hosting and use simple tools, and you get a lot of little hosts! Let me know if there is anything I can do to MarkdownSite to make it easier to host static sites your builder makes. I’ll check out that repo, thank you for the recommendation!
[+] blitzar|4 years ago|reply
> a roll-your-own Geocities

Does it have a built in Under Construction banner, hit counter, country flags, scrolling text and all the other must have features?

[+] jaza|4 years ago|reply
It's nice to have the option of deploying static sites to your own server, more-or-less as easily as they can now be deployed to GitHub Pages, Netlify, Vercel, and friends.

Funny timing: I just finished converting all my old sites to be statically generated, and deploying them all on Netlify, so that I don't have to pay for, or be the sysadmin of, a personal VPS anymore (after many years of doing just that). It's hard to argue the case for hosting anything much myself these days, when the alternative is free, zero-maintenance, and (thanks to CDNs) able to handle any load lightning-fast.

[+] mro_name|4 years ago|reply
> It's hard to argue

easy: Terms of service and other smallprint. And visitor surveillance.

[+] jph|4 years ago|reply
Great work, thank you for sharing this. I see an opportunity for you to create tutorial steps, to teach a developer step-by-step what an input repo should contain in order to output "Hello World". Perhaps this is as simple as an example repo that contains a couple of files such as example.md and example.css?
[+] symkat|4 years ago|reply
Thanks!

I have some examples on markdownsite.com in the middle, I’ll post them here as well, thank you for asking:

https://github.com/symkat/mds-example.markdownsite.net - A static website made from markdown files

https://github.com/symkat/hugo-example.markdownsite.net - A static website made with Hugo

https://github.com/symkat/os-example.markdownsite.net - A hand-rolled website with HTML/CSS

The websites for each can be seen at their respective domains:

https://mds-example.markdownsite.net/

https://hugo-example.markdownsite.net/

https://os-example.markdownsite.net/

I absolutely want to get the docs more cleaned up and make understanding how to get a site running something effectively communicated. Right now I have this https://markdownsite.com/docs explaining some stuff. Thanks again!

[+] maxloh|4 years ago|reply
If I recalled it right, it can be done with GitHub Actions - just build and push to `gh-page` bramch whenever a new commit arrives. GitHub will do the job for you. No backend is required.
[+] iRomain|4 years ago|reply
Yes and Cloudlfare and Netlify and S3, etc. but this is not the point of this service. This software is to roll your own static site hosting (or use theirs)
[+] jaimex2|4 years ago|reply
Just curious on when you would use this over GitHub Pages?

https://pages.github.com/

[+] symkat|4 years ago|reply
HI! Thanks for the question!

If you’ve used and like GitHub Pages, and are just going to host a website as quickly as possible, it’s probably going to be the better option for you. GitHub can host the website, and GitHub Pages has better documentation and support than MarkdownSite does. MarkdownSite would likely be the bad choice right now for this. It launched literally last night, and I am hoping to get enough traffic and feedback from people playing with it so I can see where I can improve it.

If you want to run your own version of GitHub Pages, and host the website on virtual machines or bare metal servers in a data center, and to then provide that hosting to others, I don’t believe GitHub Pages has any self hosting option that I could see. If that’s true, MarkdownSite would be the better option in that situation.

On a personal note, it is perhaps an incredibly self-indulgent project in that I’ve always simply liked web hosting technology. I want to share that by creating and running a hosting platform myself, and to have the code and documentation and network diagrams out in the open for it so anyone else can run their own too.

I hope this helps explain some of the rational, thanks for checking it out!

[+] andybak|4 years ago|reply
Any idea why this repo doesn't work? https://github.com/icosa-gallery/open-brush-docs

I can't see anything other than 404's. I tried /resources.html etc

EDIT - I think maybe it's expecting me to put everything in a site subdir. Which is very unclear from the docs. (and means I probably won't try it out as I was hoping I could use my docs repo "as is")

[+] 13hunteo|4 years ago|reply
I believe it only builds anything in the site/ directory.

I haven't tested it, but a workaround could be making another repo, and using git submodules to put your docs repo in the site/ folder on this new repo.

[+] 97-109-107|4 years ago|reply
Tangential question - what are other examples of solutions that can be vaguely summarized as "platform for hosting and managing (and routing) discrete static websites" are out there?

I'm looking for streamlined alternatives to the following architecture (which works okay, but has too many separate parts):

  - Static websites compiled with different assets from the same root create discrete independent "public" folders
  - Folders are uploaded to a single bucket in Amazon S3 
  - Route53 and a separate reverse-proxy nginx server handle traffic to X.domain.com where X is the name of a folder in S3
[+] technobabbler|4 years ago|reply
If you're willing to go off Amazon altogether and lose a lot of control (which can be good or bad), the serverless hosts like Vercel can easily do that. Each folder is just its own repo, and each repo is its own route, and they take care of all the hosting and managing and CDNs and such. You just git push and that particular website will build and publish in a few seconds. The prices range from free to cheap for small websites.
[+] fxtentacle|4 years ago|reply
I use virtualmim on a cheap vps + hugo on my laptop.
[+] nwithan8|4 years ago|reply
Why are other people's logs exposed when I try to make a site? https://markdownsite.com/status/9?reject_job=1
[+] symkat|4 years ago|reply
Hi!

I think what happened is you clicked “Build My Site!” without entering a git repository in the text input field.

Right now building sites isn’t private, and there is no authentication, so you could iterate the id numbers, and you could see build logs and from those pages. If a git repository has been used before, instead of building a new website, it brings you to the status panel to rebuild it and it is rebuilt on the same sub domain. That specific one — id 9, looks to be the first time someone clicked the build button without entering any repository, anyone else who does that would be redirected to that page.

[+] adriangrigore|4 years ago|reply
Looks cool! I've beginning to wonder if Markdown is the right tool for generating "presentation" or "complex" web pages, as it was originally created for blog posts mostly. I believe that's the reason people complain of the lack of customizability of popular static site generators.

Markdown was made for blog posts not for custom web pages.

P.S. Built my own static site generator https://mkws.sh but don't support Markdown out of the box, just plain HTML.

[+] account42|4 years ago|reply
Does this really count as static site hosting if you use on-demand rendering instead of rendering everything? One of the big advantages of static sites is that the runtime complexity is as minimal as it can be.
[+] symkat|4 years ago|reply
I suppose it really depends on your perspective. It has pure static hosting, in that anything in the public directory is directly served, so static sites that are built with pre-processing have no at-serve-time processing other than the normal web server block.

For files in site/ that end in .md it does do rendering at the point of serving in some situations. Once it does, it both serves the file and spits out an .html file to serve for the next request. The way I thought about it is that the first request for the file generates it — like a mini hugo build or Jekyll build command running for just one path, and only running after a request has been made to it. This makes the compilation of the HTML just in time and saves processing for files that may never be rendered.

It does have draw backs, and could prove not to be the best path, and perhaps the preprocessing isn’t that big of a deal.

[+] EgeAytin|4 years ago|reply
Do you have plans to host static sites which builded with plain HTML it would be awesome.
[+] symkat|4 years ago|reply
Hi! Yes, absolutely. This was supported initially but not communicated well. I hope the updates more clearly explain that.

The use for plain HTML is documented here: https://docs.markdownsite.com/static-site/

I hope this is helpful, thanks!

[+] henriquez|4 years ago|reply
This looks great - please consider adding a Free/Libre Open Source license such as AGPL. Or any license!
[+] throwaway4837|4 years ago|reply
Me too! I think this might be the next Hello World. Goodbye Todo list app.