Hacker News new | ask | show | jobs
by dangerlibrary 4507 days ago
Is it really that hard to add 5 lines of boilerplate to your nginx conf? You can probably just copy-paste an existing server{} block or sites-available file and change the root directory. As a bonus, you'll learn a bit about how to configure the same tool you'll use later in production.

Oh. It's written in Go. Got it.

3 comments

I'm so sick of seeing this pattern of 1) person makes tool they find useful, 2) person releases tool publicly for free, 3) other person comes across tool but doesn't find it useful, 4) other person publicly denigrates tool as being universally not-useful.

I just don't get it.

@dangerlibrary simply says: Do not re-invent the wheel. I cannot see any real-world production environment where this new server is better approach then activating a tiny config file. Thus, it is a very good lesson to the author: Use what is out there and build what is missing.
I very rarely see a "hey I made this!" post here that doesn't include one or more comments along the lines of "this already exists!". I don't mind these sorts of comments when they tell me something I didn't know - "you can achieve something similar by doing coodle with well-known tool doodle!", "there is somewhat-obscure tool foodle that does exactly this!" - there are some comments like that in this thread. What I dislike is when these sorts of comments are along the lines of, "you should have just done the thing that you made the tool to avoid having to do!". It is just dismissal and leaves nobody the wiser.

It seems delusional to think that this sort of comment is somehow a good learning experience for a library author. Everyone knows that you shouldn't reinvent the wheel, but there are reasonable disagreements on what exactly that means.

I don't think I said anything negative about the tool itself, or about the author of the tool, who seems perfectly happy with it.

You're right that I don't think it's useful to have a proliferation of tools that do one thing worse than a general-purpose tool.

I don't want an avocado peeler - I'll use a knife and I'll recommend using a knife to others.

It's your tone more than anything. I read some of your previous posts to see if you were a d-bag and I came to the conclusion that you're not[1]. This reads more like the post was a button-pusher for you. I can relate. :)

Unfortunately, even with the tone removed, the comment hits that "top-voted middlebrow" button for many of the other people on the site. I would however say that for TFA itself as well.

[1] the opinion of some random interdweeb carries a lot of weight, I know. :)

Great. Good for you.

Your initial comment, however, is filled with a denigrating tone. It is that tone your parent is addressing. Not so much the content. The tone. It is unkind.

Does nginx have a directive for serving this text quickliy:

<h1>Maintenance</h1><p>will be back soon!</p>

Oh. It's written in C. Got it.

You still need to stop the existing web server to get spark to take over port 80, and restart it when you are done, so it's not quite that simple.

Also, it's not hard to keep a maintenance conf file around, pointing to a different directory. At least, it's certainly no harder than downloading a second web server. Then it's just "sudo ln /etc/sites-available/maintenance /etc/sites-enabled/conf"

You are so right, still I had a need for such a little tool and I don't regret any of it's 48 lines of code so far :)
The way I'd do this is have front-end load balancers just re-direct to a nginx configured just for this purpose.
Yes it does, although not out of the box:

http://wiki.nginx.org/HttpEchoModule

You don't actually need echo, you can use return from the rewrite module (which is compiled in by default).

    return 503 "<h1>Maintenance</h1><p>will be back soon!</p>";
lol, I love hackers :)
Oh yeah. That's rad.
:)

    # pgrep nginx
    #