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

Update to handle the NodeJS 16 dependency #9921

Merged
merged 22 commits into from
Feb 12, 2022
Merged

Update to handle the NodeJS 16 dependency #9921

merged 22 commits into from
Feb 12, 2022

Conversation

altendky
Copy link
Contributor

@altendky altendky commented Jan 24, 2022

Draft for:

  • Consider using a local n install for all platforms, not just Ubuntu
  • Make sure the instructions at the end of installation properly reflect each platform
  • Generally lots of testing.
  • Maybe use NodeJS 16 instead of stable
  • Should we wipe the .n directory before installing to it?

@ChiaMineJP
Copy link
Contributor

ChiaMineJP commented Jan 27, 2022

Post-merge notes

We can close the issue/PR below after this PR is merged.
#9727
#9728

The INSTALL instruction should be modified because it will no longer require pre-installation process.
https://github.com/Chia-Network/chia-blockchain/wiki/INSTALL#centosred-hatfedora

@ChiaMineJP
Copy link
Contributor

ChiaMineJP commented Jan 28, 2022

@wjblanke @altendky
(This PR updates install scripts. Maybe more members should review the changed files)

Changelog

Changed

  • Removed sudo npm install n from install-gui.sh and put cd build_scripts/npm_global; npm ci instead.
    • n is a nodejs version switcher
    • n is installed to build_scripts/npm_global/node_modules if npm>=7 is not available on system.
  • If npm>=7 is not available, it automatically install npm>=7 to <chia-blockchain root dir>/.n.
    • So it won't override existing global npm/nodejs anymore.
    • n fetches nodejs tarball from dist server. However there seems no prebuild version for OpenBSD/FreeBSD available. So if on OpenBSD/FreeBSD and npm>=7 is not available, the script asks user to install npm>=7 manually.
  • This now installs sqlite/python to CentOS7/AmazonLinux2 automatically if it is not installed.
    This greatly simplifies INSTALL process over different OSes
    because it will no longer require pre-install manual installation and cd chia-blockchain; sh install.sh will do everything for users.
  • If the version of sqlite linked to Python is less than 3.8, it shows an error message and exit.
    (chia-blockchain requires sqlite>=3.8 for creating partial index)
  • If user attemps to run install.sh when there is a newer version of a python than a python already installed in venv directory, install.sh now clears venv folder and installs python packages corresponding to the new python.

Fixed

  • Fixed an issue where install-gui.sh failed if only npm<7 was available on the system.
  • Fixed an issue where install-gui.sh did not work as expected when an user runs the script not from a directory where the shell script file exists.
  • Fixed an issue where install-gui.sh tried to run sudo apt-get npm nodejs libxss1 even if nodejs is already installed.
  • Fixed an issue where install.sh showed unnecessary stdout/stderr message from pacman
  • Fixed an issue where there was no python install on RHEL in install.sh
  • Fixed an issue where install.sh tried to run sudo apt-get install bc -y even if bc is already installed.

Added

  • Added CentOS install test for CI (.github/workflow/test-install-scripts.yml)
  • Added start-gui.sh.
    • This automatically tries to load local nodejs environment if it's available.
    • If npm>=7 is not available from system/local nodejs environment, asks users to install npm>=7
    • This checks whether GUI build files are available on startup. If not, tell user to build the GUI app before starting.
      • This is to help users who accidentally run start-gui.sh before running install-gui.sh.

@ChiaMineJP
Copy link
Contributor

Found out that Ubuntu18 which is ec2 instance(t2.medium) with 4GB RAM struggles to process GUI build. Will do some researching how much RAM is sufficient to build GUI.

@ChiaMineJP
Copy link
Contributor

ChiaMineJP commented Feb 1, 2022

In my observation, install-gui.sh consumes 5.1GB at peak. So when running install-gui.sh user need to have at least 5.1GB free RAM.

OS RAM Env intall-gui.sh result
Ubuntu18.04(t2.medium) 4GB Clean install Sometimes runing out of memory, sometimes build process completes.
Ubuntu18.04(t2.large) 8GB Clean install / Update OK
Ubuntu20.04(t2.large) 8GB Clean install / Update OK
AmazonLinux2 kernel5.10(t2.large) 8GB Clean install / Update OK I've found an issue where default sqlite3 version is 3.7 at AML2 and it causes an error creating partial index Now fixed and working.
RHEL8.5 (t2.large) 8GB Clean install / Update OK (RHEL8.5 on ec2 did not have python installed by default. So I updated install.sh to install python which was missing in the script. See 256d7c3)
M1 Mac 16GB Clean install / Update OK
CentOS 7.9 8GB Clean install / Update OK, but user must run sudo yum update for refreshing TLS certs before kicking sh install.sh if it is just after OS installation. Otherwise wget https://www.sqlite.org fails
CentOS 8 Stream 8GB Clean install / Update OK
Rocky Linux 8.5 8GB Clean install / Update OK

@emlowe
Copy link
Contributor

emlowe commented Feb 4, 2022

I tested Ubuntu 18 and Rocky OS 8. Both worked fine, although those were not an entirely new OS install (I had installed previous versions of chia)

Centos 7 doesn't work as there is apparently no python 3.9 package and this causes a failure:
No package python39 available

@ChiaMineJP
Copy link
Contributor

@emlowe Thanks for testing. CentOS7, I'll check and fix the script. IIRC CentOS7 even do not have sudo installed by default so checking whether sudo exists is what I'm going to modify. But as far as installing sudo, I think I shouldn't because such an important security module should be installed by admin of the computer and should not be urged to install by non-admin user/application.
Will do my best to fix anyway.

@emlowe
Copy link
Contributor

emlowe commented Feb 5, 2022

I don't think I've ever installed Centos 7 and not had sudo.

@ChiaMineJP
Copy link
Contributor

IIRC CentOS7 in docker container used in CI runner for the rpm installer showed error that sudo was not available. I remember I was surprised to see that. I'll install CentOS7 on my local Hyper-V environment from CD installer and see whether sudo actually exists or not by default

@altendky altendky self-assigned this Feb 5, 2022
@ChiaMineJP
Copy link
Contributor

I've found that installing Python on CentOS7 does not come easy. You cannot simply sudo yum install python3.9 to install python3 because default package repository for CentOS7 seems not to have python(>=3.7) module(If you run sudo yum install python3 it tries to install Python3.6).
I'll find the way to install chia-compatible version of Python.

@altendky
Copy link
Contributor Author

altendky commented Feb 7, 2022

I didn't add any CentOS docker (CLI) installer tests exactly because they seemed to not provide new enough packages. Isn't CentOS dead anyways? Was Rocky, as you reference Earle, the replacement? Anyways, not a clean install here but worked straight away on Ubuntu 20.04. Thanks for all the work on this. I guess I'll go look at adding Rocky to the (CLI) installer test set.

@hoffmang9
Copy link
Member

I had earlier made the call that CentOS 8 was as far back as we need to go. I think it's safe to return to that thought.

@altendky
Copy link
Contributor Author

altendky commented Feb 7, 2022

@ChiaMineJP
Copy link
Contributor

I've updated install.sh to be run without error on CentOS7. I'm testing CentOS8 now.

@emlowe
Copy link
Contributor

emlowe commented Feb 7, 2022

Centos moved from a downstream model (Now called Centos Linux) to an upstream model and rebranded as Centos Stream

Centos Linux 7 is supported until 2024
Centos Linux 8 is EOL

Centos Stream 8 is supported until 2024, but because of the change in the model, this release gets patches continuously before they go into RHEL - there I don't think anyone is using it as they used to since it is upstream of RHEL it is no longer a bug-for-bug proxy for RHEL. Centos Stream 8 has no minor patch versions, as patches are just rolled into it whenever

Centos Stream 9 is also supported until 2027

Rocky 8 is a community-driven response to this change to make a release that is downstream of RHEL and is bug-for-bug compatible with RHEL 8 and is supported until 2029

Here endeth the saga that is Centos.

@ChiaMineJP
Copy link
Contributor

@wjblanke @emlowe @altendky
I tested the installer and 90% of work has been done.
For now I need to solve a problem where at AmazonLinux2 the default version of sqlite3 available is 3.7, which causes an error creating partial index. (create index xxx on yyy where zzz).
Once this issue is resolved, I'll suggest you to merge this PR.
Just FYI.
See #9921 (comment) for detail

@altendky
Copy link
Contributor Author

altendky commented Feb 9, 2022

Thanks for keeping this going. Whatever you have added support for in install.sh should get added to the matrix in test-install-scripts.yml.

distribution:
- name: amazonlinux:2
type: amazon
url: "docker://amazonlinux:2"
- name: arch:latest
type: arch
url: "docker://archlinux:latest"
# TODO: what CentOS version provides Python3.7-3.9?
- name: debian:buster
type: debian
# https://packages.debian.org/buster/python/python3 (3.7)
url: "docker://debian:buster"
- name: debian:bullseye
type: debian
# https://packages.debian.org/bullseye/python/python3 (3.9)
url: "docker://debian:bullseye"
- name: debian:bookworm
type: debian
# https://packages.debian.org/bookworm/python/python3 (3.9)
url: "docker://debian:bookworm"
- name: fedora:33
type: fedora
# (33, 3.9)
url: "docker://fedora:33"
- name: fedora:34
type: fedora
# (34, 3.9) https://packages.fedoraproject.org/search?query=python3&releases=Fedora+34&start=0
url: "docker://fedora:34"
# - name: fedora:35
# type: fedora
# # (35, 3.10) https://packages.fedoraproject.org/search?query=python3&releases=Fedora+35&start=0
# url: "docker://fedora:35"
- name: ubuntu:bionic (18.04)
type: ubuntu
# https://packages.ubuntu.com/bionic/python3.7 (18.04, 3.7)
url: "docker://ubuntu:bionic"
- name: ubuntu:focal (20.04)
type: ubuntu
# https://packages.ubuntu.com/focal/python3 (20.04, 3.8)
url: "docker://ubuntu:focal"
- name: ubuntu:hirsute (21.04)
type: ubuntu
# https://packages.ubuntu.com/hirsute/python3 (21.04, 3.9)
url: "docker://ubuntu:hirsute"
- name: ubuntu:impish (21.10)
type: ubuntu
# https://packages.ubuntu.com/impish/python3 (21.10, 3.9)
url: "docker://ubuntu:impish"

@ChiaMineJP
Copy link
Contributor

ChiaMineJP commented Feb 9, 2022

@altendky Added centos7/8 docker urls to the install test.
It seems official docker container for CentOS8 even cannot run yum update -y without error because of EOL.
I'll remove the test for centos8... On my CentOS8 installed from Disk worked. So this might be issue on docker image.
I've found a way for CentOS8 to run install-test-script without error.

Copy link
Contributor

@emlowe emlowe left a comment

Choose a reason for hiding this comment

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

Looks good - nice work!

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.

5 participants