summaryrefslogtreecommitdiffstats
path: root/Services/ooconv
diff options
context:
space:
mode:
authorstartxfr <clarue@startx.fr>2016-02-06 05:05:57 +0100
committerstartxfr <clarue@startx.fr>2016-02-06 05:05:57 +0100
commit5cff390c081bdfb756a8977ad0bd56d778202d6b (patch)
treece018b9be9ad054e4f7aa6891d7b4668c1ad74af /Services/ooconv
parent0f3bcf30ae748a75c22a03d4655dba4d8dc71185 (diff)
downloadphpmyadmin-5cff390c081bdfb756a8977ad0bd56d778202d6b.tar.gz
phpmyadmin-5cff390c081bdfb756a8977ad0bd56d778202d6b.tar.bz2
phpmyadmin-5cff390c081bdfb756a8977ad0bd56d778202d6b.tar.xz
phpmyadmin-5cff390c081bdfb756a8977ad0bd56d778202d6b.zip
reorg avec gestion des sig
Diffstat (limited to 'Services/ooconv')
-rw-r--r--Services/ooconv/Dockerfile4
-rw-r--r--Services/ooconv/README.md10
-rw-r--r--Services/ooconv/docker-compose.yml2
-rw-r--r--Services/ooconv/run.sh24
4 files changed, 22 insertions, 18 deletions
diff --git a/Services/ooconv/Dockerfile b/Services/ooconv/Dockerfile
index feeed82..b50d347 100644
--- a/Services/ooconv/Dockerfile
+++ b/Services/ooconv/Dockerfile
@@ -4,8 +4,8 @@ MAINTAINER Christophe LARUE <dev@startx.fr>
USER root
RUN dnf -y install unoconv libreoffice-headless libreoffice-writer libreoffice-calc pdfmod ghostscript && \
dnf clean all
-ENV STARTUPLOG=/data/logs/ooconv/startup.log \
- LOG_PATH=/data/logs/ooconv
+ENV STARTUPLOG=/logs/startup.log \
+ LOG_PATH=/logs
COPY *.sh /bin/
RUN chmod 775 /bin/run.sh && \
mkdir -p $LOG_PATH && \
diff --git a/Services/ooconv/README.md b/Services/ooconv/README.md
index f35b54c..ef81641 100644
--- a/Services/ooconv/README.md
+++ b/Services/ooconv/README.md
@@ -29,7 +29,7 @@ service:
CONTAINER_SERVICE: "ooconv"
CONTAINER_INSTANCE: "service-ooconv"
volumes:
- - "/tmp/container/logs/ooconv:/data/logs/ooconv"
+ - "/tmp/container/logs/ooconv:/logs"
```
## Docker-compose in various situations
@@ -72,7 +72,7 @@ CMD ["/bin/run.sh"]
| CONTAINER_TYPE | `string` | `no` | Container family (os, service, application. could be enhanced
| CONTAINER_SERVICE | `string` | `no` | Define the type of service or application provided
| HOSTNAME | `auto` | `auto` | Container unique id automatically assigned by docker daemon at startup
-| LOG_PATH | `auto` | `auto` | default set to /data/logs/ooconv and used as a volume mountpoint
+| LOG_PATH | `auto` | `auto` | default set to /logs and used as a volume mountpoint
## Exposed port
@@ -84,7 +84,7 @@ CMD ["/bin/run.sh"]
| Container directory | Description |
|----------------------|--------------------------------------------------------------------------|
-| /data/logs/ooconv | log directory used to record container and ooconv logs
+| /logs | log directory used to record container and ooconv logs
## Testing the service
@@ -105,8 +105,8 @@ You must have a working environment with the source code of this repository. Rea
1. Jump into the container directory with `cd Services/ooconv`
2. Build the container using `docker build -t sv-ooconv .`
3. Run this container
- 1. Interactively with `docker run -p 2002:2002 -v /data/logs/ooconv -it sv-ooconv`. If you add a second parameter (like `/bin/bash`) to will run this command instead of the default entrypoint. Usefull to interact with this container (ex: `/bin/bash`, `/bin/ps -a`, `/bin/df -h`,...)
- 2. As a daemon with `docker run -p 2002:2002 -v /data/logs/ooconv -d sv-ooconv`
+ 1. Interactively with `docker run -p 2002:2002 -v /logs -it sv-ooconv`. If you add a second parameter (like `/bin/bash`) to will run this command instead of the default entrypoint. Usefull to interact with this container (ex: `/bin/bash`, `/bin/ps -a`, `/bin/df -h`,...)
+ 2. As a daemon with `docker run -p 2002:2002 -v /logs -d sv-ooconv`
### Build & run a container using `docker-compose`
diff --git a/Services/ooconv/docker-compose.yml b/Services/ooconv/docker-compose.yml
index b22e23a..bcead90 100644
--- a/Services/ooconv/docker-compose.yml
+++ b/Services/ooconv/docker-compose.yml
@@ -12,4 +12,4 @@ server:
CONTAINER_SERVICE: "ooconv"
CONTAINER_INSTANCE: "service-ooconv"
volumes:
- - "/tmp/container/logs/ooconv:/data/logs/ooconv" \ No newline at end of file
+ - "/tmp/container/logs/ooconv:/logs" \ No newline at end of file
diff --git a/Services/ooconv/run.sh b/Services/ooconv/run.sh
index 4ed67b7..2d8ddf6 100644
--- a/Services/ooconv/run.sh
+++ b/Services/ooconv/run.sh
@@ -43,24 +43,28 @@ function end_config {
echo "=> END OOCONV CONFIGURATION"
}
+function stop_ooconv_handler {
+ killall unoconv soffice.bin
+ echo "+=====================================================" | tee -a $STARTUPLOG
+ echo "| Container $HOSTNAME is now STOPPED" | tee -a $STARTUPLOG
+ echo "+=====================================================" | tee -a $STARTUPLOG
+ exit 143; # 128 + 15 -- SIGTERM
+}
+
# Start the ooconv server as a deamon and execute it inside
# the running shell
-function start_daemon {
- echo "=> Starting ooconv daemon ..." | tee -a $STARTUPLOG
- display_container_started | tee -a $STARTUPLOG
+function start_service_ooconv {
+ trap 'kill ${!}; stop_ooconv_handler' SIGHUP SIGINT SIGQUIT SIGTERM SIGKILL SIGSTOP SIGCONT
+ echo "+=====================================================" | tee -a $STARTUPLOG
+ echo "| Container $HOSTNAME is now RUNNING" | tee -a $STARTUPLOG
+ echo "+=====================================================" | tee -a $STARTUPLOG
unoconv --listener -vvv | tee -a $STARTUPLOG
- sleep 1
killall unoconv soffice.bin
exec unoconv --listener
}
-
-if [[ "$0" == *"run.sh" && ! $1 = "" ]];then
- eval "$@";
-fi
-
check_environment | tee -a $STARTUPLOG
display_container_ooconv_header | tee -a $STARTUPLOG
begin_config | tee -a $STARTUPLOG
end_config | tee -a $STARTUPLOG
-start_daemon
+start_service_ooconv