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

feat: New bundles to replace templates in releases #602

Merged
merged 19 commits into from Dec 4, 2023
Merged

Conversation

XavierChanth
Copy link
Member

@XavierChanth XavierChanth commented Dec 2, 2023

- What I did

  • Added a new bundles folder which splits things up into 3 groups:
    • core (for all releases)
    • shell (mac / linux releases)
    • windows (windows releases)
  • Updated the build scripts to use these new bundle paths
  • Wrote a new install.sh script in the shell folder which will replace the old installers
    • This script is much smaller and easier to maintain, in exchange it forces the user to configure somethings on their own.
    • I've done this on purpose, because the user should know about how their service was configured, and what the installer did for them.
    • The new script should now be fully POSIX sh compliant
  • Move some items in the templates folder to the tools folder (they don't really belong in the release, since they only make sense when you have cloned the full repo)

- How I did it

- How to verify it

- Description for the changelog
feat: New bundles to replace templates in releases

@XavierChanth XavierChanth marked this pull request as draft December 2, 2023 02:19
@XavierChanth XavierChanth marked this pull request as ready for review December 2, 2023 02:20
@XavierChanth XavierChanth requested a review from gkc December 2, 2023 02:20
# shellcheck disable=SC2154
"$HOME"/.local/bin/sshnpd -a "$device_atsign" -m "$manager_atsign" -d "$device_name" -v
sleep 10
done
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplified version of the old headless script we were using, this one intentionally requires manually configuration so that users actually know and learn how to configure their own instances of sshnpd

# disable "var is referenced but not assigned" warning for template
# shellcheck disable=SC2154
"$HOME"/.local/bin/sshrvd -a "$atsign" -i "$internet_address"
sleep 10
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same story but for sshrvd

@@ -0,0 +1,296 @@
#!/bin/sh

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New POSIX sh compliant install script, should also work on ash!

  • I make some assumptions, remove some smoke and mirrors, which has resulted in 4x less shell script to maintain, and the shell script is also much less complicated as well


install_systemd_sshnpd() {
root_only
install_single_binary "sshnpd"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while systemd units can be installed as a --user unit, it adds a lot of complexity not worth trying to automate. hence root_only

echo ""
echo "Warning: logs stored at $log_file and $err_file have unlimited potential size"
echo "In a production environment, it's recommended that you install via systemd"
echo "or use a cron job to call logrotate on these log files if systemd is not available"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logrotate isn't available on every system, so I'm not trying to automate it or have to call it... this option should be a last resort anyways.

echo ""
echo "Warning: sometimes tmux is not set to linger which will kill the tmux session on logout"
echo "Make sure your system is configured so that tmux sessions can linger, or disown the tmux process before logging out"
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are ways to automate this, but each solution has trade-offs, leave it to the user to pick and choose.


At this time, windows doesn't have an automated installer. To use the sshnp.exe
client, copy the binary to a convenient location for you. You may also add the
binary to a folder in the PATH so that it can be accessed from anywhere.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I plan to update this in a further PR, but just so we have something for now.

@@ -1,3 +1,6 @@
# Dockerfile
# Build image for a containerized instance of sshnpd

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Labelling all of our dockerfiles so we know what they do and why they need to exist

case "$SSHNP_VERSION" in
# TODO remove latest to signify deprecation on the launch of v4.0.0
latest|1.*|2.*|3.*|4.0.0-test.*|4.0.0-rc.*)
# no message, this group is expected to use this script
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an automated deprecation message which will automatically trigger on 4.0.0 and later, we just have to remove latest from the safe-list once we release 4.0.0 (this is the old script)

@XavierChanth XavierChanth merged commit 2b70c6f into trunk Dec 4, 2023
11 checks 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.

None yet

2 participants