Automating the installation process

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

the stuff
you pipe in

You don’t need to worry about the delays.

1 Like

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