4

Web server configuration sucks.

Apache or nginx have they're own custom configuration language and I don't understand why.

We've plenty of languages to work with: why we should learn some another custom commands with enigmatic commands for weird stuffs.

I'm not a python funboy but, a web server with python based configuration file will be so easy to setup and to maintain.

Comments
  • 6
    You have literally two formats to learn. One if you don't care about Apache. Sure, YAML is nice and all, but nginx is over 15 years old, and Apache 25
  • 7
    Don't bind configuration to a programming language.

    Configuration is data.

    Keep it simple please and as far away from programming languages as possible.

    DSL is enough.

    Don't mix programming with something that needs to be precise and human understandable.

    YAML is already a PITA - don't make it worse.
  • 2
    Hard disagree.

    With terraform and ansible, you can basically write down your server configuration in a few config files and it's reproducible everywhere.

    Your server can be as complicated or as simple as you'd like. And once you have got it working the way you like you can always set it up that way again.
  • 0
    @intrusioncm that's the point. Web server should not be configurable but programmable.

    Also Programming languages are precise and human readable.

    I can't understand why I need some fancy configuration command to do some simple logic
  • 5
    @cyberpro4 it's the other way around.

    A service (web server) fulfills a certain need.

    It hides it's inner way of working as much as possible.

    It provides you via a DSL / configuration a way to specify what you want to do.

    You don't program a service - you instruct it.

    Configuration is in most cases not fancy. It's a DSL (domain-specific language).
  • 5
    @IntrusionCM I totally agree, the config of apache is designed to be easy to configure and also easy to use hierarchal configurations so you do not have to repeat to much.

    Webpack uses js for config and while it is powerful it also makes most examples extremely difficult to understand and combine since many use their own internal functions that you would also have to have and know and when you open an unknown project you cannot just read the config, you have to learn their own special variety of it.

    And while python is older than Apache by some 4 years, apache built on another one that was developed almost the same time as python.

    And it took python some time to grow in popularity so at the time the apache config was invented, if they had looked at an interpreted language it could as well have been basic ;)

    And I do not think anyone would have liked that ;)
  • 4
    @Voxera that's true.

    And you gave an good example why a DSL is necessary / wise.

    A programming language can change over time, having API -/ ABI breaks.

    A DSL shouldn't change at all. It should be consistent, as every change in a DSL would lead to all users of the service needing a upgrade...
  • 4
    @IntrusionCM It also avoided countless wasted hours porting existing configs for dealing with breaking changes in Python even in minor releases, not to mention the whole Python 2 to Python 3 process.

    You just don't want to base long-term projects like web servers on such a language. Having the DSL under control is a major point.
  • 0
    I agree. In theory DSLs should be what drives a piece of software that itself is built with some programming language. In practice, DSLs that get invented for the most part prove to be inadequate, requiring maintenance and development of their own -- to keep up with feature and use case demand. Case in point: Nginx. You may argue it hasn't needed any updates to its conf. format, but I've grown mighty tired of its limiting language where you can't ever tell (or remember) which of its directives propagate through nested location blocks, and why or why not.

    Truth is, despite the supposed empirical evidence to the contrary, I have not met a single DSL that covers its bases enough for me not to want to replace it with e.g. a Lua script (look into Awesome which implements code-as-configuration). And I think that tells something, quite something in fact.

    If you need to auto-generate your configuration (through Ansible), that's a telltale sign the DSL has failed its primary purpose.
Add Comment