Commit da31e172 authored by M. Huang's avatar M. Huang
Browse files

fdi docker validated

parent b53eec6c
......@@ -265,7 +265,7 @@ build_docker:
DOCKER_BUILDKIT=1 docker build -t $(DOCKER_NAME) --secret id=envs,src=$${HOME}/.secret --build-arg fd=$(fd) --build-arg re=$(re) $(PROXY) $(D) .
launch_docker:
docker run -it --network=bridge --env-file $(SECFILE) --name $(DOCKER_NAME) $(D) $(DOCKER_NAME) $(B)
docker run -dit --network=bridge --env-file $(SECFILE) --name $(DOCKER_NAME) $(D) $(DOCKER_NAME) $(B)
build_server:
DOCKER_BUILDKIT=1 docker build -t $(IMAGE_NAME) --secret id=envs,src=$${HOME}/.secret --build-arg fd=$(fd) --build-arg re=$(re) -f $(POOL_DOCKERFILE) $(D) .
......
......@@ -7,8 +7,7 @@ LABEL fd1 1.6
#ARG DEBIAN_FRONTEND=noninteractive
#ENV TZ=Etc/UTC
RUN apt-get update \
&& apt-get install -y apt-utils sudo \
&& apt-get install -y nano \
&& apt-get install -y apt-utils sudo nano net-tools\
&& apt-get install -y git python3-pip
# rebuild mark
......@@ -26,9 +25,6 @@ RUN groupadd ${USR} && useradd -g ${USR} ${USR} -m --home=${UHOME} -G sudo \
WORKDIR ${UHOME}
ENV PATH="${UHOME}/.local/bin:$PATH"
# setup config files
COPY fdi/pns/config.py .config/pnslocal.py
# config software
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.6 0 \
&& python3 -m pip install pip -U
......@@ -54,7 +50,7 @@ ARG fd=rebuild
WORKDIR ${PKGS_DIR}
ARG PKG=fdi
# from local repo
# from local repo. UNCOMMITED CHANGES ARE NOT INCUDED.
COPY --chown=${USR}:${USR} ./ /tmp/fdi_repo/
RUN git clone --depth 20 -b develop file:///tmp/fdi_repo ${PKG}
WORKDIR ${PKGS_DIR}/${PKG}/
......@@ -65,18 +61,21 @@ RUN make install EXT="[DEV,SERV]" I="--user"
#RUN python3 -m pip install http://mercury.bao.ac.cn:9006/mh/fdi/-/archive/develop/fdi-develop.tar.gz#egg=fdi[DEV,SERV]
#RUN python3 -m pip install fdi[DEV,SERV]
WORKDIR ${UHOME}
WORKDIR ${PKGS_DIR}
# entrypoint.sh is used for replacing IP/ports and configurations.
USER root
RUN chmod 755 ./entrypoint.sh
# dockerfile_entrypoint.sh replaces IP/ports and configurations.
# GET THE LOCAL COPY, with possible uncommited chhanges
COPY --chown=${USR}:${USR} dockerfile_entrypoint.sh ./
RUN chmod 755 dockerfile_entrypoint.sh
# setup config files
COPY --chown=${USR}:${USR} fdi/pns/config.py ${UHOME}/.config/pnslocal.py
USER ${USR}
# get passwords etc from ~/.secret
RUN --mount=type=secret,id=envs sudo cp /run/secrets/envs . \
&& sudo chown ${USR} envs \
&& for i in `cat ./envs`; do export $i; done \
&& ./httppool_server_entrypoint.sh
&& ./dockerfile_entrypoint.sh no-run # modify pnslocal.py
WORKDIR ${PKGS_DIR}/${PKG}/
RUN make test \
......@@ -84,6 +83,7 @@ RUN make test \
WORKDIR ${UHOME}
RUN /bin/ls -la; \
RUN pwd; /bin/ls -la; \
date > build
ENTRYPOINT ["/home/fdi/dockerfile_entrypoint.sh"]
\ No newline at end of file
......@@ -15,26 +15,24 @@ sed -i "s/^MQPORT =.*$/MQPORT = $MQ_PORT/g" ~/.config/pnslocal.py
sed -i "s/^MQUSER =.*$/MQUSER = \'$MQ_USER\'/g" ~/.config/pnslocal.py
sed -i "s/^MQPASS =.*$/MQPASS = \'$MQ_PASS\'/g" ~/.config/pnslocal.py
sed -i "s/^conf\s*=\s*.*$/conf = 'external'/g" ~/.config/pnslocal.py
echo ===== .config/pnslocal.py >> ~/lastent
grep ^conf ~/.config/pnslocal.py >> ~/lastent
grep ^EXTHOST ~/.config/pnslocal.py >> ~/lastent
grep ^EXTPORT ~/.config/pnslocal.py >> ~/lastent
grep ^BASE_POOLPATH ~/.config/pnslocal.py >> ~/lastent
grep ^SERVER_POOLPATH ~/.config/pnslocal.py >> ~/lastent
#service apache2 reload && echo apache2 reloaded
date >> ~/lastent
cat ~/lastent
echo @@@ $@
for i in $@; do
if [ $i = no-run ]; then exit 0; fi;
done
echo enabling site ... >> ~/lastent
sudo a2ensite httppool_server.conf
sudo a2dissite 000-default.conf
#service apache2 reload && echo apache2 reloaded
echo running apachectl >> ~/lastent ;
exec /usr/sbin/apache2ctl -DFOREGROUND 2>&1 >> ~/lastent ;
fi
/bin/sleep 99999999999
......@@ -3,6 +3,7 @@ from os.path import join
import logging
import getpass
import os
from os.path import expanduser, expandvars
pnsconfig = {}
......@@ -29,6 +30,9 @@ MQPASS = ''
MQHOST = '172.17.0.1'
MQPORT = 9876
BASE_POOLPATH = '/tmp'
SERVER_POOLPATH = '/tmp/data'
# base url for webserver. Update version if needed.
pnsconfig['api_version'] = 'v0.8'
pnsconfig['baseurl'] = '/' + pnsconfig['api_version']
......@@ -37,7 +41,9 @@ pnsconfig['baseurl'] = '/' + pnsconfig['api_version']
# default path of working directories for LocalPools.
pnsconfig['base_poolpath'] = '/tmp'
# default path of working directories for HttpPool server.
pnsconfig['server_poolpath'] = '/var/www/httppool_server/data' # For server
pnsconfig['server_poolpath'] = '/tmp/data'
# For server
# you must have write permission of above paths.
# For example : /home/user/Documents
# will be added at the beginning of request pool ID 'my_pool'
......@@ -73,10 +79,10 @@ if conf == 'dev':
pnsconfig['serveruser'] = 'mh'
pnsconfig['base_poolpath'] = '/tmp'
pnsconfig['server_poolpath'] = '/tmp/data' # For server
# on pns server
home = '/cygdrive/c/Users/mh'
# PTS app permission user
pnsconfig['ptsuser'] = 'mh'
# on pns server
home = '/home/' + pnsconfig['ptsuser']
elif conf == 'server_test':
pnsconfig['node'] = {'username': 'foo', 'password': 'bar',
......@@ -86,7 +92,7 @@ elif conf == 'server_test':
# PTS app permission user
pnsconfig['ptsuser'] = 'pns'
# on pns server
home = '/home'
home = '/home/' + pnsconfig['ptsuser']
elif conf == 'external':
# wsgi behind apach2. cannot use env vars
pnsconfig['node'] = {'username': 'foo', 'password': 'bar',
......@@ -98,13 +104,14 @@ elif conf == 'external':
username=MQUSER,
passwd=MQPASS,
)
# server permission user
pnsconfig['serveruser'] = 'apache'
pnsconfig['base_poolpath'] = BASE_POOLPATH
pnsconfig['server_poolpath'] = SERVER_POOLPATH # For server
# PTS app permission user
pnsconfig['ptsuser'] = 'pns'
# on pns server
home = '/home'
home = '/home/' + pnsconfig['ptsuser']
else:
pass
pnsconfig['auth_user'] = pnsconfig['node']['username']
......
......@@ -33,7 +33,9 @@ sed -i "s/^MQPORT =.*$/MQPORT = $MQ_PORT/g" ~/.config/pnslocal.py
sed -i "s/^MQUSER =.*$/MQUSER = \'$MQ_USER\'/g" ~/.config/pnslocal.py
sed -i "s/^MQPASS =.*$/MQPASS = \'$MQ_PASS\'/g" ~/.config/pnslocal.py
sed -i "s/^conf\s*=\s*.*$/conf = 'external'/g" ~/.config/pnslocal.py
sed -i "s/^SERVER_POOLPATH =.*$/SERVER_POOLPATH = \'/var/www/httppool_server/data\'/g" ~/.config/pnslocal.py
sed -i "s/^conf\s*=\s*.*$/conf = 'external'/g" ~/.config/pnslocal.py
echo ===== .config/pnslocal.py >> ~/lastent
grep ^conf ~/.config/pnslocal.py >> ~/lastent
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment