Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to install script #268

Merged
merged 4 commits into from
Aug 4, 2024

Conversation

za419
Copy link
Contributor

@za419 za419 commented Jul 31, 2024

  • Suppport relative music paths
  • Remember that we chose a proxy instead of relying on a profile
  • Use heredocs to reduce echo spam
  • Add defaults to inputs where that seems suitable
  • Add input validation
  • Read only one character for y/n prompt
  • Use fail-early to stop if we reach a bad state
  • Make the script able to run regardless of working directory

 - Suppport relative music paths
 - Remember that we chose a proxy instead of relying on a profile
 - Use heredocs to reduce echo spam
 - Add defaults to inputs where that seems suitable
 - Add input validation
 - Read only one character for y/n prompt
 - Use fail-early to stop if we reach a bad state
 - Make the script able to run regardless of working directory
@kenellorando kenellorando self-requested a review August 1, 2024 04:23
@kenellorando kenellorando self-assigned this Aug 1, 2024
@kenellorando
Copy link
Owner

I'm getting stuck in the rate limiter loop, do you see similar behavior?

[3/5] Rate Limiter Timeout
Set a rate limit timeout in integer seconds. This prevents the same listener
from requesting songs within the configured timeframe. Set to 0 to disable.
      Rate limit (0): 0
Rate limit must be an integer!
      Rate limit (0): 0
Rate limit must be an integer!
      Rate limit (0): 1
Rate limit must be an integer!
      Rate limit (0): 1

The loop only breaks when I hit return, providing no value.

@kenellorando kenellorando assigned za419 and unassigned za419 and kenellorando Aug 1, 2024
Apparently, Bash doesn't actually support this in its regexes. How
annoying...
@za419
Copy link
Contributor Author

za419 commented Aug 1, 2024

I'm getting stuck in the rate limiter loop, do you see similar behavior?

[3/5] Rate Limiter Timeout
Set a rate limit timeout in integer seconds. This prevents the same listener
from requesting songs within the configured timeframe. Set to 0 to disable.
      Rate limit (0): 0
Rate limit must be an integer!
      Rate limit (0): 0
Rate limit must be an integer!
      Rate limit (0): 1
Rate limit must be an integer!
      Rate limit (0): 1

The loop only breaks when I hit return, providing no value.

That awkward moment when you get caught assuming bash is better at regex than it actually is....

Fixed:
image

This was surprisingly easy...
@za419
Copy link
Contributor Author

za419 commented Aug 1, 2024

features.push('Tab completion of the music path using Readline')

@kenellorando
Copy link
Owner

Nice, that looks good now. The next one is in the reverse proxy setup:

[5/5] Enable Reverse Proxy?
Do you want to enable a reverse proxy? Skip if you are broadcasting locally only
or have your own reverse proxy configured. Skip if you do not know what this means.
      [y/N]: y
Please provide the domain name you will use for Cadence UI.
      Web UI Domain: cadenceradio.com
awk: not an option: -i

We must have different versions of awk-- neither my ubuntu-based dev machine nor server installations support the -i option.

@kenellorando
Copy link
Owner

I also separately bring up another question about continuity after initial installation. Assuming that an initial ./install.sh run works, will it continue to work again? For example, in a situation where a user selects no reverse proxy initially (removing NGINX_CONFIG_SECTION), then installs again at a later time but selects a reverse proxy? Vice versa as well.

Also meant to point this out yesterday nice commit hash. I don't think I've ever seen a word spelled before.

$ git checkout za419/install-improvements
HEAD is now at deaaad8 Improvements to install script

@za419
Copy link
Contributor Author

za419 commented Aug 2, 2024

Nice, that looks good now. The next one is in the reverse proxy setup:

[5/5] Enable Reverse Proxy?
Do you want to enable a reverse proxy? Skip if you are broadcasting locally only
or have your own reverse proxy configured. Skip if you do not know what this means.
      [y/N]: y
Please provide the domain name you will use for Cadence UI.
      Web UI Domain: cadenceradio.com
awk: not an option: -i

We must have different versions of awk-- neither my ubuntu-based dev machine nor server installations support the -i option.

Wow! Yours must be ancient, it came out in 2013....

No, really I think it's a GNU awk-specific thing. It might work if that switched out to gawk, which as it turns out is symlinked to awk in my environment:
image

That said, it's an easy enough fix - I'll just read in the example and write out the real yml instead of copying and then editing in place (that's arguably better anyway...)

@za419
Copy link
Contributor Author

za419 commented Aug 2, 2024

I also separately bring up another question about continuity after initial installation. Assuming that an initial ./install.sh run works, will it continue to work again? For example, in a situation where a user selects no reverse proxy initially (removing NGINX_CONFIG_SECTION), then installs again at a later time but selects a reverse proxy? Vice versa as well.

No reason why it shouldn't, since it recreates the config files (including the compose yml) from scratch on each run. I did it quite a few times that way while developing this and noticed no ill effects - I also ran through the scenario you mentioned just now and it seems to work perfectly.

Also meant to point this out yesterday nice commit hash. I don't think I've ever seen a word spelled before.

$ git checkout za419/install-improvements
HEAD is now at deaaad8 Improvements to install script

Hey, I didn't even notice! Cool!

Thanks for pointing it out. I also can't remember seeing a word spelled out before (except maybe the rather simple 'bad', and definitely not counting 'a' as a word of course...)

@kenellorando
Copy link
Owner

Works flawlessly for me now. Nice work.

@kenellorando kenellorando merged commit 179d93a into kenellorando:master Aug 4, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants