Automating the installation process

AI-generated summary

The discussion revolves around automating the Discourse installation process using the discourse-setup script. drmrbrewer seeks to automate the script, noting that it currently requires manual input. pfaffman explains that input can be piped into the script, and shares that they use a here-document (<<EOF) to feed responses, noting that delays are no longer necessary due to a prior change. Remah clarifies that this method is input redirection, not a pipe, and distinguishes between redirection (using < or >) and piping (using |).

I’m following the steps in the install guide and it works just fine. Now I’m considering how I can automate this process (as part of a script run when spinning up a new server).

When it comes to running ./discourse-setup some manual input is presently required. Is it possible to pass arguments to this script in some way, or via an env var somehow, so that it can be run as part of a server init script?

You can pipe the input in to discourse-setup. That’s what my install script does. A year or so ago I changed the bit that creates the swap to have a delay rather than require an extra return so that the input that discourse-setup needs is always the same.

Ah that’s good to know. How exactly do you pipe multiple inputs (including a delay) to the discourse-setup script?

something like

./discourse-setup<<EOF
the stuff
you pipe in
EOF

You don’t need to worry about the delays.

Technically, that is not a pipe but redirection.

The less than symbol “<” is redirecting the standard input (stdin). A pipe(-line) is denoted by a vertical bar “|”.

This pipe uses no file system operations:
command1 | command2

Redirections can achieve the same sort of result mediated by a temporary file:
command1 > tempfile
command2 < tempfile