Browse Source

bug fixed: limited basex version to 9.4.6

bach 2 years ago
parent
commit
8a0ebb3214
8 changed files with 109 additions and 30 deletions
  1. 4 3
      Docker/basex/Dockerfile
  2. 22 0
      Docker/basex/gdp-entrypoint.sh
  3. 51 16
      Docker/client/Dockerfile
  4. 28 8
      Makefile
  5. 1 1
      client
  6. 1 1
      data
  7. 1 0
      docker-compose.yml
  8. 1 1
      webapp

+ 4 - 3
Docker/basex/Dockerfile

@@ -1,7 +1,7 @@
-FROM basex/basexhttp:latest
+FROM basex/basexhttp:9.4.6
 
-COPY ./bashrc /srv/.bashrc
-COPY ./inputrc /srv/.inputrc
+# COPY ./bashrc /srv/.bashrc
+# COPY ./inputrc /srv/.inputrc
 
 # RUN basex "db:create('gdp','/srv/basex/src/gdp.tei.xml', (),map {'ftindex': true(),'stemming': true(),'casesens': true(),'diacritics': true(),'language': 'fr','updindex': true(),'autooptimize': true(),'maxlen': 96,'maxcats': 100,'splitsize': 0,'chop': false(),'textindex': true(),'attrindex': true(),'tokenindex': true(), 'xinclude': true()})"
 
@@ -9,5 +9,6 @@ COPY ./gdp-entrypoint.sh /usr/local/bin
 USER root
 RUN chmod +x /usr/local/bin/gdp-entrypoint.sh
 # RUN ln -s /usr/local/bin/gdp-entrypoint.sh /srv/ # backwards compat
+# RUN chown -R basex:basex /srv/basex
 USER basex
 CMD ["/bin/sh","/usr/local/bin/gdp-entrypoint.sh"]

+ 22 - 0
Docker/basex/gdp-entrypoint.sh

@@ -2,6 +2,8 @@
 
 # todo: run some checks
 
+id
+
 echo "Creating GDP BaseX db"
 basex "db:create('gdp','/srv/basex/src/gdp.tei.xml', (),map {'ftindex': true(),'stemming': true(),'casesens': true(),'diacritics': true(),'language': 'fr','updindex': true(),'autooptimize': true(),'maxlen': 96,'maxcats': 100,'splitsize': 0,'chop': false(),'textindex': true(),'attrindex': true(),'tokenindex': true(), 'xinclude': true()})"
 # , 'serializer': 'indent=no'
@@ -13,6 +15,26 @@ echo "Creating FullText Index DB"
 basex "db:create('gdpFtIndex', '/tmp/gdpFtIndex.xml', (),map {'ftindex': true(),'stemming': true(),'casesens': true(),'diacritics': true(),'language': 'fr','updindex': true(),'autooptimize': true(),'maxlen': 96,'maxcats': 100,'splitsize': 0,'chop': false(),'textindex': true(),'attrindex': true(),'tokenindex': true(), 'xinclude': true()})"
 # , 'serializer': 'indent=no'
 
+# echo "Creating Advanced Search Index"
+# basex -q "import module namespace gdp.models.tei = 'gdp.models.tei' at '/srv/basex/webapp/synopsx/workspace/gdp/models/tei.xqm' ;
+# let $index := ('gdpIndexNominum', 'gdpIndexLocorum')
+# return gdp.models.tei:addId2IndexedEntities($index)"
+# basex "declare namespace tei = 'http://www.tei-c.org/ns/1.0' ;
+# let $db := db:open('gdp')
+#   let $index := $db//tei:TEI[tei:teiHeader//tei:sourceDesc[@xml:id = $indexId]]
+#   for $occurence in fn:distinct-values($index//tei:listRelation/tei:relation/@passive ! fn:tokenize(., '\s+'))
+#   let $entries := $index//*[tei:listRelation/tei:relation[fn:contains(@passive, $occurence)]]
+#   let $element := $db//*[@xml:id = fn:substring-after($occurence, '#')]
+#   let $values := for $entry in $entries/@xml:id return fn:concat('#', $entry)
+#   return
+#     if ($element[fn:not(@ref)])
+#     then insert node attribute ref { $values } into $element
+#     else replace value of node $element/@ref with $values"
+
 # as we override the parent container CMD, we have to launch basexhttp here
 echo "Launching basexhttp"
 basexhttp
+
+# todo never launched, prev command never ends
+echo "Launching indexing"
+wget -S http://localhost:8984/indexing

+ 51 - 16
Docker/client/Dockerfile

@@ -1,33 +1,68 @@
+# FROM node:lts-alpine
+
+# RUN apk update && apk --no-cache add shadow && \
+#     usermod -u 1001 node && \
+#     groupmod -g 1001 node
+
+# ARG UID=1000
+# ARG UNAME=gdp
+# ARG GID=1000
+# ARG GNAME=users
+
+# #RUN find / -group ${UID} -exec chgrp -h node {} \;
+# #RUN find / -user ${UID} -exec chown -h node {} \;
+
+# # RUN addgroup -g ${GID} ${GNAME}
+# RUN if [ $(getent group ${GNAME}) ]; then echo "group ${GNAME} already exists"; else addgroup -g ${GID} ${GNAME}; fi
+# # else
+# #   echo "group does not exist."
+# # fi
+#     # adduser -h /home/gdp -D -u 1000 gdp && \
+# RUN adduser -u ${UID} -G ${GNAME} -s /bin/sh -D ${UNAME}
+#     # chown -R gdp:gdp /home/gdp
+
+# USER ${UNAME}
+
+# COPY ./bashrc /home/${UNAME}/.bashrc
+# COPY ./inputrc /home/${UNAME}/.inputrc
+
+# COPY ./client-entrypoint.sh /usr/local/bin
+# USER root
+# RUN chmod +x /usr/local/bin/client-entrypoint.sh
+# USER ${UNAME}
+# CMD ["/bin/sh","/usr/local/bin/client-entrypoint.sh"]
+
+
+# /////////////////////////////////////////////////////////////////////////////////
+
+
 FROM node:lts-alpine
 
 RUN apk update && apk --no-cache add shadow && \
     usermod -u 1001 node && \
     groupmod -g 1001 node
 
-ARG UID=1000
-ARG UNAME=gdp
-ARG GID=1000
-ARG GNAME=users
+RUN find / -group 1000 -exec chgrp -h node {} \;
+RUN find / -user 1000 -exec chown -h node {} \;
+
+ARG USER_UID
+ARG USER_UNAME
+ARG USER_GID
+ARG USER_GNAME
 
-#RUN find / -group ${UID} -exec chgrp -h node {} \;
-#RUN find / -user ${UID} -exec chown -h node {} \;
 
-# RUN addgroup -g ${GID} ${GNAME}
-RUN if [ $(getent group ${GNAME}) ]; then echo "group ${GNAME} already exists"; else addgroup -g ${GID} ${GNAME}; fi
-# else
-#   echo "group does not exist."
-# fi
+# RUN addgroup -g 1000 gdp && \
     # adduser -h /home/gdp -D -u 1000 gdp && \
-RUN adduser -u ${UID} -G ${GNAME} -s /bin/sh -D ${UNAME}
+RUN adduser -u ${USER_UID} -G users -s /bin/sh -D ${USER_UNAME}
     # chown -R gdp:gdp /home/gdp
 
-USER ${UNAME}
+USER ${USER_UNAME}
 
-COPY ./bashrc /home/${UNAME}/.bashrc
-COPY ./inputrc /home/${UNAME}/.inputrc
+COPY ./bashrc /home/${USER_UNAME}/.bashrc
+COPY ./inputrc /home/${USER_UNAME}/.inputrc
 
 COPY ./client-entrypoint.sh /usr/local/bin
 USER root
 RUN chmod +x /usr/local/bin/client-entrypoint.sh
-USER ${UNAME}
+USER ${USER_UNAME}
 CMD ["/bin/sh","/usr/local/bin/client-entrypoint.sh"]

+ 28 - 8
Makefile

@@ -12,29 +12,49 @@ export USER_UNAME
 export USER_GID
 export USER_GNAME
 
-build:
-		docker-compose build --build-arg USER_UID=$(USER_UID) --build-arg USER_UNAME=$(USER_UNAME) --build-arg USER_GID=$(USER_GID) --build-arg USER_GNAME=$(USER_GNAME)
+build: build_basex build_client
 
-buildnc:
-		docker-compose build --no-cache --build-arg USER_UID=$(USER_UID) --build-arg USER_UNAME=$(USER_UNAME) --build-arg USER_GID=$(USER_GID) --build-arg USER_GNAME=$(USER_GNAME)
+build_basex:
+		docker-compose build basex
+build_client:
+		docker-compose build --build-arg USER_UID=$(USER_UID) --build-arg USER_UNAME=$(USER_UNAME) --build-arg USER_GID=$(USER_GID) --build-arg USER_GNAME=$(USER_GNAME) client
+
+buildnc: buildnc_basex buildnc_client
+
+buildnc_basex:
+		docker-compose build --no-cache basex
+
+buildnc_client:
+		docker-compose build --no-cache --build-arg USER_UID=$(USER_UID) --build-arg USER_UNAME=$(USER_UNAME) --build-arg USER_GID=$(USER_GID) --build-arg USER_GNAME=$(USER_GNAME) client
 
 up:
 		docker-compose up -d
 
-upbuild:
-		docker-compose up -d --build
+up_basex:
+		docker-compose up -d basex
+
+up_client:
+		docker-compose up -d client
+
+
+# upbuild:
+# 		docker-compose up -d --build
 
 ps:
 		docker-compose ps
 
 logs:
 		docker-compose logs -f
+logs_basex:
+		docker-compose logs basex -f
+logs_npm:
+		docker-compose logs client -f
 
 down:
 		docker-compose down
 
 exec_client:
-		docker exec -it gdp_client_1 sh
+		docker exec -it gdp-client-1 sh
 
 exec_basex:
-		docker exec -it gdp_basex_1 sh
+		docker exec -it gdp-basex-1 sh

+ 1 - 1
client

@@ -1 +1 @@
-Subproject commit b708cfc80f2923db47096f5f99a07f3397bf44e4
+Subproject commit cbdcd50a3493c7ae49a318ac9f50b58274da9859

+ 1 - 1
data

@@ -1 +1 @@
-Subproject commit 424a325dfa7a73326613c41906499ec980b2ddde
+Subproject commit 3bce6efa838a35d8b930168a30219827cea9873f

+ 1 - 0
docker-compose.yml

@@ -7,6 +7,7 @@ services:
       - "${WEBAPP_ROOT}:/srv/basex/webapp/synopsx/workspace/gdp"
       - "${DATA_ROOT}:/srv/basex/src"
       - basex-home:/srv
+      # - basex-data:/srv/basex/data
       # - "${LOG_ROOT}:/var/log:rw"
     ports:
       - 1984:1984

+ 1 - 1
webapp

@@ -1 +1 @@
-Subproject commit 712ed6dfddbb4e371906116e2af4157046c58274
+Subproject commit 2677e72baa4671e5246f74f55dfa7affb8bbaa3a