Commit a4d22647 authored by mh001's avatar mh001
Browse files

attempt to add docker entrypoint inhrit.read_only pool avoid deleting.

Showing with 62 additions and 14 deletions
+62 -14
# syntax=docker/dockerfile:1.2
FROM ubuntu:18.04 AS fdi
# 8 inherit ENTRYPOINT
# 1-6 M. Huang <mhuang@nao.cas.cn>
# 0.1 yuxin<syx1026@qq.com>
#ARG DEBIAN_FRONTEND=noninteractive
......@@ -157,8 +158,19 @@ WORKDIR ${UHOME}
RUN pwd; /bin/ls -la; env \
date > build
ENTRYPOINT ["/home/fdi/dockerfile_entrypoint.sh"]
CMD ["/bin/bash"]
# https://dev.to/francescobianco/override-docker-entrypoint-sh-into-dockerfile-4fh
USER root
COPY ${USR}:${USR} /home/fdi/dockerfile_entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN echo /bin/bash > /usr/local/bin/service-foreground.sh
RUN chown ${USR}:${USR} /usr/local/bin/service-foreground.sh
USER ${USR}
RUN chmod +x /usr/local/bin/service-foreground.sh /usr/local/bin/docker-entrypoint.sh
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["service-foreground.sh"]
ARG DOCKER_VERSION
ENV PNS_DOCKER_VERSION=${DOCKER_VERSION}
......
#!/bin/bash
id | tee ~/lastent_docker
echo ######
rm -rf /tmp/fditest* /tmp/data
date >> ~/lastent_docker
date >> ~/last_ent_fdi
cat ~/lastent_docker
echo @@@ $@
......
__version_info__ = (1, 36, 1)
__version_info__ = (1, 37, 0)
__version__ = '.'.join(map(str, __version_info__))
__revision__ = '1.36.1-3-g262a547'
__revision__ = '1.36.1-4-g2e4ba48'
# attempt to add docker entrypoint inhrit.read_only pool avoid deleting.
# 1.36.1 fix getUrn bug. vtse working.
# 1.36.0 read_only pools, single PoolManager for all. remove pool info in session. improve pool request processing and debugging info.rr
# 1.35.6 fix typo. make running docker
......
......@@ -16,6 +16,7 @@ set +a
sed -i "s/^conf\s*=\s*.*$/conf = 'production'/g" ~/.config/pnslocal.py
mkdir -p /var/log/uwsgi
if [ ! -d /var/log/uwsgi ]; then \
sudo mkdir -p /var/log/uwsgi && \
sudo chown -R fdi:fdi /var/log/uwsgi && \
......
......@@ -75,6 +75,15 @@ VOLUME /var/log ${PNS_SERVER_LOCAL_POOLPATH}/..
RUN date > build
USER root
COPY /home/fdi/dockerfile_entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN echo /bin/bash > /usr/local/bin/service-foreground.sh
RUN chown ${USR}:${USR} /usr/local/bin/service-foreground.sh /usr/local/bin/docker-entrypoint.sh
USER ${USR}
RUN chmod +x /usr/local/bin/service-foreground.sh /usr/local/bin/docker-entrypoint.sh
ENTRYPOINT ["/home/fdi/httppool_server_entrypoint_uwsgi.sh"]
#CMD ["uwsgi --master --module wsgi:app --processes 1"]
......@@ -86,4 +95,27 @@ RUN rm -rf /tmp/test* /tmp/data
ARG SERVER_VERSION
ENV PNS_SERVER_VERSION=${SERVER_VERSION}
LABEL PoolServer ${PNS_SERVER_VERSION}
LABEL poolserver_${PNS_SERVER_VERSION}
## Extend foreground script
# RUN echo uwsgi --ini httppool_server_uwsgi.ini > startsvr \
# && chmod 755 startsvr
# USER root
# RUN cd /usr/local/bin; \
# cp service-foreground service-foreground-inherit; \
# { \
# echo '#!/bin/bash'; \
# echo '[[ "$1" = "startsvr" ]] && { ~fdi/startsvr "$@"; exit; }'; \
# echo 'service-foreground-inherit "$@"'; \
# } > /usr/local/bin/service-foreground
# ## Extend entrypoint script
# RUN cd /usr/local/bin; \
# cp docker-entrypoint.sh docker-entrypoint-inherit.sh; \
# { \
# echo '#!/bin/bash'; \
# echo 'docker-entrypoint-inherit.sh no-run "$@"'; \
# echo '[[ "$1" = "startsvr" ]] && set -- startsvr "$@"'; \
# } > /usr/local/bin/docker-entrypoint.sh
......@@ -1008,7 +1008,7 @@ class PublicClientPool(ManagedPool):
raise ValueError('Tag must be a string or a list of string.')
return res
def doWipe(self, keep=True):
def doWipe(self, keep=True, include_read_only=False):
""" to do the action of wiping.
Parameters
......@@ -1047,8 +1047,11 @@ class PublicClientPool(ManagedPool):
else:
raise ServerError(msg)
r = read_from_cloud(
'wipePool', poolname=poolname, client=self.client, token=self.token, keep=keep)
if not include_read_only and poolname in self.getPoolManager().getMap().parents:
r = None
else:
r = read_from_cloud(
'wipePool', poolname=poolname, client=self.client, token=self.token, keep=keep)
if r is None:
logger.debug(f'Done removing {poolname}')
else:
......
......@@ -82,7 +82,7 @@ elif conf == 'production':
# For server. needed for test_pal so this should point to a locally
# writeable dir. If needed to change for a server, do it with
# an environment var.
pnsconfig['baseurl'] = '/fdi-dev/v0.16'
pnsconfig['baseurl'] = '/fdi/v0.16'
pnsconfig['self_host'] = '0.0.0.0'
pnsconfig['self_port'] = 9876
......
......@@ -585,6 +585,9 @@ def content2result_csdb(content):
code, text, url = resp # .status, resp.text(), resp.url.raw_path_qs
else:
# requests
if resp is None:
#__import__("pdb").set_trace()
return [None] * len(content) if alist else None
code, text, url = resp.status_code, resp.text, resp.url
obj = deserialize(text)
if issubclass(obj.__class__, str):
......
Supports Markdown
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