1 Commits
14 changed files with 121 additions and 61 deletions
-8
View File
@@ -4,14 +4,6 @@
echo "Creating GDP BaseX db" 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()})" 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'
echo "Creating FullText Index tmp file"
basex "xslt:transform(fn:doc('/srv/basex/src/gdp.tei.xml'), fn:doc('/srv/basex/src/xslt/generateFullTextIndex.xsl'))" > /tmp/gdpFtIndex.xml
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'
# as we override the parent container CMD, we have to launch basexhttp here # as we override the parent container CMD, we have to launch basexhttp here
echo "Launching basexhttp" echo "Launching basexhttp"
+8 -13
View File
@@ -4,26 +4,21 @@ RUN apk update && apk --no-cache add shadow && \
usermod -u 1001 node && \ usermod -u 1001 node && \
groupmod -g 1001 node groupmod -g 1001 node
ARG UID=1000 RUN find / -group 1000 -exec chgrp -h node {} \;
ARG UNAME=gdp RUN find / -user 1000 -exec chown -h node {} \;
ARG GID=1000
ARG GNAME=users
#RUN find / -group ${UID} -exec chgrp -h node {} \; # RUN addgroup -g 1000 gdp && \
#RUN find / -user ${UID} -exec chown -h node {} \;
RUN addgroup -g ${DID} ${GNAME}
# adduser -h /home/gdp -D -u 1000 gdp && \ # adduser -h /home/gdp -D -u 1000 gdp && \
RUN adduser -u ${UID} -G ${GNAME} -s /bin/sh -D ${UNAME} RUN adduser -u 1000 -G users -s /bin/sh -D gdp
# chown -R gdp:gdp /home/gdp # chown -R gdp:gdp /home/gdp
USER ${UNAME} USER gdp
COPY ./bashrc /home/${UNAME}/.bashrc COPY ./bashrc /home/gdp/.bashrc
COPY ./inputrc /home/${UNAME}/.inputrc COPY ./inputrc /home/gdp/.inputrc
COPY ./client-entrypoint.sh /usr/local/bin COPY ./client-entrypoint.sh /usr/local/bin
USER root USER root
RUN chmod +x /usr/local/bin/client-entrypoint.sh RUN chmod +x /usr/local/bin/client-entrypoint.sh
USER ${UNAME} USER gdp
CMD ["/bin/sh","/usr/local/bin/client-entrypoint.sh"] CMD ["/bin/sh","/usr/local/bin/client-entrypoint.sh"]
+2 -5
View File
@@ -2,12 +2,9 @@
cat /etc/passwd|grep 1000 cat /etc/passwd|grep 1000
cd /app
echo "Cleaning node_modules"
rm -rf node_modules
echo "Npm install" echo "Npm install"
cd /app
npm install npm install
echo "Run npm dev" echo "Run npm dev"
+7
View File
@@ -0,0 +1,7 @@
FROM nginx:latest
COPY ./bashrc /root/.bashrc
COPY ./inputrc /root/.inputrc
COPY ./index.html /var/www/html/index.html
# COPY ./default.conf /etc/nginx/conf.d/default.conf
COPY ./default.conf /etc/nginx/nginx.conf
+3
View File
@@ -0,0 +1,3 @@
PS1='\e[36m\e[1mNGINX\e[0m:\e[90m\w\e[0m\n$ '
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
+49
View File
@@ -0,0 +1,49 @@
worker_processes 1;
events { worker_connections 1024; }
http {
upstream docker-api {
server basex:8984;
}
upstream docker-client {
server client:8988;
}
proxy_set_header Host $host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
server {
listen 80;
root /var/www/html;
index index.html;
charset utf-8;
server_name dev.gdp.fr;
access_log on;
error_log /var/log/nginx/error.log error;
sendfile off;
client_max_body_size 100m;
location / {
try_files $uri $uri/ index.html;
}
location /api {
rewrite ^/api/(.*) /$1 break;
proxy_redirect off;
proxy_pass http://docker-api;
}
location /client {
rewrite ^/client/(.*) /$1 break;
proxy_redirect off;
proxy_pass http://docker-client;
}
}
}
+13
View File
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Proxy</title>
</head>
<body>
<ul>
<li><a href="/api">api</a></li>
<li><a href="/client">client</a></li>
</ul>
</body>
</html>
+2
View File
@@ -0,0 +1,2 @@
set show-all-if-ambiguous on
set completion-ignore-case on
+10 -31
View File
@@ -10,7 +10,7 @@ sudo pacman -S docker docker-compose docker-machine
this will clone this repos (main docker environement) and necessary other source code (synopsx, webapp, xml-tei sources, vuejs client) this will clone this repos (main docker environement) and necessary other source code (synopsx, webapp, xml-tei sources, vuejs client)
``` ```
git clone --recursive https://figureslibres.io/gogs/bachir/docker-gdp.git git clone --recursive -o figli https://figureslibres.io/gogs/bachir/docker-gdp.git
``` ```
## Docker ## Docker
@@ -25,52 +25,31 @@ only before the first run (may take some time)
``` ```
sudo docker-compose build 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)
```
### run ### run
then each time you want to launch the app then each time you want to launch the app
``` ```
sudo docker-compose up -d sudo docker-compose up -d
``` ```
## API ## DB
the api is ready, you can go to http://localhost:8984/home <del>connect http://localhost:8984/synopsx/create-project</del>
### indexing <del>create a 'gdp' project</del>
before you can use the client you need to trigger this url http://localhost:8984/indexing
<del>connect to http://localhost:8984/synopsx/config</del>
<del>select 'gpd' and click on 'ok'</del>
## API
the api is ready, you can go to http://localhost:8984/gdp/home
## Client ## Client
open http://localhost:8988 in your browser open http://localhost:8988 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
to follow the webpack compilation process, run to follow the webpack compilation process, run
``` ```
sudo docker-compose logs -f sudo docker-compose logs -f
``` ```
## Update
update the code
```
git pull origin master
git pull --recurse-submodules
```
restart the containers
```
docker-compose restart basex
docker-compose restart client
```
or rebuild if data was updated
```
docker-compose up -d --build
```
## Doc ## Doc
https://github.com/guidesDeParis/webapp/blob/master/install.md https://github.com/guidesDeParis/webapp/blob/master/install.md
+1 -1
Submodule client updated: 14beb796ea...01e4d99537
+1 -1
Submodule data updated: beee67faae...423de0caf0
+23
View File
@@ -12,6 +12,8 @@ services:
- 1984:1984 - 1984:1984
- 8984:8984 - 8984:8984
working_dir: "/srv/basex" working_dir: "/srv/basex"
networks:
- api
client: client:
build: ./Docker/client build: ./Docker/client
@@ -23,7 +25,28 @@ services:
working_dir: "/app" working_dir: "/app"
depends_on: depends_on:
- basex - basex
networks:
- client
nginx:
build: ./Docker/nginx/
ports:
- 8999:80
volumes:
- "${LOG_ROOT}:/var/log:rw"
# working_dir: "/var/www/html"
depends_on:
- basex
- client
networks:
- api
- client
volumes: volumes:
basex-home: basex-home:
# client-home: # client-home:
networks:
api:
client:
+1 -1
Submodule synopsx updated: c84136501e...558dd832a2
+1 -1
Submodule webapp updated: 34356e0fc7...e6ca72b4a0