2## @brief Framework entrypoint
4## Include this file in your script to use ec2pinit's functions
7## @section intro_sec Introduction
9## This shell library is useful if you are not a systems administrator but want to spin up an EC2 image to do data analysis or research. ec2_post_init provides a simple easy to use API that can:
11## - Install system software (see: ``system.inc.sh :: sys_pkg_install()``)
12## - Install Docker (see: ``docker.inc.sh :: docker_setup()``)
13## - Install Miniconda3 (see: ``miniconda.inc.sh :: mc_install()``)
14## - Install STScI pipelines (see: ``astroconda.inc.sh``)
15## - ``ac_releases_install_hst()``
16## - ``ac_releases_install_jwst()``
17## - ``ac_releases_install_data_analysis()``
19## @section require_sec Supported Operating Systems
29## @section install_sec Installing
31## @subsection install_system_subsec System installation
36## sudo make install PREFIX=/usr/local
39## @subsection install_portable_subsec Portable installation
41## If you don't want to install ec2_post_init permanently, you don't have to. This is especially useful for systems that provide ``curl`` and ``tar`` by default but lack ``git`` and ``make``. Here is how to use ec2_post_init from its source directory:
46## export PATH=$(pwd)/bin:$PATH
49## @section usage_sec Using ec2_post_init
51## Now you can include the library in your own script by sourcing ``ec2pinit.inc.sh``...
56## # Load ec2_post_init
57## source ec2pinit.inc.sh
62## To see how one can use ec2_post_init to populate a system with Miniconda3 and the three major STScI pipeline releases, please refer to the @ref full_example_page page. The API reference for each library module can be found <a href="files.html">here</a>.
64## @section install_develop_sec Developing
66## To write code for ec2_post_init you should have access to an EC2 instance, or a host with ``docker`` or ``vagrant`` installed.
71## export PATH=$(pwd)/bin:$PATH
74## To test ec2_post_init using docker:
77## docker run --rm -it -v $(pwd):/data -w /data centos:7 /bin/bash
78## [root@abc123 data]# export PATH=$PATH:/data/bin
79## [root@abc123 data]# cd tests
80## [root@abc123 tests]# ./run_tests.sh
83## To test ec2_post_init using vagrant (VirtualBox):
86## mkdir -p ~/vagrant/centos/7
87## cd ~/vagrant/centos/7
90## Create a new ``Vagrantfile``. Be sure to change any paths to match your local system
93## Vagrant.configure("2") do |config|
94## config.vm.box = "generic/centos7"
96## # Mount the ec2_post_init source directory at /data inside of the VM
97## config.vm.synced_folder "/home/example/my_code/ec2_post_init", "/data"
99## # Change VM resources
100## config.vm.provider "virtualbox" do |v|
107## Provision the VM, log in, and execute the test suite:
111## vagrant ssh sudo -i
112## [root@vagrant123 ~]# export PATH=$PATH:/data/bin
113## [root@vagrant123 data]# cd /data/tests
114## [root@vagrant123 tests]# ./run_tests.sh
117## @page full_example_page Full example
118## @include cumulative.sh
120## @page license_page License
121## @include LICENSE.txt
123(( $EC2PINIT_INCLUDED )) &&
return
126## @property ec2pinit_root
127## @brief Path to ec2pinit directory
129## Do not change this value
130ec2pinit_root=
"$(readlink -f $(dirname ${BASH_SOURCE[0]})/..)"
133## @property ec2pinit_framework
134## @brief Path to framework directory
136## Do not change this value
139# Adjust the framework path when we're installed as a system package
140if [ ! -d
"$ec2pinit_framework" ]; then
145## @property ec2pinit_tempdir
146## @brief Where ec2pinit will store temporary data
148## Do not change this value
152## FLAG - Print info messages
156## FLAG - Print warning messages
160## FLAG - Print error messages
164## FLAG - Print only warnings and errors
168## FLAG - Print all messages
172## @property ec2pinit_debug
173## @brief Debug output control
175## Set print statement behavior with: ``DEBUG_INFO``, ``DEBUG_WARN``, and ``DEBUG_ERROR``
177## ec2pinit_debug=$(( DEBUG_WARN | DEBUG_ERROR ))
182# If the user modifies debug flags through the environment
183# verify an integer was received. If not then use the defaults
184if ! [[
"$ec2pinit_debug" =~ [0-9]+ ]]; then
185 # pre-IO function availability
186 echo
"WARN: ec2pinit_debug: Must be a positive integer!" >&2
187 echo
"WARN: Using DEBUG_DEFAULT ($DEBUG_DEFAULT)." >&2
193 io_error "Please open an issue at: https://github.com/spacetelescope/ec2_post_init"
197 ([ -f /.dockerenv ] && echo Docker) || echo
'Physical / Virtualized'
211 echo EC2_POST_INIT INFO
212 echo ==================
213 set | grep -E
'^(ec2pinit|EC2PINIT|ec2_post_init|HAVE_|HOME|USER|PWD|sys_manager_)' | sort
218mkdir -p
"$ec2pinit_tempdir"
219source $ec2pinit_framework/io.inc.sh
220source $ec2pinit_framework/system.inc.sh
224 bug_report
"OPERATING SYSTEM IS NOT SUPPORTED"
228 bug_report
"UNABLE TO INITIALIZE BASE OPERATING SYSTEM PACKAGES"
233source $ec2pinit_framework/miniconda.inc.sh
234source $ec2pinit_framework/astroconda.inc.sh
235source $ec2pinit_framework/docker.inc.sh
237# Ensure any external success checks succeed
io_error(...)
Print an error message.
sys_initialize()
Install dependencies required by ec2_post_init
Exported String HAVE_SUPPORT
System is supported.
Exported String ec2pinit_tempdir
Where ec2pinit will store temporary data.
Exported String DEBUG_WARN
FLAG - Print warning messages.
Exported String ec2pinit_root
Path to ec2pinit directory.
Exported String ec2pinit_framework
Path to framework directory.
Exported String DEBUG_ALL
FLAG - Print all messages.
Exported String ec2pinit_debug
Debug output control.
Exported String DEBUG_DEFAULT
FLAG - Print only warnings and errors.
Exported String DEBUG_ERROR
FLAG - Print error messages.
Exported String DEBUG_INFO
FLAG - Print info messages.