diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..08fb879 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,51 @@ +FROM ubuntu:16.04 + +MAINTAINER Florian Schüller + +# This is where your data is +ENV GENEWEBDB /genewebData + +# Location specific to ubuntu installation +ENV GENEWEBSHARE /usr/share/geneweb +# Location specific to ubuntu installation +ENV GENEWEBDOC /usr/share/doc/geneweb + +# Temporary logfile used for setup +ENV SETUP_LOGFILE /tmp/setup_log.txt + +# HTTP Port where geneweb is running +ENV PORT 2317 + +# HTTP Port only used for setup purposes (when you don't have a database yet) +ENV SETUP_PORT 2316 + +# Language of interface and setup +ENV LANGUAGE ${LANGUAGE} + +EXPOSE ${PORT} +EXPOSE ${SETUP_PORT} + +RUN \ + apt-get update && \ + apt-get -y install --no-install-recommends gwsetup geneweb && \ + rm -rf /var/lib/apt/lists/* + +# seems to be some bug of "gwsetup" +RUN ln -s /usr/bin/gwc2 /usr/share/geneweb/gwc2 +RUN ln -s /usr/bin/gwb2ged /usr/share/geneweb/gwb2ged +RUN ln -s /usr/bin/gwu /usr/share/geneweb/gwu + +COPY scripts/bootstrap.sh / +RUN chmod a+x /bootstrap.sh + +COPY scripts/start_setup.sh / +RUN chmod a+x /start_setup.sh + +VOLUME ${GENEWEBDB} + +# The IP of the Docker host - setup needs this to enable access +ENV HOST_IP 172.17.0.1 + +RUN echo ${HOST_IP} > /setup_ips.txt + +CMD ["/bootstrap.sh"] diff --git a/README.md b/README.md index 8e9396f..f732c53 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,49 @@ # docker-geneweb Dockerized installation of Geneweb + +The container does not include `gwsetup` by default but this is only installed once to create a database + +*hint:* `gwsetup` is the program to create a genealogy database initially + +## Usage + +Usually you want to keep your database so to keep your data in an *existing* directory e.g. `${HOME}/GenealogyData` + +Just run the container: +``` +docker run --env LANGUAGE=de -d --name docker-geneweb -p2316:2316 -p2317:2317 -v ${HOME}/GenealogyData:/genewebData docker-geneweb:latest +``` + +and go to [http://localhost:2317] + +if you happen to have the git repository you can also execute: +``` +./start.sh +``` + +**note:** the directory `${HOME}/GenealogyData` has to be a *full path* + +## Setup +The setup will be started automatically [http://localhost:2316] if no database can be found + +**Please be patient** the setup tool will be installed "on the fly" only upon the *first start* if you don't have any genealogy database. + +If you start the container and you already have a database but you want more databases or do some backup you need to start the setup manually like so: + +``` +docker exec docker-geneweb /start_setup.sh +``` +and then navigate to [http://localhost:2316] +## Shutdown + +To shutdown the container just run +``` +docker stop docker-geneweb +docker rm docker-geneweb +``` + +## Backup +If you need to do a backup just either backup your data folder (e.g. `${HOME}/GenealogyData`) + +To export the data as "*.ged" file or similar you need to start the "setup" tool (see above) + diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..2b06a68 --- /dev/null +++ b/build.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +docker build --tag docker-geneweb:latest --tag docker-geneweb:1.0 . + + diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh new file mode 100755 index 0000000..f7f8789 --- /dev/null +++ b/scripts/bootstrap.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + + +# no database found - we need the setup +if [ $(ls ${GENEWEBDB}/*.gwb 2>/dev/null|wc -l) -eq 0 ]; then + /start_setup.sh +fi + +/usr/bin/gwd -lang ${LANGUAGE} -hd ${GENEWEBSHARE} -dd ${GENEWEBDOC} -bd ${GENEWEBDB} -p ${PORT} diff --git a/scripts/start_setup.sh b/scripts/start_setup.sh new file mode 100755 index 0000000..b3a3487 --- /dev/null +++ b/scripts/start_setup.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +pushd ${GENEWEBDB} + gwsetup -p ${SETUP_PORT} -gd ${GENEWEBSHARE} -lang ${LANGUAGE} -only /setup_ips.txt -log ${SETUP_LOGFILE} & +popd diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..8c8c7d1 --- /dev/null +++ b/start.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + + +mkdir -p ${HOME}/GenealogyData +docker rm docker-geneweb 2>/dev/null +docker run -d --name docker-geneweb -p2316:2316 -p2317:2317 -v ${HOME}/GenealogyData:/genewebData docker-geneweb:latest diff --git a/stop.sh b/stop.sh new file mode 100755 index 0000000..df78d60 --- /dev/null +++ b/stop.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +docker stop docker-geneweb +docker rm docker-geneweb