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

Installation Script Enhancement and Startup Script #580

Merged
merged 29 commits into from
Nov 27, 2024

Conversation

crhultay
Copy link
Contributor

@crhultay crhultay commented Nov 25, 2024

Added Selection Menu to choose Dependencies, or to Install Everything
Added Python Environment Installation Option
Added Bugfix for Gopher Template Installation which was throwing path errors

They key motivation is:
This enhancement will allow the user to auto-install the Python Runtime Environment with a version proven to work with ENiGMA½. It will remove the inability for a user to run the latest Linux Distro and decouples ENiGMA½ from the operating system's Python environment.

It is a common, and poor practice to downgrade the OS Python Environment as it can break operating system functionality.

It is becoming common, and recommended practice to build your own python environment for resiliency in production systems, and this makes ENiGMA½ more versatile and reliable.

Added selection menu to install all steps, or individual
Added reference to autoexec.sh
Added Python Runtime Environment installation workflow

The new Python workflow will allow users to run ENiGMA½ on modern Linux distributions such as Ubuntu 24.04 per my note in NuSkooler#537.

It is my strong recommendation that we offer the user the use of pyenv, as this will decouple the distribution's Python interpreter from that of ENiGMA½ -- this will make the software more portable. It is poor advice to give a user that they upgrade their OS Python Interpreter; doing so can break the operating system if there are incompatibilities.
autoexec.sh Outdated Show resolved Hide resolved
autoexec.sh Outdated Show resolved Hide resolved
@crhultay
Copy link
Contributor Author

autoexec.sh confirmed working with systemctl

@crhultay
Copy link
Contributor Author

@NuSkooler I have completed writing for this PR and have tested installation, autoexec, and systemd startup with success on my Ubuntu Server 24.04 installation.

Versions of node and python are now configurable via mise.toml and read automatically into autoexec.sh for pre-startup dependency configuration.

@NuSkooler
Copy link
Owner

@NuSkooler I have completed writing for this PR and have tested installation, autoexec, and systemd startup with success on my Ubuntu Server 24.04 installation.

Versions of node and python are now configurable via mise.toml and read automatically into autoexec.sh for pre-startup dependency configuration.

This looks awesome! Since this is a fairly large change to the initial setup, I'm going to create 1-2 from scratch VM's and run through the paces before merging in (1 Debian/Ubuntu, another RHEL based). Skimming over the code, I don't expect any major issues.

@crhultay
Copy link
Contributor Author

@NuSkooler I have completed writing for this PR and have tested installation, autoexec, and systemd startup with success on my Ubuntu Server 24.04 installation.
Versions of node and python are now configurable via mise.toml and read automatically into autoexec.sh for pre-startup dependency configuration.

This looks awesome! Since this is a fairly large change to the initial setup, I'm going to create 1-2 from scratch VM's and run through the paces before merging in (1 Debian/Ubuntu, another RHEL based). Skimming over the code, I don't expect any major issues.

Makes perfect sense to me.

@NuSkooler
Copy link
Owner

NuSkooler commented Nov 25, 2024

First pass with a clean Ubuntu 24.04.1 LTS/Desktop:
Ran the script piped to bash, it just displayed the following and exited.

image

VM for Alma Linux 9 spinning up now, will see initial results there.

@crhultay
Copy link
Contributor Author

Okay, that's interesting... :)

Will evaluate this after some day job stuff, thank you for testing and pardon the issue.

@crhultay
Copy link
Contributor Author

Tested by piping through bash -- reproduced the same issue.
When I take the very same script and chmod +x, and ./install.sh it works...

I predict this same issue will occur in all distros.

That is interesting. I don't understand why that is however will continue to investigate.

@NuSkooler
Copy link
Owner

Will evaluate this after some day job stuff, thank you for testing and pardon the issue.

I'll poke around as well, at least it's consistent!

@crhultay
Copy link
Contributor Author

@crhultay
Copy link
Contributor Author

Will evaluate this after some day job stuff, thank you for testing and pardon the issue.

I'll poke around as well, at least it's consistent!

Fixed, try again

@NuSkooler
Copy link
Owner

NuSkooler commented Nov 25, 2024

Progress -- here are the results from AlmaLinux 9:

_____________________   _____  ____________________    __________\_   /
\__   ____/\_ ____   \ /____/ /   _____ __         \  /   ______/ // /___jp!
 //   __|___//   |    \//   |//   |    \//  |  |    \//        \ /___   /_____
/____       _____|      __________       ___|__|      ____|     \   /  _____  \
---- \______\ -- |______\ ------ /______/ ---- |______\ - |______\ /__/ // ___/
                                                                       /__   _\
       <*> ENiGMA½ // https://github.com/NuSkooler/enigma-bbs <*>        /__/


Installing ENiGMA½:
  Source     : https://github.com/NuSkooler/enigma-bbs.git (master branch)
  Destination: /home/nuskooler/enigma-bbs

>> If this isn't what you were expecting, hit CTRL-C now!
>> Installation will continue in  seconds...

Installation Options
1) Install Dependencies
2) Install ENiGMA½
3) Install Everything
4) Quit
Pick an option: 3
Checking for 'git'... Found!
Checking for 'curl'... Found!
Checking for a suitable Python installation... Found!
Checking for 'make'... Found!
Checking for 'make'... Found!
Checking for 'gcc'... Found!
Checking for 'git'... Found!
Checking for 'curl'... Found!
Checking for a suitable Python installation... Found!
Checking for 'make'... Found!
Checking for 'make'... Found!
Checking for 'gcc'... Found!
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  6333  100  6333    0     0  17640      0 --:--:-- --:--:-- --:--:-- 17689
mise: installing mise...
######################################################################## 100.0%
mise: installed successfully to /home/nuskooler/.local/bin/mise
mise: run the following to activate mise in your shell:
echo "eval \"\$(/home/nuskooler/.local/bin/mise activate bash)\"" >> ~/.bashrc

mise: this must be run in order to use mise in the terminal
mise: run `mise doctor` to verify this is setup correctly
mise all runtimes are installed
2024-11-25 12:39:59 Installing required Node packages...
2024-11-25 12:39:59 Note that on some systems such as RPi, this can take a VERY long time. Be patient!
main: line 136: cd: /home/nuskooler/enigma-bbs: No such file or directory
fatal: not a git repository (or any of the parent directories): .git
2024-11-25 12:39:59 ERROR: Failed to install ENiGMA½ npm packages. Please report this!
[nuskooler@localhost ~]$ 

I will re-test Ubuntu in one moment and post here.

Update
Looks like order of ops may be a bit off. I'm using the "install everything" with a 100% clean system. Same thing on Ubuntu @ 136, may need to ensure git clone first.

@crhultay
Copy link
Contributor Author

Committed the latest install.sh version; however I get this error during 'npm install':

npm error code 127
npm error path /home/egonis/enigma-bbs/node_modules/node-pty
npm error command failed
npm error command sh -c node-gyp rebuild
npm error /usr/bin/env: ‘node’: No such file or directory
npm error A complete log of this run can be found in: /home/egonis/.npm/_logs/2024-11-26T01_07_13_175Z-debug-0.log

The issue is that 'node' is an alias, and not found in the PATH. When I run 'which node', nothing is returned.

I'm not entirely sure how to get around this nuance, however it is the final blocker for an install script that works on a vanilla machine.

@crhultay
Copy link
Contributor Author

Spoke too soon -- SORTED!

The solution was to use shims per https://mise.jdx.dev/cli/activate.html

@NuSkooler
Copy link
Owner

I was able to get a bit further, but mise, node, etc. are not in my PATH even after creating a new terminal session, so enig/oputil are not able to start.

@crhultay
Copy link
Contributor Author

I was able to get a bit further, but mise, node, etc. are not in my PATH even after creating a new terminal session, so enig/oputil are not able to start.

If you run autoexec.sh, it will work because it adds the shim to your PATH.

What we could do is echo this into the user's ~/.bashrc and then they would be free to run ./main.js without having to init the mise environment or having to run autoexec.sh.

What do you think?

@NuSkooler
Copy link
Owner

I was able to get a bit further, but mise, node, etc. are not in my PATH even after creating a new terminal session, so enig/oputil are not able to start.

If you run autoexec.sh, it will work because it adds the shim to your PATH.

What we could do is echo this into the user's ~/.bashrc and then they would be free to run ./main.js without having to init the mise environment or having to run autoexec.sh.

What do you think?

Previously we'd install npm and node to the user's environment, meaning they were in PATH and e.g. npm install foo would install foo to the user's npm dir. I think we need the same outcome pretty much. Is PATH the only thing missing here? If that's added, can I as a user e.g. npm install -g pm2?

@crhultay
Copy link
Contributor Author

npm install -g pm2
This is now fixed, please re-test.

Please note that you must be in the enigma-bbs dir in order for your node/npm/python commands to be functional as the .venv and mise.toml are present in enigma-bbs.

Let me know what you think.

@crhultay
Copy link
Contributor Author

Added some ANSI codes to make it look 31337, I tested this thoroughly in Ubuntu 24.04 with no node installed, and Python 3.12 used by system -- this appears to work great.

@NuSkooler
Copy link
Owner

NuSkooler commented Nov 27, 2024

Just tried out the latest on Ubuntu right before you pushed the ANSI I believe. Worked great! I like that it localizes the install to the enigma directory now 👍

One note: The first message output in final steps notes nvm still.

I'll try Alma next, should pick up your latest ANSI stuff.

Update: AlmaLinux 9 worked like a charm.

autoexec.sh Outdated Show resolved Hide resolved
@NuSkooler
Copy link
Owner

I don't want to hold this up, so when you're comfortable let me know. It's working great on my end.

@crhultay
Copy link
Contributor Author

autoexec.sh cleaned up to use a common log function, and also auto-detect whether the logs directory exists; turns out it's created on first-run but this will cause an error scenario for new BBSes if ./main.js has not been run the first time.

Please do me a favour and:

git add --chmod=+x ./autoexec.sh

That is, if this is easy enough for you to do. I am unable to do this in my remote repo without getting fancy.

@crhultay
Copy link
Contributor Author

Just tried out the latest on Ubuntu right before you pushed the ANSI I believe. Worked great! I like that it localizes the install to the enigma directory now 👍

One note: The first message output in final steps notes nvm still.

I'll try Alma next, should pick up your latest ANSI stuff.

Update: AlmaLinux 9 worked like a charm.

Nice catch, replaced 'nvm' with 'mise' and some other touch-ups.

Please note that when you merge this commit, you can probably close out a lot of the issues pertaining to "Enigma isn't compatible with modern distros, etc." since this environment isolation will fix that.

@crhultay
Copy link
Contributor Author

Unrelated note -- my user 'egonis' on your BBS is getting 'That user is already logged in' when I try to connect by telnet, and I get 'Error -21 activating session' via SSH via Syncterm (could be my issue).

Could I get you to look at this? I am missing out on my LoRD character and Dank Dungeons daily routines. :)

@NuSkooler
Copy link
Owner

Unrelated note -- my user 'egonis' on your BBS is getting 'That user is already logged in' when I try to connect by telnet, and I get 'Error -21 activating session' via SSH via Syncterm (could be my issue).

Could I get you to look at this? I am missing out on my LoRD character and Dank Dungeons daily routines. :)

Updated - There is a bug in which SSH gets stuck at times :D

Merging and will apply +x!

Copy link
Owner

@NuSkooler NuSkooler left a comment

Choose a reason for hiding this comment

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

This is going to help a lot of new users!

@NuSkooler NuSkooler merged commit efe3b5e into NuSkooler:master Nov 27, 2024
2 checks passed
@crhultay crhultay deleted the patch-5 branch November 27, 2024 16:30
@crhultay
Copy link
Contributor Author

Unrelated note -- my user 'egonis' on your BBS is getting 'That user is already logged in' when I try to connect by telnet, and I get 'Error -21 activating session' via SSH via Syncterm (could be my issue).
Could I get you to look at this? I am missing out on my LoRD character and Dank Dungeons daily routines. :)

Updated - There is a bug in which SSH gets stuck at times :D

Merging and will apply +x!

Do we have an issue for the SSH issue and how to reproduce?

@NuSkooler
Copy link
Owner

Do we have an issue for the SSH issue and how to reproduce?

I could have sworn there was a issue, but I don't see it. Feel free to create. It's something I want to start looking at as well as I get some time here.

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