TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

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

158 pointsby pchmalmost 8 years ago

22 comments

StanAngeloffalmost 8 years ago
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.<p>Bash is great for a quick setup or a one-off instance. However it requires discipline for anything more. You are also dealing with the underlying OS yourself (e.g., Nginx is packaged and configured differently in Ubuntu, Debian, Cent OS &amp; Arch; networking is configured differently in Ubuntu depending on whether systemd is installed, etc.).<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;StanAngeloff&#x2F;vagrant-shell-scripts" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;StanAngeloff&#x2F;vagrant-shell-scripts</a>
评论 #14525576 未加载
dugmartinalmost 8 years ago
Here is a declarative bash DSL I ran across a few months ago:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;mattly&#x2F;bork" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mattly&#x2F;bork</a><p>and here is an example from their README:<p><pre><code> ok brew # presence and updatedness of Homebrew ok brew git # presence and updatedness of Homebrew git package ok directory $HOME&#x2F;code # presence of the ~&#x2F;code directory ok github $HOME&#x2F;code&#x2F;dotfiles mattly&#x2F;dotfiles # presence, drift of git repository in ~&#x2F;code&#x2F;dotfiles cd $HOME for file in $HOME&#x2F;code&#x2F;dotfiles&#x2F;configs&#x2F;* do # for each file in ~&#x2F;code&#x2F;dotfiles&#x2F;configs, ok symlink &quot;.$(basename $file)&quot; $file # presense of a symlink to file in ~ with a leading dot done</code></pre>
edganalmost 8 years ago
This is just plain a bad idea. Bash is the worst possible language. Yes, it can do it, but the syntax is awful. The problem of single quotes in double quotes in escaped double quotes.<p>I replaced a home grown, written by someone else, bash configuration management tool with Salt. The difference was huge.<p>Configuration management tools give you built-in logging, state checking, return codes, template libraries, and access to very mature models to access things like the AWS api.<p>I realize people don&#x27;t like the steep learning curve, but there is a reason for it.
atmosxalmost 8 years ago
Honestly, I find ansible quite simple and straight forward. You don&#x27;t have to use third party playbooks and using &#x27;autoenv&#x27; I achieved a very straight forward, simple, dynamic setup.
评论 #14524461 未加载
bjpbakkeralmost 8 years ago
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.<p>How is Welder different from Ansible, except bash vs python?
评论 #14523471 未加载
评论 #14523490 未加载
mikepurvisalmost 8 years ago
I came from setup shell scripts (especially running in the postinstall step of debian-installer) to Ansible, and I think the big win with Ansible is at least the ideal of idempotency.<p>That&#x27;s a lot harder to achieve with plain shell scripts, unless you&#x27;re pretty disciplined about only performing mutations to your system that are themselves idempotent (like a package install).
评论 #14524472 未加载
评论 #14522994 未加载
评论 #14523015 未加载
评论 #14522968 未加载
CyberShadowalmost 8 years ago
I created something similar for Arch Linux:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;CyberShadow&#x2F;aconfmgr" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;CyberShadow&#x2F;aconfmgr</a><p>It has a few crucial differences from typical configuration managers, though, as it allows transcribing the system state back into your configuration.
oneplanealmost 8 years ago
Basically, this is SaltStack&#x27;s salt-ssh re-implemented using bash instead of python... That too is just YML + Templates + Bash + SSH, with the exception that you can use Python too and the templates are JINJA.
callumjonesalmost 8 years ago
If you don&#x27;t like all the directories that Ansible playbooks require you can use the simple style of a single YAML file that describes the actions to take. Check out <a href="https:&#x2F;&#x2F;serversforhackers.com&#x2F;an-ansible-tutorial" rel="nofollow">https:&#x2F;&#x2F;serversforhackers.com&#x2F;an-ansible-tutorial</a>, the first introduction walks you through setting up just 2 files.
mariocesaralmost 8 years ago
I did something Similar, but fully based in shell scripts with no dependencies -&gt; <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;mariocesar&#x2F;8e674ec40dad6b94114d2a44d9151e23" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;mariocesar&#x2F;8e674ec40dad6b94114d2a44d...</a><p>I completely agree with OP when Ansible is overkill for must cases, and even slower than a plain smart shell script.<p>For my solution, simple create a bash function:<p><pre><code> function play () local remote=${2} local script=${1} local directory=$(dirname ${script}) tar cpf - ${directory}&#x2F; | ssh -t ${remote} &quot; tar xpf - -C &#x2F;tmp &amp;&amp; cd &#x2F;tmp&#x2F;${dirname} &amp;&amp; bash &#x2F;tmp&#x2F;${script} &amp;&amp; rm -rf &#x2F;tmp&#x2F;${dirname} &quot; } </code></pre> and later just call it like.<p><pre><code> play provision&#x2F;bootstrap.sh ubuntu@10.0.0.1 </code></pre> Where provision is a directory, and bootstrap.sh is the main shell script.
joelcollinsdcalmost 8 years ago
Reminds me of <a href="https:&#x2F;&#x2F;github.com&#x2F;brandonhilkert&#x2F;fucking_shell_scripts&#x2F;blob&#x2F;master&#x2F;README.md" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;brandonhilkert&#x2F;fucking_shell_scripts&#x2F;blob...</a>
ausjkealmost 8 years ago
I was really excited until I saw &quot;Welder requires rsync, ruby and liquid&quot; --- why do I need Ruby and all its dependencies here?<p>I tried <a href="https:&#x2F;&#x2F;github.com&#x2F;myplaceonline&#x2F;posixcube" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;myplaceonline&#x2F;posixcube</a> and it has zero dependencies , just bash itself, and it is nice.
cat199almost 8 years ago
On the subject of non-approved sysadmin&#x2F;devops tools,<p>I wrote a little &#x27;tarball compiler&#x27; framework in mostly PMake some time ago to &quot;DevOps&quot; like it&#x27;s 19[89]9 ... basically it will build per-host file overlay trees, rdist them out to target hosts, and then optionally run user defined start&#x2F;stop&#x2F;restart hook scripts when needed.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;ixcat&#x2F;admmk&#x2F;blob&#x2F;master&#x2F;doc&#x2F;admmk.rst" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ixcat&#x2F;admmk&#x2F;blob&#x2F;master&#x2F;doc&#x2F;admmk.rst</a><p>unfortunately, though it will do per-host targets, I didn&#x27;t get around to per-service targets.. should be feasable however.<p>Definitely a bit hairy, but hey, thats what quasi-functional symbolic makefile programming is all about my friends..<p>ps: if you think this is bad, try rewriting it in gnumake if that&#x27;s even possible.. PMake! Woo!
nwmcsweenalmost 8 years ago
cdist was pretty much the same, you should see why they made the decisions they made
nodesocketalmost 8 years ago
There is really not much you can&#x27;t do using HashiCorp&#x27;s Packer[1] and Terraform[2].<p>Packer can generate base images and roles based on shell scripts and transferring files. Terraform manages the creation of infrastructure on clouds and can bootstrap instances with shell scripts as well.<p>[1] - <a href="https:&#x2F;&#x2F;terraform.io" rel="nofollow">https:&#x2F;&#x2F;terraform.io</a> [2] - <a href="https:&#x2F;&#x2F;packer.io" rel="nofollow">https:&#x2F;&#x2F;packer.io</a>
jazoomalmost 8 years ago
Sup also works well<p><a href="https:&#x2F;&#x2F;github.com&#x2F;pressly&#x2F;sup" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;pressly&#x2F;sup</a>
snissnalmost 8 years ago
Could you explain what this line of code does?<p><pre><code> ssh -t user@example.com &quot;$(&lt; .&#x2F;my-setup-script.sh)&quot;</code></pre>
评论 #14523954 未加载
评论 #14522995 未加载
评论 #14523075 未加载
评论 #14523855 未加载
评论 #14523063 未加载
benbristowalmost 8 years ago
I was about to make the point about Ansible but I guess you&#x27;ve already made it in the README.
评论 #14522753 未加载
schizoidboyalmost 8 years ago
Similar tool: <a href="https:&#x2F;&#x2F;github.com&#x2F;myplaceonline&#x2F;posixcube" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;myplaceonline&#x2F;posixcube</a>
yakshaving_jgtalmost 8 years ago
Similar: <a href="https:&#x2F;&#x2F;github.com&#x2F;kenn&#x2F;sunzi" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;kenn&#x2F;sunzi</a>
ajmarshalmost 8 years ago
Hm I&#x27;ve always just used pssh for this type of administration. I guess this saves a step not having to pscp.pssh the script onto the nodes.
nikolayalmost 8 years ago
Yet another Ruby-based solution?!
评论 #14524251 未加载