Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: I built an open-source web hosting platform for static sites (github.com/symkat)
217 points by symkat on March 14, 2022 | hide | past | favorite | 38 comments
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!



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.


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!


Any plans to add a WYSIWYG editor for building sites? I'm the friend who can run network stuff, but a github repo and markdown is beyond the people I'd run it for.


That’s definitely something I want to explore. I saw this[0][1] a while ago and think a setup with it could work out well, but I haven’t tested any of it yet. If you do, definitely let me know if it works out.

[0] https://www.netlifycms.org/ [1] https://github.com/netlify/netlify-cms



Oh that's neat! If I get a chance to test I'll report back.


> 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?


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.


> It's hard to argue

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


And I get to learn stuff in the process of deploying it


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?


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!



Thank you!


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.


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)


I use Zola (static site generator) + GitHub pages for my personal blog[0]. Here's the repo / build action for those interested[1]. It's suprising how easy and cheap it is (free!) to set up a globally distributed website is these days.

[0]: https://slightknack.dev/blog

[1]: https://github.com/slightknack/slightknack.dev/blob/master/....


Just curious on when you would use this over GitHub Pages?

https://pages.github.com/


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!


I think it'd be a great fit to introduce some kind of 'git' hooks that could work just like github actions.

Currently, I have a static blog served @ [0] and it is literally a git repo that runs git hooks. I think the project you're doing is awesome, but it would be nice if it could be tuned, e.g. choose my markdown processor of preference, etc.

the git repo for the blog is here: [1]

My blog uses a forked tool called blogit (made by pedantic.software) and it's makefiles and a standard markdown processor with raw html templates for headers, footers, etc.

I haven't actually used this but I think it's promising: (mkws.sh) [2]

just spitballing some ideas here and there. Nice project.

references

[0] https://trevcan.duckdns.org/blog/

[1] https://git-trevcan.duckdns.org/trevcan.github.io.git/

[2] https://mkws.sh/


Hi! Thanks for the feedback!

There is some support in there for build-time changing of things. A file, .markdownsite.yml, can be read in and do things like change where the directory containing markdown files, or the webroot is, and will switch branches. Definitely a place that could be expanded — if you take a look at Manager/lib/MarkdownSite/Manager/Plugin/Maker.pm you’ll see how it builds. So maybe some of that can fit in, and alternative builders are certainly something to think about.

As far as git hooks, right now, you could add one to make your site import with the following:

A githook could trigger an import with curl, for example:

curl -XPOST -d'repo=git@github.com:symkat/mds-example.markdownsite.net.git' https://markdownsite.com/import

The first run will make the site and assign a domain, subsequent runs update the same domain.

Thanks for checking it out and your feedback, definitionally given me some things to think about!


> ...I’ve always simply liked web hosting technology...

You are not alone! :-)

Also, thank you for making this!


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")


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.


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


This service takes a cURL request and outputs an https URL: https://www.gostaticapp.com/

You can use it via cURL or github actions (https://github.com/marketplace/actions/gostatic-deploy), and there's a node-based CLI coming soon

e.g. curl https://www.gostaticapp.com/api/deploy/artifact \ -X POST \ -H "Accept: application/json" \ -H "Authorization: Bearer your-api-token" \ -F "file=@file.zip"


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.


I use virtualmim on a cheap vps + hugo on my laptop.


Why are other people's logs exposed when I try to make a site? https://markdownsite.com/status/9?reject_job=1


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.


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.


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.


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.


Do you have plans to host static sites which builded with plain HTML it would be awesome.


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!


This looks great - please consider adding a Free/Libre Open Source license such as AGPL. Or any license!


Me too! I think this might be the next Hello World. Goodbye Todo list app.


Typo: Github sponser




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: