README.md 3.5 KB

docker-gdp

Install docker (only once)

sudo pacman -S docker docker-compose docker-machine

Clone this repos

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

Docker

start docker engine

sudo systemctl start docker

build

only before the first run (may take some time)

sudo docker-compose build

or with args for groups and users

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

sudo docker-compose up -d

API

the api is ready, you can go to http://localhost:8984/home

indexing

before you can use the client you need to trigger this url http://localhost:8984/indexing

Client

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

to follow the webpack compilation process, run

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

or

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

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

https://github.com/guidesDeParis/webapp/blob/master/install.md

http://docs.basex.org/wiki/Docker

https://hub.docker.com/r/basex/basexhttp