Skip to content
Snippets Groups Projects
Commit b277c1ac authored by David Schmitz's avatar David Schmitz
Browse files

install*.sh Dockerfile.fod.*: introduce 3-step installation: os deps; python...

install*.sh Dockerfile.fod.*: introduce 3-step installation: os deps; python deps; FoD proper install/setup, e.g., for better exploiting docker cache during container rebuilding
parent 44711cb7
Branches
No related tags found
No related merge requests found
# doc: to build+run: docker build -f Dockerfile.fod.centos -t fod.centos && docker run -ti fod.centos # doc: to build+run: docker build -f Dockerfile.fod.centos -t fod.centos . && docker run -ti fod.centos
############################################################################# #############################################################################
############################################################################# #############################################################################
...@@ -24,24 +24,57 @@ RUN yum -y install procps # somehow needed for centos repo installation in ./ins ...@@ -24,24 +24,57 @@ RUN yum -y install procps # somehow needed for centos repo installation in ./ins
############################################################################# #############################################################################
############################################################################# #############################################################################
# fod installation # fod installation: can be split into 3 parts: os dependencies; virtualenv+pip dependencies; fod proper installation/setup
# exploiting docker build cache to redo only what is necessary on rebuilding of the container:
# 1) os dependencies is time and network-bandwidth consuming; normally, not to be redone quite often (os deps for FoD normally do not change, only to be redone for updating to the lates updates); will be auto redone on rebuild only if install*.sh changed
# 2) pip dependencies is still somewhat time consuming; will be auto redone on rebuild only if either install*.sh or requirements*.txt* changed
# 3) for proper installation/setup, relatively fast; will be auto redone on rebuild if anything in the FoD dir, e.g. code, changed
WORKDIR /srv/flowspy WORKDIR /srv/flowspy
############################### #############################################################################
# fod installation step1 #############################################################################
# fod installation in a single step: (either using systemd or supervisord)
#COPY . /srv/flowspy #COPY . /srv/flowspy
#RUN rm -rf /srv/flowspy/venv #RUN rm -rf /srv/flowspy/venv
#RUN ./install-centos.sh --both --here --systemd --systemd_only_install
#RUN ./install-centos.sh --both --here --supervisord
COPY install-*.sh requirement*.txt* /srv/flowspy/ #############################################################################
#############################################################################
# fod installation in 2 steps: (either using systemd or supervisord)
# only install system+python deps (for quicker rebuilding by exploiting the docker cache for this step1): #COPY install-*.sh requirement*.txt* /srv/flowspy/
#RUN ./install-centos.sh --basesw --here --systemd --systemd_only_install #RUN ./install-centos.sh --basesw --here --systemd --systemd_only_install
RUN ./install-centos.sh --basesw --here --supervisord #RUN ./install-centos.sh --basesw --here --supervisord
#COPY . /srv/flowspy
#RUN rm -rf /srv/flowspy/venv
#RUN ./install-centos.sh --both --here --systemd --systemd_only_install
#RUN ./install-centos.sh --both --here --supervisord
#############################################################################
#############################################################################
###############################
# fod installation step1
# only install os deps (for quicker rebuilding by exploiting the docker cache for this step1):
COPY install-*.sh /srv/flowspy/
#RUN ./install-centos.sh --basesw_os --here --systemd --systemd_only_install
RUN ./install-centos.sh --basesw_os --here --supervisord
###############################
# fod installation step2
# only install virtualenv+pip/python deps (for quicker rebuilding by exploiting the docker cache for this step1):
COPY requirement*.txt* /srv/flowspy/
#RUN ./install-centos.sh --basesw_python --here --systemd --systemd_only_install
RUN ./install-centos.sh --basesw_python --here --supervisord
############################### ###############################
# fod installation step2 # fod installation step3
RUN mv /srv/flowspy/venv /srv/flowspy/venv.saved RUN mv /srv/flowspy/venv /srv/flowspy/venv.saved
COPY . /srv/flowspy COPY . /srv/flowspy
......
# doc: to build+run: docker build -f Dockerfile.fod.debian -t fod.debian && docker run -ti fod.debian # doc: to build+run: docker build -f Dockerfile.fod.debian -t fod.debian . && docker run -ti fod.debian
############################################################################# #############################################################################
############################################################################# #############################################################################
...@@ -26,22 +26,59 @@ ENV LC_ALL en_US.utf8 ...@@ -26,22 +26,59 @@ ENV LC_ALL en_US.utf8
############################################################################# #############################################################################
############################################################################# #############################################################################
# fod installation # fod installation: can be split into 3 parts: os dependencies; virtualenv+pip dependencies; fod proper installation/setup
# exploiting docker build cache to redo only what is necessary on rebuilding of the container:
# 1) os dependencies is time and network-bandwidth consuming; normally, not to be redone quite often (os deps for FoD normally do not change, only to be redone for updating to the lates updates); will be auto redone on rebuild only if install*.sh changed
# 2) pip dependencies is still somewhat time consuming; will be auto redone on rebuild only if either install*.sh or requirements*.txt* changed
# 3) for proper installation/setup, relatively fast; will be auto redone on rebuild if anything in the FoD dir, e.g. code, changed
WORKDIR /srv/flowspy WORKDIR /srv/flowspy
#############################################################################
#############################################################################
# fod installation in a single step: (either using systemd or supervisord)
#COPY . /srv/flowspy
#RUN rm -rf /srv/flowspy/venv
#RUN ./install-debian.sh --both --here --systemd --systemd_only_install
#RUN ./install-debian.sh --both --here --supervisord
#############################################################################
#############################################################################
# fod installation in 2 steps: (either using systemd or supervisord)
#COPY install-*.sh requirement*.txt* /srv/flowspy/
#RUN ./install-debian.sh --basesw --here --systemd --systemd_only_install
#RUN ./install-debian.sh --basesw --here --supervisord
#COPY . /srv/flowspy
#RUN rm -rf /srv/flowspy/venv
#RUN ./install-debian.sh --both --here --systemd --systemd_only_install
#RUN ./install-debian.sh --both --here --supervisord
#############################################################################
#############################################################################
############################### ###############################
# fod installation step1 # fod installation step1
COPY install-*.sh requirement*.txt* /srv/flowspy/ # only install os deps (for quicker rebuilding by exploiting the docker cache for this step1):
COPY install-*.sh /srv/flowspy/
#RUN ./install-debian.sh --basesw_os --here --systemd --systemd_only_install
RUN ./install-debian.sh --basesw_os --here --supervisord
# only install system+python deps (for quicker rebuilding by exploiting the docker cache for this step1): ###############################
#RUN ./install-debian.sh --basesw --here --systemd --systemd_only_install # fod installation step2
RUN ./install-debian.sh --basesw --here --supervisord
# only install virtualenv+pip/python deps (for quicker rebuilding by exploiting the docker cache for this step1):
COPY requirement*.txt* /srv/flowspy/
#RUN ./install-debian.sh --basesw_python --here --systemd --systemd_only_install
RUN ./install-debian.sh --basesw_python --here --supervisord
############################### ###############################
# fod installation step2 # fod installation step3
# handle /srv/flowspy/venv, having been already initialized above
RUN mv /srv/flowspy/venv /srv/flowspy/venv.saved RUN mv /srv/flowspy/venv /srv/flowspy/venv.saved
COPY . /srv/flowspy COPY . /srv/flowspy
RUN rm -rf /srv/flowspy/venv RUN rm -rf /srv/flowspy/venv
......
...@@ -55,8 +55,13 @@ FOD_SYSUSER="fod" ...@@ -55,8 +55,13 @@ FOD_SYSUSER="fod"
inside_docker=0 inside_docker=0
install_basesw=1 install_default_used=1
install_fodproper=1 #install_basesw_os=1
install_basesw_os=0
#install_basesw_python=1
install_basesw_python=0
#install_basesw_python=1
install_fodproper=0
install_with_supervisord=0 install_with_supervisord=0
install_systemd_services=0 install_systemd_services=0
...@@ -153,15 +158,38 @@ while [ $# -gt 0 ]; do ...@@ -153,15 +158,38 @@ while [ $# -gt 0 ]; do
shift 1 shift 1
elif [ $# -ge 1 -a "$1" = "--both" ]; then elif [ $# -ge 1 -a "$1" = "--both" ]; then
shift 1 shift 1
install_basesw=1 install_default_used=0
install_basesw_os=1
install_basesw_python=1
install_fodproper=1 install_fodproper=1
elif [ $# -ge 1 -a "$1" = "--basesw" ]; then elif [ $# -ge 1 -a "$1" = "--basesw" ]; then
shift 1 shift 1
install_basesw=1 install_default_used=0
install_fodproper=0
install_basesw_os=1
install_basesw_python=1
#install_fodproper=0
elif [ $# -ge 1 -a "$1" = "--basesw_os" ]; then
shift 1
install_default_used=0
install_basesw_os=1
#install_basesw_python=0
#install_fodproper=0
elif [ $# -ge 1 -a "$1" = "--basesw_python" ]; then
shift 1
install_default_used=0
#install_basesw_os=0
install_basesw_python=1
#install_fodproper=0
elif [ $# -ge 1 -a "$1" = "--fodproper" ]; then elif [ $# -ge 1 -a "$1" = "--fodproper" ]; then
shift 1 shift 1
install_basesw=0 install_default_used=0
#install_basesw_os=0
install_basesw_python=1
install_fodproper=1 install_fodproper=1
elif [ $# -ge 1 -a \( "$1" = "--supervisor" -o "$1" = "--supervisord" \) ]; then elif [ $# -ge 1 -a \( "$1" = "--supervisor" -o "$1" = "--supervisord" \) ]; then
shift 1 shift 1
...@@ -238,7 +266,15 @@ fi ...@@ -238,7 +266,15 @@ fi
#set -x #set -x
## ##
if [ "$install_default_used" = 1 ]; then
install_basesw_os=1
install_basesw_python=1
install_fodproper=1
fi
echo "$0: install_default_used=$install_default_used ; install_basesw_os=$install_basesw_os install_basesw_python=$install_basesw_python install_fodproper=$install_fodproper" 1>&2
[ -n "$setup_adminuser__email" ] || setup_adminuser__email="$setup_adminuser__username@localhost" [ -n "$setup_adminuser__email" ] || setup_adminuser__email="$setup_adminuser__username@localhost"
## ##
...@@ -268,7 +304,7 @@ echo "$0: inst_dir=$inst_dir fod_dir=$fod_dir => inst_dir_is_fod_dir=$inst_dir_i ...@@ -268,7 +304,7 @@ echo "$0: inst_dir=$inst_dir fod_dir=$fod_dir => inst_dir_is_fod_dir=$inst_dir_i
############################################################################# #############################################################################
############################################################################# #############################################################################
if [ "$install_basesw" = 1 ]; then if [ "$install_basesw_os" = 1 ]; then
# requires ./install-centos-fixcentos-sqlite.sh in case of CENTOS7 # requires ./install-centos-fixcentos-sqlite.sh in case of CENTOS7
...@@ -355,7 +391,7 @@ echo "$0: step 1b: preparing database system" 1>&2 ...@@ -355,7 +391,7 @@ echo "$0: step 1b: preparing database system" 1>&2
############################################################################# #############################################################################
############################################################################# #############################################################################
if [ "$install_fodproper" = 0 ]; then if [ "$install_fodproper" = 0 -a "$install_basesw_python" = 1 ]; then
echo "$0: step 2a: installing Python dependencies only" 1>&2 echo "$0: step 2a: installing Python dependencies only" 1>&2
...@@ -406,7 +442,7 @@ if [ "$install_fodproper" = 0 ]; then ...@@ -406,7 +442,7 @@ if [ "$install_fodproper" = 0 ]; then
echo "$0: step 2a done" 1>&2 echo "$0: step 2a done" 1>&2
else elif [ "$install_fodproper" = 1 ]; then
echo "$0: step 2: installing FoD in installation dir + ensuring Python dependencies are installed + setting-up FoD settings, database preparations, and FoD run-time environment" 1>&2 echo "$0: step 2: installing FoD in installation dir + ensuring Python dependencies are installed + setting-up FoD settings, database preparations, and FoD run-time environment" 1>&2
...@@ -472,8 +508,9 @@ else ...@@ -472,8 +508,9 @@ else
fi fi
#find "$fod_dir/" -not -user fod -exec chown -v fod: {} \; echo "$0: step 2.1a: fixing permissions" 1>&2
find "$fod_dir/" -not -user "$FOD_SYSUSER" -exec chown "$FOD_SYSUSER:" {} \; #find "$fod_dir/" -not -user fod -exec chown -v fod: {} \;
find "$fod_dir/" -not -user "$FOD_SYSUSER" -exec chown "$FOD_SYSUSER:" {} \;
### ###
...@@ -524,7 +561,7 @@ else ...@@ -524,7 +561,7 @@ else
echo "$0: step 2.3: ensuring Python dependencies are installed" 1>&2 echo "$0: step 2.3: ensuring Python dependencies are installed" 1>&2
if [ "$install_basesw" = 1 ]; then #are we running in --both mode, i.e. for the venv init is run for the first time, i.e. the problematic package having issues with to new setuptools is not yet installed? if [ "$install_basesw_python" = 1 ]; then #are we running in --both mode, i.e. for the venv init is run for the first time, i.e. the problematic package having issues with to new setuptools is not yet installed?
# fix for broken anyjson and cl # fix for broken anyjson and cl
# TODO: fix this more cleanly # TODO: fix this more cleanly
pip install 'setuptools<58' pip install 'setuptools<58'
......
...@@ -55,8 +55,13 @@ FOD_SYSUSER="fod" ...@@ -55,8 +55,13 @@ FOD_SYSUSER="fod"
inside_docker=0 inside_docker=0
install_basesw=1 install_default_used=1
install_fodproper=1 #install_basesw_os=1
install_basesw_os=0
#install_basesw_python=1
install_basesw_python=0
#install_basesw_python=1
install_fodproper=0
install_with_supervisord=0 install_with_supervisord=0
install_systemd_services=0 install_systemd_services=0
...@@ -226,15 +231,38 @@ while [ $# -gt 0 ]; do ...@@ -226,15 +231,38 @@ while [ $# -gt 0 ]; do
shift 1 shift 1
elif [ $# -ge 1 -a "$1" = "--both" ]; then elif [ $# -ge 1 -a "$1" = "--both" ]; then
shift 1 shift 1
install_basesw=1 install_default_used=0
install_basesw_os=1
install_basesw_python=1
install_fodproper=1 install_fodproper=1
elif [ $# -ge 1 -a "$1" = "--basesw" ]; then elif [ $# -ge 1 -a "$1" = "--basesw" ]; then
shift 1 shift 1
install_basesw=1 install_default_used=0
install_fodproper=0
install_basesw_os=1
install_basesw_python=1
#install_fodproper=0
elif [ $# -ge 1 -a "$1" = "--basesw_os" ]; then
shift 1
install_default_used=0
install_basesw_os=1
#install_basesw_python=0
#install_fodproper=0
elif [ $# -ge 1 -a "$1" = "--basesw_python" ]; then
shift 1
install_default_used=0
#install_basesw_os=0
install_basesw_python=1
#install_fodproper=0
elif [ $# -ge 1 -a "$1" = "--fodproper" ]; then elif [ $# -ge 1 -a "$1" = "--fodproper" ]; then
shift 1 shift 1
install_basesw=0 install_default_used=0
#install_basesw_os=0
install_basesw_python=1
install_fodproper=1 install_fodproper=1
elif [ $# -ge 1 -a \( "$1" = "--supervisor" -o "$1" = "--supervisord" \) ]; then elif [ $# -ge 1 -a \( "$1" = "--supervisor" -o "$1" = "--supervisord" \) ]; then
shift 1 shift 1
...@@ -346,7 +374,15 @@ fi ...@@ -346,7 +374,15 @@ fi
echo "conf_db_access=$conf_db_access DB_NAME=$DB__FOD_DBNAME DB_USER=$DB__FOD_USER DB_PASSWORD=$DB__FOD_PASSWORD" 1>&2 echo "conf_db_access=$conf_db_access DB_NAME=$DB__FOD_DBNAME DB_USER=$DB__FOD_USER DB_PASSWORD=$DB__FOD_PASSWORD" 1>&2
## ##
if [ "$install_default_used" = 1 ]; then
install_basesw_os=1
install_basesw_python=1
install_fodproper=1
fi
echo "$0: install_default_used=$install_default_used ; install_basesw_os=$install_basesw_os install_basesw_python=$install_basesw_python install_fodproper=$install_fodproper" 1>&2
[ -n "$setup_adminuser__email" ] || setup_adminuser__email="$setup_adminuser__username@localhost" [ -n "$setup_adminuser__email" ] || setup_adminuser__email="$setup_adminuser__username@localhost"
## ##
...@@ -371,7 +407,7 @@ echo "$0: inst_dir=$inst_dir fod_dir=$fod_dir => inst_dir_is_fod_dir=$inst_dir_i ...@@ -371,7 +407,7 @@ echo "$0: inst_dir=$inst_dir fod_dir=$fod_dir => inst_dir_is_fod_dir=$inst_dir_i
############################################################################# #############################################################################
############################################################################# #############################################################################
if [ "$install_basesw" = 1 ]; then if [ "$install_basesw_os" = 1 ]; then
echo "$0: step 1: installing base software dependencies (OS packages)" 1>&2 echo "$0: step 1: installing base software dependencies (OS packages)" 1>&2
...@@ -500,7 +536,7 @@ fi ...@@ -500,7 +536,7 @@ fi
############################################################################# #############################################################################
############################################################################# #############################################################################
if [ "$install_fodproper" = 0 ]; then if [ "$install_fodproper" = 0 -a "$install_basesw_python" = 1 ]; then
echo "$0: step 2a: installing Python dependencies only" 1>&2 echo "$0: step 2a: installing Python dependencies only" 1>&2
...@@ -533,7 +569,7 @@ if [ "$install_fodproper" = 0 ]; then ...@@ -533,7 +569,7 @@ if [ "$install_fodproper" = 0 ]; then
echo "$0: step 2a done" 1>&2 echo "$0: step 2a done" 1>&2
else elif [ "$install_fodproper" = 1 ]; then
echo "$0: step 2: installing FoD in installation dir + ensuring Python dependencies are installed + setting-up FoD settings, database preparations, and FoD run-time environment" 1>&2 echo "$0: step 2: installing FoD in installation dir + ensuring Python dependencies are installed + setting-up FoD settings, database preparations, and FoD run-time environment" 1>&2
...@@ -595,8 +631,9 @@ else ...@@ -595,8 +631,9 @@ else
fi fi
#find "$fod_dir/" -not -user fod -exec chown -v fod: {} \; echo "$0: step 2.1a: fixing permissions" 1>&2
find "$fod_dir/" -not -user "$FOD_SYSUSER" -exec chown "$FOD_SYSUSER:" {} \; #find "$fod_dir/" -not -user fod -exec chown -v fod: {} \;
find "$fod_dir/" -not -user "$FOD_SYSUSER" -exec chown "$FOD_SYSUSER:" {} \;
### ###
...@@ -640,7 +677,7 @@ else ...@@ -640,7 +677,7 @@ else
echo "$0: step 2.3: ensuring Python dependencies are installed" 1>&2 echo "$0: step 2.3: ensuring Python dependencies are installed" 1>&2
if [ "$install_basesw" = 1 ]; then #are we running in --both mode, i.e. for the venv init is run for the first time, i.e. the problematic package having issues with to new setuptools is not yet installed? if [ "$install_basesw_python" = 1 ]; then #are we running in --both mode, i.e. for the venv init is run for the first time, i.e. the problematic package having issues with to new setuptools is not yet installed?
# fix for broken anyjson and cl # fix for broken anyjson and cl
# TODO: fix this more cleanly # TODO: fix this more cleanly
pip install 'setuptools==57.5.0' pip install 'setuptools==57.5.0'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment