OpenWaterFoundation / cdss-app-snodas-tools

Colorado's Decision Support Systems (CDSS) Snow Data Assimilation System (SNODAS) Tools
8 stars 4 forks source link

Create script to package development files for deployment #30

Closed smalers closed 3 years ago

smalers commented 3 years ago

Need to create a simple script to package the development files for deployment. I recommend the following.

Create a file such as build-util/create-installer-tar.bash.

See this GeoProcessor script for an example of how to get the scriptFolder and other information.

I recommend that the software version should be defined in some code such as GeoProcessor version. The version can be simple like version=2.0.0. Use code like the following to get out of code:

version=cat ${someFile} | grep ... | cut ...)

In the bash script, figure out the folder using basename and dirname calls on ${scriptFolder} and then cd to the appropriate top-level folder. Then do something like:

tar -czvf ${buildsFolder}/cdss-tools-${version}.tar.gz

Where ${buildsFolder} points to builds under the repo, which should have a README.md but otherwise be git ignored.

There may be other nuances such as excluding data files from the tar. See the tar documentation for how to do such things with regular expressions and/or file lists.

Nightsphere commented 3 years ago

The script has been created as create-installer-tar.bash. It determines the version of the SNODAS_utilities.py script, tars the 5 folders in the test-CDSS folder which are:

  1. cloud/
  2. config/
  3. processedData/
  4. staticData/
  5. TsTool/

It then creates a scripts/ folder in the /tmp/ system folder, copies the contents of the scripts/ folder that contain the Python 3 scripts, compresses with gzip, and names the tar based on the version it found. Note that if appending one tar to another using the -r option, the original must not be compressed yet; it can only be gzipped after the tar contains all desired files and folders.

Closing the issue.