arras-energy / gridlabd-old

HiPAS GridLAB-D is the California Energy Commission (CEC) version of GridLAB-D.
https://docs.gridlabd.us
BSD 3-Clause "New" or "Revised" License
33 stars 31 forks source link

Fix setup/build/install scripts #1282

Closed dchassin closed 1 year ago

dchassin commented 1 year ago

This PR clearly separates the setup, build, and install actions for every supported platform. The PR involves a great deal of refactoring of source files, removal of unused or obsolete files, updated README files, and restructuring of the install target folder.

Scripts

./setup.sh --help

Use the --local option to install from the local repo. Otherwise, it will pull the setup script from slacgismo/gridlabd/master or from GRIDLABD_ORIGIN if it is exported.

./build.sh --help

Use the --system option to install for all system users. Use --clean to rebuild from scratch. Use --parallel to enable faster compilation.

export INSTALL_SOURCE=https://install-dev.gridlabd.us
curl -sL https://raw.githubusercontent.com/dchassin/gridlabd/develop-fix-install/install.sh | sh

If you want regular users to run gridlabd, then do not install the downloadable image as root. Instead make sure the current user has permission to install applications, e.g., by belonging to a group with root permission. For example, on Ubuntu systems you can add the current user to the list sudoers with the command

su -c "echo $USER ALL=NOPASSWD: ALL >/etc/sudoers.d/$USER" root

Then you can install using sudo, give groups with root access permission to access the install, and add the user to the root access group e.g.,

export INSTALL_SOURCE=https://install-dev.gridlabd.us
curl -sL https://raw.githubusercontent.com/dchassin/gridlabd/develop-fix-install/install.sh | sudo sh
sudo chmod -R g+rwx ~root /usr/local
sudo adduser $USER root
sudo adduser $USER tty

Remember that changes in group membership don't take effect until you login again.

Depending on the group permissions setup of the host system, these specific command may differ, e.g., root access is granted through the group wheel or admin. In any case, users must have access to GridLAB-D's python virtual environments for build (~root/.gridlabd) and runtime (/usr/local/opt/gridlabd/current/bin/pkgenv) through group membership.

Supported platforms

Additional tasks completed:

AWS uploads

You must have aws-cli installed and have valid AWS credentials to access install.gridlabd.us and install-dev.gridlabd.us. If you are working with a development branch, the uploads will be delivered to install-dev.gridlabd.us. If you are working on the master branch, they will be delivered to install.gridlabd.us.

Tips

Some Ubuntu installs bring up a dialog to confirm restarts system services after the daemons are upgraded to support GridLAB-D. To suppress this dialog and automatically restart the daemons, see https://askubuntu.com/questions/1367139/apt-get-upgrade-auto-restart-services.

Note: all instances of hipas have been changed back to slacgismo pending the transfer to arras-energy. However, instances in docker and .github that refer to dockerhub remain pending the changes to the CI/CD procedure that builds those images.