11 ms·
My website is one binary
- unnouinceput 5y agoOh, oooohhh, this is so neat. You guys need to see its source too (In Firefox, for me, is right click->View page source). I mean I could read the same from source, with line breaks in same place. Try do that with any modern website, and you get everything in one line most of the time.
- aaaaaaaaata 5y agoDue to minifiers, mostly, no?
- manofmanysmiles 5y agoThis is inspiring me to do this in C, or maybe C++ without STL. It seems like an exceptionally perfect thing to just for the sheer joy of creating without regards to anything else.
- eyelidlessness 5y agoAuthor and I have surprisingly overlapping values and surprisingly non-overlapping outcomes. And I’m here for it! Also, props for a brutally-minimalist design that’s actually usable on a phone. Most of the sites I encounter like this feel like “this is a motherfucking website”[1] in principle twisted (intentionally or not) to be completely the opposite in spirit. 1: https://motherfuckingwebsite.com/ https://motherfuckingwebsite.com/
- zdragnar 5y agoIt looks better than that, for sure, but only actually looks good if my phone is in landscape orientation. In portrait, the section headers / titles are aligned right instead of center, which is odd, but the page title itself breaks onto two lines with the second aligned left. There is also something odd about line breaks in general- I would swear that some lines are breaking early, as if the browser can't figure out that the first word of the next line absolutely looks like it could have fit. I actually switched to horizontal orientation just to see if the weird breaks weren't some odd artistic choice. I've got to admit, though, that other than those complaints, I really do like the way there is content- just content. I've tried hand rolling my own blog a number of times, but I always end up in the same position- I remember that I don't actually have anything to say that merits a standalone blog post that I actually would want anyone else to read.
- no-dr-onboard 5y agoI liked it. Thank you.
- danielmarkbruce 5y agogo sets itself up for this kind of thing. I have a few programs I run which are a couple thousand lines of go in one single file.
- ratorx 5y agoI think it’s perfectly fine to do whatever you want because it’s fun, but some of the other justification for accepting and rejecting dependencies seems a bit weird. For example, one of your reasons for rejecting Hugo is that you can’t read all the code including dependencies and future updates yourself. However, you have no problems with using Go, which has a pretty large standard library and a lot of code for its implementation. Have you read through all of it? Sure, choosing Hugo is strictly worse by this metric (because it’s written in Go), but is even the goal of reading all source code and keeping up with changes tractable if Go is a dependency? Another one is your rejection of GitHub pages for uptime and future maintenance. There are many reasons you might not want to use it, but I don’t think those in particular are compelling ones. If you just use it to host plain or even templated HTML, then the migration cost if and when they fail is pretty low right? Just switch to one of the other HTTPS hosts or do the self hosting thing then? The maintenance tradeoff for not using GitHub pages is quite high too. I see your website is using HTTPS. In my opinion managing certificates is more maintenance than using GitHub pages. And then there are security updates. Dynamically generating websites has a security tradeoff too. Are you keeping your toolchain up to date? Go has had vulnerabilities in the past. BTW, I’m not not criticising your approach, just some of the justification for it. It sounds pretty neat to have a single binary website, but I’m not too sure about all the other justification.
- spicybright 5y agoDefinitely agree with all the above. However, personal websites are neat because the only requirements are your own, so you don't need to justify it. I love seeing solar powered websites, retro computers hosting modern sites, etc. Having a single binary is a neat idea too, even if it's a bit pointless. It almost reminds me of the woman that came up with binaries that could run on different OS's unchanged. Definitely neat stuff!
- cyberge99 5y agoAda?
- 5y ago
- Ono-Sendai 5y agoWhy would you use more than one binary for a webserver?
- __s 5y agoPage content is bundled into the binary (or maybe not, it's not too clear from post)
- wwn_se 5y agoBundling code and data never causes problems...
- nullbytesmatter 5y agoHaving separate data and code never causes problems either? Just because you bundle them together, doesn't mean the data and code are together during development. They get bundled together in the build process. It's not as bad as say, writing HTML in JavaScript (JSX).
- korv 5y agoi don't know why, but there is something oddly soothing about (nearly) all the text being in lowercase
- sneak 5y agoThis is how I write in chat, but not in emails or comments or readmes or more "permanent" things.
- tombh 5y agome too. this must have been studied linguistically somewhere? when i'm in lowercase mode i'll actually even go back and delete an accidental uppercase letter! so it's not just about laziness. maybe it has something to do with formality register? like how it can even be inappropriate to use a too formal register with a close friend, imagine if you suddenly called your spouse _mister_ or _misses_ smith!
- barnabee 5y agoTotally! I especially wish Titles With Every Word Capitalised would die
- influx 5y agoI find it weird to go to all the trouble and then just render most of the site in <pre> tags.
- 37ef_ced3 5y agoHere is a compiler (written in Go) that also generates and serves its own website with no dependencies: https://nn-512.com/browse/NN-512#46 https://nn-512.com/browse/NN-512#46
- tomnipotent 5y agoI worked at a company that acquired expage.com, which was a late 90s/early 00s homepage builder. The entire site was a single C source file littered with embedded HTML, a few separate HTML files for things like an FAQ, and a directory of compressed user page data in some proprietary format (including images) that was decompressed on-the-fly. Served over Apache with some CGI magic. https://web.archive.org/web/20000302105807/http://www.expage.com/ https://web.archive.org/web/20000302105807/http://www.expage...
- selcuka 5y ago> [...] a directory of compressed user page data in some proprietary format (including images) that was decompressed on-the-fly. Served over Apache with some CGI magic. This is pretty neat. I believe that was done to save on server storage, and before client side gunzip was a thing?
- jamal-kumar 5y agoCan you believe some of us crazy people still do this? https://git.zx2c4.com/cgit/ https://git.zx2c4.com/cgit/ cgit is the git repo frontend for projects like wireguard https://undleadly.org https://undleadly.org has its source code in the sidebar for you to check out in C as well https://learnbchs.org/ https://learnbchs.org/ key is OpenBSD or other OS's (less easy to use) sandboxing if you're going to do this remotely safely - check this for more https://learnbchs.org/pledge.html https://learnbchs.org/pledge.html
- badsectoracula 5y agoWhile not a single C file, Fossil SCM also uses C with HTML inside it (it uses a custom preprocessor[0] for it), e.g. check the chat.c file[1]. The entire program ends up in a single binary file too. [0] https://fossil-scm.org/home/file?name=tools/translate.c&ci=trunk https://fossil-scm.org/home/file?name=tools/translate.c&ci=t... [1] https://fossil-scm.org/home/file?name=src/chat.c&ci=trunk https://fossil-scm.org/home/file?name=src/chat.c&ci=trunk
- jamal-kumar 5y ago
- deleted 5y ago[deleted]
- psim1 5y agoSorry, I don't get it. Looking at the source tree, there's a folder of html. So you're compiling it down to a single binary, for what purpose? If you love golang, run caddy and point it to a folder of html.
- fmajid 5y agoAt one point, so was Facebook, compiled from PHP into a 1.5GB executable.
- pkrumins 5y agoOP is MVP!
- hegzploit 5y agoI'm sure this is late, but OP might like zola, It's a SSG that's contained in one binary (written in rust), It's lightweight and more barebones than most SSGs imo. been using it and have enjoyed it so far.
- jessetemp 5y agoI appreciate weird sites like this. Makes me want to dust off one of my web projects. It's interesting that you generate the site dynamically, but then drop everything into a pre tag which makes it very anti-responsive. Like others have mentioned, the word-wrapping is choppy on smaller screens
- nathan_f77 5y ago> hugo, the binary ... (it must not break your website between releases) I wrote a little blog post about my experience with Hugo - https://madebynathan.com/posts/2021-12-05-how-docker-saved-my-blog/ https://madebynathan.com/posts/2021-12-05-how-docker-saved-m... I struggled with this issue when I realized that it was too much work to update my blog to use the latest version of Hugo. I wasn't able to run the old hugo binary on my new version of MacOS (segfault). And I couldn't even compile the old code from source, because I couldn't get older versions of Go to work. Some of the old Go dependencies had even been renamed or deleted. Eventually I realized that I could continue using my old version of Hugo forever (0.21) if I run it in a Linux Docker container. The output is still static HTML and CSS, and all the static files are cached and served with a CDN (CloudFlare), so I'm not particularly worried about security updates. I'm not sure how long this will last though. It would be very nice if new versions of Docker would always provide backwards-compatibility for older Docker images, even in 20-30 years.
- bitwize 5y agoI used to maintain a web site with a Guile script. It read in s-expression data files and spat out a whole bunch of HTML, which I would then ftp to the server. This reminded me of those good times.
- chucktingle 5y agoThat's why I'm playing with Fossil: https://fossil-scm.org https://fossil-scm.org Your site, your data, your source control and your project (wiki, issues, forum, chat) in a single binary and a single file. Can it get any better!
- westcort 5y agoI agree with this, which is why I made a search engine that is also one binary: https://www.locserendipity.com/TitleSearch.html?q=Binary https://www.locserendipity.com/TitleSearch.html?q=Binary The entire index loads every time, and you can download it. It might be the only truly private search engine because your request is handled in the browser.
- codazoda 5y agoI like the idea and I’m likely to try the concept on something. This website has wrapping issues on my phone. Since it’s binary, that’s probably easy to solve in a single function. I’m really curious how data is stored in this system. Is all this text inside the code base, set as variables or something? Is it tacked onto the end of the bin and then the bin reads and processes it somehow? Or, is this reading plain-text stored alongside the binary?
- fallenhitokiri 5y agoI have built something similar and decided to simply use the embed[1] package which works well for this purpose. [1] https://pkg.go.dev/embed https://pkg.go.dev/embed
- petercooper 5y agoThe source is at https://git.j3s.sh/j3s.sh/tree https://git.j3s.sh/j3s.sh/tree I had a look since I was also curious and I am none the wiser as I don't see any embedding going on, but maybe I'm missing it.
- yakshaving_jgt 5y agoThe Yesod web framework for Haskell makes it quite easy to ship your entire website as a single binary. I was doing that for some time.
- jasfi 5y agoNim is compiled, and websites written with Jester compile to a single binary. You can even slurp() in HTML file as strings. Very fast.
- jasfi 5y agoI should add that I've written my own Nim web stack on top of Jester. I'm getting it release ready. It integrates with a Flutter front-end engine that will be released first. https://nexusdev.tools/ https://nexusdev.tools/
- vincnetas 5y agoIs the site code available for public to read? To see how it looks in reality.
- mro_name 5y agothanks for sharing! Starting with values is so essential! However I'd opt for the self-made static site generator and even more so annual partitions (for styling etc.), so that things can safely be heterogenous over time.
- hutrdvnj 5y agoThe easiest website to maintain is a website maintained by someone else and you pay a few bucks or find a free offering. The author wants both, full control and minimum maintenance. This is a well known contradicting. > I decided that i would host a website on a machine that i controlled If you host yourself then you have to maintain that server, but you're in full control. If you pay someone else todo so, you give up full control, but you don't have to maintain the server. It's a tradeoff.
- mro_name 5y ago> full control and minimum maintenance … contradicting Not at all, every sheet of paper is like that. For illiterates however it's true what you say. The open challenge is: how to unclutter writing and educate literates!
- otikik 5y agoI upvoted because this person is so different from me. I would not use a .sh file for something like that even if I was paid to do so. But if it works for them, who am I to argue. I do have a website which uses a static html generator that I have not maintained in years, mostly because I don't enjoy having to tangle with the more Operations aspects of it (which are very simple! but still not enjoyable). I think the lesson that I got from this writeup is: try to optimize for enjoyment on your own personal stuff. Otherwise it will get deprioritized the moment you struggle with time.
- movedx 5y agoMy entire future products are one binary. This is one binary: https://itopslevelone-beta.upload.academy./ https://itopslevelone-beta.upload.academy./ Golang makes this possible with the embedding feature.
- M4v3R 5y agoOne tiny nitpick - you should specify width and height for the image in the top of the page, otherwise there's a layout shift when the page loads.
- pjc50 5y agoThere are a lot of static site hosting options, all of which have a different idea of "easy". What I'm not seeing is what the easy dynamic hosting options are, other than a little VPS. Things like FaaS look easy once you've learned their lengthy setup and configuration process, and there's always the risk of a cloud billing nightmare. Basically I think there should be a cloud version of Visual Basic.
- tored 5y agoYou can put your PHP site into a single phar (PHP Archive) file if it is important to get that single file effect.
- joeberon 5y ago
- forgotpwd16 5y agoThere's a cool language in ML family called Ur which is based on that idea.
- smusamashah 5y agoAlso see redbean http://redbean.justine.lol/ http://redbean.justine.lol/
- aya96 5y ago
- slantedview 5y agoA lot of words that amount to: NIH.
- nullbytesmatter 5y agoThere are plenty of good reasons to roll your own solution. A blog is about as risk-free of a situation as you will get when it comes to rolling your own. It's not like the author is rolling their own encryption library.
- MrMan 5y agogo, I dont like. if it was nim I would upvote it