baytechc / waasabi-config

Create and configure a new Waasabi instance
Other
0 stars 0 forks source link

Improve local multipass initialization by showing progress #9

Open flaki opened 3 years ago

flaki commented 3 years ago

Currently setting up the initial server components (init.sh) takes a very long time and the process is not easily introspectable as the output remains withing cloud-init.

When we are creating a local instance, we could instead disable the run-script in cloud-init and execute the script manually via multipass exec, this would provide us access to the output and could better follow the process, instead of idling on a blank terminal for minutes.

flaki commented 3 years ago

This already seems to be causing issues because the initialization times out:

launch failed: The following errors occurred:                                   
timed out waiting for initialization to complete
 multipass launch -c 2 -d 10G -m 2G -n waasabi-meetup-rust-lang-hu --cloud-init - lts

Local Multipass server launched on 10.55.98.180

Although it seems the instance starts eventually, the script still stops with an error later on:

Updating server configuration…

Restarting backend…
[PM2][WARN] No process found
Failed multipass command: sudo -u waasabi bash -c pm2 --update-env restart all

This is probably because the timeout the script proceeds thinking initialization already completed, while PM2 is actually not there (yet).

This was observed in the cloud as well (DO times out during the run of the init.sh script). The initialization still completes in time, but we need to make this more introspectable to the user. Probably the best approach would be making this, instead of a plain shell script, an actual node.js process which would be exposed after the first run on the device and would provide an account of the current progress of initialization.

This might be especially important if we add more services to the backend (PostgreSQL, Peertube, etc.).