diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 4b80b2b28de46ed3b9c43f6050405b4f6f635eab..0000000000000000000000000000000000000000 --- a/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ - -FROM centos:7 - -ENV LC_ALL en_US.utf8 - -RUN yum -y install procps - -RUN mkdir -p /var/log/fod /srv -COPY . /srv/flowspy -#COPY supervisord-centos.conf /srv/flowspy/supervisord.conf - -RUN rm -rf /srv/flowspy/venv/ - -RUN (cd /srv/flowspy; ./install-centos.sh;) - -# echo "To set environment to English, run: export LC_ALL=en_US" -# echo "To activate virualenv: source /srv/venv/bin/activate" -# echo "To create a user run: cd /srv/flowspy; ./manage.py createsuperuser" -# echo "To start flowspy server: cd /srv/flowspy; ./manage.py runserver 0.0.0.0:8000" -# echo "To start celeryd: cd /srv/flowspy; ./manage.py celeryd" - -EXPOSE 8000 - -CMD [ "/srv/flowspy/runfod.sh" ] - diff --git a/Dockerfile b/Dockerfile new file mode 120000 index 0000000000000000000000000000000000000000..440b222c2252e208262c91f38df00e273dbe54d4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1 @@ +Dockerfile.fod.debian \ No newline at end of file diff --git a/Dockerfile.fod.centos.new b/Dockerfile.fod.centos.new new file mode 100644 index 0000000000000000000000000000000000000000..d5ca319ddb004d3223de0888330b42c4e6bdc580 --- /dev/null +++ b/Dockerfile.fod.centos.new @@ -0,0 +1,72 @@ + +# doc: to build+run: docker build -f Dockerfile.fod.centos -t fod.centos && docker run -ti fod.centos + +############################################################################# +############################################################################# + +FROM centos:7 + +############################################################################# + +ENV LC_ALL en_US.utf8 + +RUN yum -y install procps # somehow needed for centos repo installation in ./install-centos.sh + +############################################################################# + +# uncomment, for running under systemd +#RUN apt-get update -y -y && centos_FRONTEND="noninteractive" apt-get install -y -y systemd-sysv systemd + +############################################################################# + +# typically useful tools for investigation +#RUN apt-get update -y -y && centos_FRONTEND="noninteractive" apt-get install -y -y git less man make gcc strace ltrace lsof file vim tshark tcpdump curl wget net-tools sudo psutils procps iptables iputils-ping iputils-tracepath hping3 iproute2 + +############################################################################# +############################################################################# +# fod installation + +WORKDIR /srv/flowspy + +############################### +# fod installation step1 + +COPY . /srv/flowspy +RUN rm -rf /srv/flowspy/venv + +COPY install-*.sh requirement*.txt /srv/flowspy/ + +# only install system+python deps (for quicker rebuilding by exploiting the docker cache for this step1): +#RUN ./install-centos.sh --basesw --here --systemd --systemd_only_install +RUN bash ./install-centos.sh --basesw --here --supervisord + +############################### +# fod installation step2 + +COPY . /srv/flowspy +#RUN rm -rf /srv/flowspy/venv + +#RUN bash ./install-centos.sh --fodproper --here --supervisord --setup_admin_user --setup_admin_user5 admin adminpwd admin@localhost.local testpeer 0.0.0.0/0 --exabgp 10.3.10.3 10.3.10.3 1001 10.3.10.10 10.3.10.10 2001 +#RUN bash ./install-centos.sh --both --here --supervisord --setup_admin_user --setup_admin_user5 admin adminpwd admin@localhost.local testpeer 0.0.0.0/0 --exabgp 172.17.0.2 172.17.0.2 1001 172.17.0.3 172.17.0.3 3001 +#RUN bash ./install-centos.sh --both --here --systemd --systemd_only_install --setup_admin_user --setup_admin_user5 admin adminpwd admin@localhost.local testpeer 0.0.0.0/0 # --exabgp 172.17.0.2 172.17.0.2 1001 172.17.0.3 172.17.0.3 3001 +RUN ./install-centos.sh --fodproper --here --supervisord --setup_admin_user --setup_admin_user5 admin adminpwd admin@localhost.local testpeer 0.0.0.0/0 # --exabgp 172.17.0.2 172.17.0.2 1001 172.17.0.3 172.17.0.3 3001 + +############################### + +# potential standalone re-setup of exabgp later (e.g., to exploit docker build cache for the actual installation step(s) above) +#RUN cd /opt/FOD/ && ./exabgp/run-exabgp-generic --init-conf 10.3.10.3 10.3.10.3 1001 10.3.10.10 10.3.10.12 3001 -- --systemd + +############################################################################# +############################################################################# +# running fod + +EXPOSE 8000 + +# if running under systemd +#CMD [ "/sbin/init" ] + +CMD [ "/srv/flowspy/runfod.sh" ] + +############################################################################# +############################################################################# + diff --git a/Dockerfile.fod.centos.old b/Dockerfile.fod.centos.old new file mode 100644 index 0000000000000000000000000000000000000000..4b80b2b28de46ed3b9c43f6050405b4f6f635eab --- /dev/null +++ b/Dockerfile.fod.centos.old @@ -0,0 +1,25 @@ + +FROM centos:7 + +ENV LC_ALL en_US.utf8 + +RUN yum -y install procps + +RUN mkdir -p /var/log/fod /srv +COPY . /srv/flowspy +#COPY supervisord-centos.conf /srv/flowspy/supervisord.conf + +RUN rm -rf /srv/flowspy/venv/ + +RUN (cd /srv/flowspy; ./install-centos.sh;) + +# echo "To set environment to English, run: export LC_ALL=en_US" +# echo "To activate virualenv: source /srv/venv/bin/activate" +# echo "To create a user run: cd /srv/flowspy; ./manage.py createsuperuser" +# echo "To start flowspy server: cd /srv/flowspy; ./manage.py runserver 0.0.0.0:8000" +# echo "To start celeryd: cd /srv/flowspy; ./manage.py celeryd" + +EXPOSE 8000 + +CMD [ "/srv/flowspy/runfod.sh" ] + diff --git a/Dockerfile.fod.debian b/Dockerfile.fod.debian new file mode 100644 index 0000000000000000000000000000000000000000..0de94a6bd3715f25c103566347e307ed956085af --- /dev/null +++ b/Dockerfile.fod.debian @@ -0,0 +1,72 @@ + +# doc: to build+run: docker build -f Dockerfile.fod.debian -t fod.debian && docker run -ti fod.debian + +############################################################################# +############################################################################# + +FROM debian:latest + +RUN apt-get -qqy update + +############################################################################# + +RUN echo -e 'LANG="en_US.UTF-8"\nLANGUAGE="en_US"\n' > /etc/default/locale && echo "en_US.utf8 UTF-8" >> /etc/locale.gen && apt-get -qqy install locales + +ENV LC_ALL en_US.utf8 + +############################################################################# + +# uncomment, for running under systemd +#RUN apt-get update -y -y && DEBIAN_FRONTEND="noninteractive" apt-get install -y -y systemd-sysv systemd + +############################################################################# + +# typically useful tools for investigation +#RUN apt-get update -y -y && DEBIAN_FRONTEND="noninteractive" apt-get install -y -y git less man make gcc strace ltrace lsof file vim tshark tcpdump curl wget net-tools sudo psutils procps iptables iputils-ping iputils-tracepath hping3 iproute2 + +############################################################################# +############################################################################# +# fod installation + +WORKDIR /srv/flowspy + +############################### +# fod installation step1 + +COPY install-*.sh requirement*.txt /srv/flowspy/ + +# 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 +RUN ./install-debian.sh --basesw --here --supervisord + +############################### +# fod installation step2 + +COPY . /srv/flowspy +RUN rm -rf /srv/flowspy/venv + +# to be sure, try again to install newest deps, i.e., use --both instead of just --fodproper: +#RUN ./install-debian.sh --fodproper --here --supervisord --setup_admin_user --setup_admin_user5 admin adminpwd admin@localhost.local testpeer 0.0.0.0/0 --exabgp 10.3.10.3 10.3.10.3 1001 10.3.10.10 10.3.10.10 2001 +#RUN ./install-debian.sh --both --here --supervisord --setup_admin_user --setup_admin_user5 admin adminpwd admin@localhost.local testpeer 0.0.0.0/0 --exabgp 172.17.0.2 172.17.0.2 1001 172.17.0.3 172.17.0.3 3001 +#RUN ./install-debian.sh --both --here --systemd --systemd_only_install --setup_admin_user --setup_admin_user5 admin adminpwd admin@localhost.local testpeer 0.0.0.0/0 # --exabgp 172.17.0.2 172.17.0.2 1001 172.17.0.3 172.17.0.3 3001 +RUN ./install-debian.sh --both --here --supervisord --setup_admin_user --setup_admin_user5 admin adminpwd admin@localhost.local testpeer 0.0.0.0/0 # --exabgp 172.17.0.2 172.17.0.2 1001 172.17.0.3 172.17.0.3 3001 + +############################### + +# potential standalone re-setup of exabgp later (e.g., to exploit docker build cache for the actual installation step(s) above) +#RUN cd /opt/FOD/ && ./exabgp/run-exabgp-generic --init-conf 10.3.10.3 10.3.10.3 1001 10.3.10.10 10.3.10.12 3001 -- --systemd + +############################################################################# +############################################################################# +# running fod + +EXPOSE 8000 + +# if running under systemd +#CMD [ "/sbin/init" ] + +CMD [ "/srv/flowspy/runfod.sh" ] + +############################################################################# +############################################################################# + diff --git a/install-centos-fixcentos-sqlite.sh b/install-centos-fixcentos-sqlite.sh index 2416d1320c15a437e5b98e5ab37015d0bdd8a331..02d0a00b034de008caedb4216308953de1d102c4 100755 --- a/install-centos-fixcentos-sqlite.sh +++ b/install-centos-fixcentos-sqlite.sh @@ -17,7 +17,7 @@ if cat /etc/centos-release | grep -q "release 7."; then yum install -y make #cd ~ && curl https://www.sqlite.org/2020/sqlite-autoconf-3320100.tar.gz > sqlite-autoconf-3320100.tar.gz && tar xvfz sqlite-autoconf-3320100.tar.gz && cd sqlite-autoconf-3320100 && ./configure && make && make install - cd ~ && curl https://www.sqlite.org/2023/sqlite-autoconf-3410200.tar.gz > sqlite-autoconf.tar.gz && tar xvfz sqlite-autoconftar.gz && cd sqlite-autoconf-3410200 && ./configure && make && make install + cd ~ && curl https://www.sqlite.org/2023/sqlite-autoconf-3410200.tar.gz > sqlite-autoconf.tar.gz && tar xvfz sqlite-autoconf.tar.gz && cd sqlite-autoconf-3410200 && ./configure && make && make install ## diff --git a/install-centos.sh b/install-centos.sh index 72fc1658d055c1b0eede9aada4a1a5727d8dc488..0ef3282a4fb980717ea1927eb648e31a5359b1b1 100755 --- a/install-centos.sh +++ b/install-centos.sh @@ -138,7 +138,6 @@ while [ $# -gt 0 ]; do elif [ $# -ge 1 -a "$1" = "--no_systemd" ]; then shift 1 install_systemd_services=0 - else elif [ $# -ge 1 -a "$1" = "--setup_admin_user" ]; then shift 1 setup_adminuser=1 @@ -305,6 +304,8 @@ if [ "$install_fodproper" = 0 ]; then set -e echo "Setup partial python environment for FoD" + + (ls -la "$venv_dir" 1>&2 || true) if [ -x pyvenv ]; then #pyvenv /srv/venv pyvenv "$venv_dir" diff --git a/runfod.sh b/runfod.sh index 82969602e23293980f1758d7e9b58f06df069dbd..8cb3e5bcdae254cd5225a5000943bccc69f03eea 100755 --- a/runfod.sh +++ b/runfod.sh @@ -6,7 +6,22 @@ fi # -if [ "$FOD_RUNMODE" = "via_supervisord" ]; then +if [ "$FOD_RUNMODE" = "via_systemd" ]; then + echo "$0: using runmode via_systemd, nothing todo" 1>&2 + + SYSTEMD_COLORS=1 systemctl status "fod-gunicorn" | cat + echo + + SYSTEMD_COLORS=1 systemctl status "fod-celeryd" | cat + echo + + SYSTEMD_COLORS=1 systemctl status "redis" | cat + echo + + SYSTEMD_COLORS=1 systemctl status "exabgpForFod" | cat + echo + +elif [ "$FOD_RUNMODE" = "via_supervisord" ]; then echo "$0: using runmode via_supervisord" 1>&2 exec ./runfod-supervisord.sh "$@" else