Live data from Hacker News

Show HN: Welder – set up your Linux server with plain shell scripts

github.com

51–60 of 71 posts

Re: Show HN: Welder – set up your Linux server with plain shell scripts

#51
post #43

I used to bootstrap a lot of VMs in development using shell scripts [1]. At a certain point Bash scripts become unmanageable. Ansible, Chef, Puppet have stricter syntax, battle-tested modules, large communities, proper multi-OS support, etc. Investing time to learn any of those tools certainly pays off in the long run. Bash is great for a quick setup or a one-off instance. However it requires discipline for anything…

so it is the scripting language used by ansible, chef, puppet that imposes the required "discipline"? methinks each of these must in fact call the shell to get things done or least system(3). if they are calling execve then i would be more interested. i would also be interested in ansible, chef, puppet if i knew the scripting languages they are written in or wanted to learn them. but other languages interest me more.…

Ansible, Chef and Puppet are not languages. They are systems for managing the state of your server, during the whole lifetime of the server. You typically tell them "I want X to be in Y state" and they will take whatever actions to make that happen. Writing all that logic in a shell script is not particularly trivial. Of course, it's not all perfect and sometimes you have to resort to scripting-like approach, but the idea is that for the common patterns, they already have the logic implemented.

Re: Show HN: Welder – set up your Linux server with plain shell scripts

#52
post #24

Author claims all 90% of the time all they need is a single shell script. Then shows an example directory structure that mostly reminds me of Ansible. How is Welder different from Ansible, except bash vs python?

It also depends on Ruby and liquid templates. I am not sure how he can still claim it is "plain shell scripts"

Also, I'm a little bit surprised by the title/description, and then the examples. As opposite, I was looking at something like https://github.com/JonathanHuot/needrun/ which is EXACTLY a "plain shell script".

Re: Show HN: Welder – set up your Linux server with plain shell scripts

#53

Earlier quoted context omitted.

Stupid question, but why are Ansible playbooks supposed to be "more idempotent" than plain shell scripts? Due to taking over a project I had to deep dive into it pretty quickly and to me it feels like shell in yaml syntax.

The answer is, they're simply not. Ansible is just as easy if not moreso to shoot yourself in the foot, only there's some smoke and mirrors (like their 'lineinfile' module) that make you think you're idempotent but actually just create race-conditions and reduce version control. There are a few tricks that Ansible uses that are non-obvious uses of shell - For example, files should be replaced by copying the new versi…

Race-conditions? As in, if you're running the same Ansible script concurrently on the same machine? Yeah, definitively don't do that. But why would you?

I agree that modules like lineinfile are tricky and should be avoided (better to copy a full file), but it's hardly just as easy to shoot yourself than the equivalent sed command, in my opinion, if nothing else because they're more restricted.

Re: Show HN: Welder – set up your Linux server with plain shell scripts

#54
post #3

Earlier quoted context omitted.

Is Ansible really too much though, as the author suggests in README for simple tasks? If all you want is basic "SSH to a server, install some packages" type behavior, I'd still make the argument Ansible is simpler than this. Ansible isn't like Chef/other competitors where you have to bootstrap or install a client on the target machine. IIRC it only really needs SSH access and a Python installation present on the targ…

> IIRC it only really needs SSH access and a Python installation present on the target machine Which for my FreeBSD machines I have to run some bootstrap code that installs Python on it before I can run ansible against it. Would be nice if salt-ssh or ansible allowed me to have some bootstrap code that ran if Python didn't exist on the target machine.

http://docs.ansible.com/ansible/raw_module.html

http://docs.ansible.com/ansible/script_module.html

Re: Show HN: Welder – set up your Linux server with plain shell scripts

#55
post #42
post #3

Earlier quoted context omitted.

Is Ansible really too much though, as the author suggests in README for simple tasks? If all you want is basic "SSH to a server, install some packages" type behavior, I'd still make the argument Ansible is simpler than this. Ansible isn't like Chef/other competitors where you have to bootstrap or install a client on the target machine. IIRC it only really needs SSH access and a Python installation present on the targ…

For small deployments, this kind of thing means One Less Thing To Understand. I like and use Ansible, but there is a mild learning curve and the occasional gotcha. Given you generally have to know what you're trying to achieve in shell anyway, the shell versions are simpler, if less robust. For example, sudo apt update && sudo apt install nginx is easier than become: True tasks: - name: install nginx for great justic…

[deleted]

Re: Show HN: Welder – set up your Linux server with plain shell scripts

#57

Earlier quoted context omitted.

Stupid question, but why are Ansible playbooks supposed to be "more idempotent" than plain shell scripts? Due to taking over a project I had to deep dive into it pretty quickly and to me it feels like shell in yaml syntax.

The answer is, they're simply not. Ansible is just as easy if not moreso to shoot yourself in the foot, only there's some smoke and mirrors (like their 'lineinfile' module) that make you think you're idempotent but actually just create race-conditions and reduce version control. There are a few tricks that Ansible uses that are non-obvious uses of shell - For example, files should be replaced by copying the new versi…

Thanks for your answer! Actually a colleague of mine that got even more quickly frustrated with Ansible, claimed that Ansible is like Shell, but the latter but be more simple with less abstraction layers. I'll try the shell stuff at home. (In fact I'm also looking forward to check out Terraform, but it seems still a bit beta...)

Re: Show HN: Welder – set up your Linux server with plain shell scripts

#59
post #43

Earlier quoted context omitted.

so it is the scripting language used by ansible, chef, puppet that imposes the required "discipline"? methinks each of these must in fact call the shell to get things done or least system(3). if they are calling execve then i would be more interested. i would also be interested in ansible, chef, puppet if i knew the scripting languages they are written in or wanted to learn them. but other languages interest me more.…

Ansible, Chef and Puppet are not languages. They are systems for managing the state of your server, during the whole lifetime of the server. You typically tell them "I want X to be in Y state" and they will take whatever actions to make that happen. Writing all that logic in a shell script is not particularly trivial. Of course, it's not all perfect and sometimes you have to resort to scripting-like approach, but the…

> You typically tell them "I want X to be in Y state" and they will take whatever actions to make that happen.

I had so many problems with this, because not all possibilities are tested on all distributions on all architectures with all libc's and compiler combinations. Much is implicit compared to Nix where only the kernel is implicit.

Re: Show HN: Welder – set up your Linux server with plain shell scripts

#60
post #43

I used to bootstrap a lot of VMs in development using shell scripts [1]. At a certain point Bash scripts become unmanageable. Ansible, Chef, Puppet have stricter syntax, battle-tested modules, large communities, proper multi-OS support, etc. Investing time to learn any of those tools certainly pays off in the long run. Bash is great for a quick setup or a one-off instance. However it requires discipline for anything…

so it is the scripting language used by ansible, chef, puppet that imposes the required "discipline"? methinks each of these must in fact call the shell to get things done or least system(3). if they are calling execve then i would be more interested. i would also be interested in ansible, chef, puppet if i knew the scripting languages they are written in or wanted to learn them. but other languages interest me more.…

> no "host" or "guest". no virtual server

Much of the time, virtualization is just a way to give you control over the whole machine. If virtualization is thin, you don't lose a lot of performance.

It shouldn't be hard to make a Xen-backed VM administration interface. Then you can upload your MirageOS images (that you have tested on your local Linux, because MirageOS does that too) and it would work.

You can't get rid of virtualization and still have it remotely configurable. How are you going to reset configuration of a machine if you destroyed the bootloader of the ring-0 operating system?

Post reply on HN