Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d36a12966 | ||
|
|
665a8f005f | ||
|
|
1443588a11 | ||
|
|
a7d89f4ebb | ||
|
|
c1fe629589 | ||
|
|
a9860c79da | ||
|
|
8ea27d3701 | ||
|
|
8282acffd4 | ||
|
|
02d923e064 | ||
|
|
8a7f62e955 | ||
|
|
66d1d722c3 | ||
|
|
a9db81d292 | ||
|
|
0962464c8d | ||
|
|
4e861c276a | ||
|
|
24df0ab253 | ||
|
|
4f56a7c8db | ||
|
|
8b69854af5 | ||
|
|
f0b7f21bc6 | ||
|
|
578cfec628 | ||
|
|
062db05406 | ||
|
|
b91a1bb855 | ||
|
|
999985c45e | ||
|
|
2086e9f3d2 | ||
|
|
0879ec6185 | ||
|
|
56104de8a3 | ||
|
|
f0f67b5182 | ||
|
|
a0c1fec080 | ||
|
|
0ddcd650ee | ||
|
|
4efccc1421 | ||
|
|
647cd93cd2 | ||
|
|
d4e70aa5d2 | ||
|
|
cfda98a478 | ||
|
|
7d71e616a0 | ||
|
|
0d2d8ec548 | ||
|
|
c14b7ab8af | ||
|
|
0065009a28 | ||
|
|
5ff77b9cb1 | ||
|
|
34ff18b0bd | ||
|
|
29d31a172f | ||
|
|
e509db16a6 | ||
|
|
3c70fe7a1e | ||
|
|
5ba190b8d7 | ||
|
|
8a0ebb3214 | ||
|
|
c461d5b1e4 | ||
|
|
8e84a71d83 | ||
|
|
e42a4f012c | ||
|
|
085cc3bc29 | ||
|
|
1a2297490c | ||
|
|
a25987222a | ||
|
|
f293944dcb | ||
|
|
f3550bf5c6 | ||
|
|
454d8a0bae | ||
|
|
1846475aed | ||
|
|
f438b24249 | ||
|
|
862b02584d | ||
|
|
01b1955a66 | ||
|
|
5f1dc1a71a | ||
|
|
0ca97afd07 | ||
|
|
ce41cdaeed | ||
|
|
c66592cf9f | ||
|
|
ef2f102e37 | ||
|
|
d636a2b79a | ||
|
|
4bf8adb3d9 | ||
|
|
f0af68f2c4 | ||
|
|
8b9ac95b30 | ||
|
|
8ffe23f447 | ||
|
|
5db80516bc | ||
|
|
d5b865b626 | ||
|
|
92797fee72 | ||
|
|
be1c9e8bc3 | ||
|
|
d42f6e5cb5 | ||
|
|
8505ea611f | ||
|
|
b5883150fc | ||
|
|
4ddd13640f | ||
|
|
700edfdd40 | ||
|
|
cd8ecfea69 | ||
|
|
70117bb616 | ||
|
|
c0c2a85ac4 | ||
|
|
a5c4d734c0 | ||
|
|
d70a20d3a6 | ||
|
|
1ecd244343 | ||
|
|
83cd5c8d6d | ||
|
|
4be7c33948 | ||
|
|
3b877d2fb3 | ||
|
|
c7ac1b3463 | ||
|
|
f4811c7956 | ||
|
|
0ace942135 | ||
|
|
12bad6c56f | ||
|
|
f4b5497c36 | ||
|
|
ac94d2ca2f |
@@ -1,13 +1,16 @@
|
||||
# FROM basex/basexhttp:9.4.6
|
||||
FROM basex/basexhttp:latest
|
||||
|
||||
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()})"
|
||||
|
||||
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
|
||||
USER basex
|
||||
# RUN chown -R basex:basex /usr/local/bin/gdp-entrypoint.sh
|
||||
# # RUN ln -s /usr/local/bin/gdp-entrypoint.sh /srv/ # backwards compat
|
||||
RUN chown -R basex:basex /srv
|
||||
# USER basex
|
||||
CMD ["/bin/sh","/usr/local/bin/gdp-entrypoint.sh"]
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
# todo: run some checks
|
||||
|
||||
id
|
||||
|
||||
ls -ls / | grep srv
|
||||
|
||||
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 +17,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
|
||||
+52
-13
@@ -1,29 +1,68 @@
|
||||
FROM node:lts-alpine
|
||||
# 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:16-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 {} \;
|
||||
|
||||
#RUN find / -group ${UID} -exec chgrp -h node {} \;
|
||||
#RUN find / -user ${UID} -exec chown -h node {} \;
|
||||
ARG USER_UID
|
||||
ARG USER_UNAME
|
||||
ARG USER_GID
|
||||
ARG USER_GNAME
|
||||
|
||||
RUN addgroup -g ${DID} ${GNAME}
|
||||
RUN if [ $(getent group ${USER_GNAME}) ]; then echo "group ${USER_GNAME} already exists"; else addgroup -g ${USER_GID} ${USER_GNAME}; fi
|
||||
# RUN addgroup -g 1000 ${USER_GNAME}
|
||||
# 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 ${USER_GNAME} -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"]
|
||||
|
||||
@@ -4,11 +4,26 @@ cat /etc/passwd|grep 1000
|
||||
|
||||
cd /app
|
||||
|
||||
echo "Cleaning node_modules"
|
||||
rm -rf node_modules
|
||||
# echo "Cleaning node_modules"
|
||||
# rm -rf node_modules
|
||||
|
||||
echo "Npm install"
|
||||
npm install
|
||||
# echo "Cleaning npm cache"
|
||||
# npm cache clean --f
|
||||
|
||||
echo "Run npm dev"
|
||||
npm run dev
|
||||
# echo "Npm install"
|
||||
# npm install
|
||||
|
||||
echo "Npm clean install"
|
||||
npm ci
|
||||
|
||||
# echo "Run npm dev"
|
||||
# npm run dev
|
||||
echo "APP_ENV $APP_ENV"
|
||||
|
||||
if [ "$APP_ENV" = "prod" ]; then
|
||||
echo "Run npm prod"
|
||||
npm run prod
|
||||
else
|
||||
echo "Run npm dev"
|
||||
npm run dev
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
#!/usr/bin/make
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
USER_UID := $(shell id -u)
|
||||
USER_UNAME := $(shell id -un)
|
||||
USER_GID := $(shell id -g)
|
||||
USER_GNAME := $(shell id -gn)
|
||||
|
||||
export USER_UID
|
||||
export USER_UNAME
|
||||
export USER_GID
|
||||
export USER_GNAME
|
||||
|
||||
build: build_basex build_client
|
||||
|
||||
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 --pull --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
|
||||
upd:
|
||||
docker-compose up -d
|
||||
|
||||
up_basex:
|
||||
docker-compose up -d basex
|
||||
|
||||
up_client:
|
||||
docker-compose up -d client
|
||||
|
||||
|
||||
restart_basex:
|
||||
docker-compose restart basex
|
||||
|
||||
restart_client:
|
||||
docker-compose restart client
|
||||
|
||||
# upbuild:
|
||||
# docker-compose up -d --build
|
||||
|
||||
ps:
|
||||
docker-compose ps
|
||||
|
||||
logs:
|
||||
docker-compose logs -f
|
||||
logs_basex:
|
||||
docker-compose logs basex -f
|
||||
logs_client:
|
||||
docker-compose logs client -f
|
||||
|
||||
down:
|
||||
docker-compose down
|
||||
|
||||
exec_client:
|
||||
docker exec -it gdp-client-1 sh
|
||||
|
||||
exec_basex:
|
||||
docker exec -it gdp-basex-1 sh
|
||||
|
||||
exec_basex_root:
|
||||
docker exec -u 0 -it gdp-basex-1 sh
|
||||
@@ -27,7 +27,7 @@ sudo docker-compose build
|
||||
```
|
||||
or with args for groups and users
|
||||
```
|
||||
docker-compose build --build-arg UID=$(id -u) --build-arg GID=$(id -g) --build-arg UNAME=$(id -un) --build-arg GNAME=$(id -gn)
|
||||
docker-compose build --no-cache --build-arg UID=$(id -u) --build-arg GID=$(id -g) --build-arg UNAME=$(id -un) --build-arg GNAME=$(id -gn) [client | basex]
|
||||
```
|
||||
### run
|
||||
then each time you want to launch the app
|
||||
@@ -42,11 +42,13 @@ the api is ready, you can go to http://localhost:8984/home
|
||||
before you can use the client you need to trigger this url http://localhost:8984/indexing
|
||||
|
||||
## Client
|
||||
open http://localhost:8988 in your browser
|
||||
open http://localhost:8998 in your browser
|
||||
|
||||
## Vhost or Cross Origins Policy
|
||||
Cross origin poilicy will block the api requests from client
|
||||
|
||||
You'll need to install vhost domain for api and client, like dev.gdp.net and dev.api.gdp.net
|
||||
|
||||
Or in firefox install this addon to allow cors addons.mozilla.org/en-US/firefox/addon/cors-everywhere/
|
||||
|
||||
## Logs
|
||||
@@ -70,6 +72,82 @@ or rebuild if data was updated
|
||||
```
|
||||
docker-compose up -d --build
|
||||
```
|
||||
or
|
||||
```sh
|
||||
docker-compose build --no-cache [client | basex]
|
||||
docker-compose up -d [client | basex]
|
||||
```
|
||||
|
||||
## Prod
|
||||
run containers for prod
|
||||
```
|
||||
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
|
||||
```
|
||||
client will be built the client container stop
|
||||
|
||||
basex container will stay up
|
||||
|
||||
you have to serve client/dist/index.html with your own webserver (e.g. nginx, apache, etc)
|
||||
|
||||
### nginx conf
|
||||
```nginx
|
||||
server {
|
||||
listen 80;
|
||||
server_name dev.api.gdp.fr;
|
||||
|
||||
access_log off;
|
||||
error_log /var/log/nginx/gdp/error.log error;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8984;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_buffer_size 128k;
|
||||
proxy_buffers 4 256k;
|
||||
proxy_busy_buffers_size 256k;
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name dev.gdp.fr;
|
||||
|
||||
access_log off;
|
||||
error_log /var/log/nginx/gdp/error.log error;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8998;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_buffer_size 128k;
|
||||
proxy_buffers 4 256k;
|
||||
proxy_busy_buffers_size 256k;
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## trouble shooting
|
||||
|
||||
/srv/basex has bad owner : 1000:users instead of basex:basex (1948:1984) (WHY ??)
|
||||
```
|
||||
docker exec -u 0 -it gdp-basex-1 sh
|
||||
chown -R basex:basex /srv/basex
|
||||
```
|
||||
|
||||
gdp-entrypoint is never launched, "launchit by hand" (WHY ??)
|
||||
```
|
||||
docker exec -it gdp-basex-1 sh
|
||||
. /usr/local/bin/gdp-entrypoint.sh
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
## Doc
|
||||
|
||||
|
||||
+1
-1
Submodule client updated: 14beb796ea...8494e5a0e2
+1
-1
Submodule data updated: beee67faae...1df122355a
@@ -0,0 +1,7 @@
|
||||
version: '3.7'
|
||||
services:
|
||||
basex:
|
||||
restart: always
|
||||
client:
|
||||
environment:
|
||||
- APP_ENV=prod
|
||||
+6
-3
@@ -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
|
||||
@@ -17,13 +18,15 @@ services:
|
||||
build: ./Docker/client
|
||||
volumes:
|
||||
- "${CLIENT_ROOT}:/app"
|
||||
# - client-home:/home/gdp
|
||||
- client-home:/home/${USER_UNAME}
|
||||
ports:
|
||||
- 8988:8988
|
||||
- 8998:8998
|
||||
working_dir: "/app"
|
||||
depends_on:
|
||||
- basex
|
||||
environment:
|
||||
- APP_ENV=dev
|
||||
|
||||
volumes:
|
||||
basex-home:
|
||||
# client-home:
|
||||
client-home:
|
||||
|
||||
+1
-1
Submodule synopsx updated: c84136501e...a8b7c0c10a
+1
-1
Submodule webapp updated: 34356e0fc7...2ca9ee51fd
Reference in New Issue
Block a user