From c0a01229ed0b9edfe41f4113819815d3c2015309 Mon Sep 17 00:00:00 2001 From: jegesm Date: Tue, 19 May 2020 20:06:20 +0000 Subject: [PATCH] manual is now a plugin of kooplex --- Dockerfile | 13 ++++++ configure.sh | 75 ++++++++++++++++++++++++++++++++++ docker-compose.yml-template | 31 ++++++++++++++ nginx-conf/entrypoint.sh | 8 ++++ nginx-conf/nginx-conf-template | 15 +++++++ 5 files changed, 142 insertions(+) create mode 100644 Dockerfile create mode 100644 configure.sh create mode 100644 docker-compose.yml-template create mode 100644 nginx-conf/entrypoint.sh create mode 100644 nginx-conf/nginx-conf-template diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..88a5951 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +#FROM docsifyapp/node-ci +FROM littlstar/docker-docsify + +#ADD entrypoint.sh /entrypoint.sh + +#EXPOSE 4000 + +WORKDIR /docs + +#CMD ["sleep", "infinity"] +ENTRYPOINT ["sleep", "infinity"] + + diff --git a/configure.sh b/configure.sh new file mode 100644 index 0000000..621e80a --- /dev/null +++ b/configure.sh @@ -0,0 +1,75 @@ +#!/bin/bash + +MODULE_NAME=manual +RF=$BUILDDIR/${MODULE_NAME} + +mkdir -p $RF + +DOCKER_HOST=$DOCKERARGS +DOCKER_COMPOSE_FILE=$RF/docker-compose.yml + +case $VERB in + + "build") + echo "1. Configuring ${PREFIX}-manual..." + + mkdir -p $SRV/_manual + docker $DOCKERARGS volume create -o type=none -o device=$SRV/_manual -o o=bind ${PREFIX}-manual + + + cp Dockerfile $RF + + sed -e "s/##PREFIX##/$PREFIX/" \ + -e "s/##EXTRACONFIG##/$EXTRACONFIG/" docker-compose.yml-template > $DOCKER_COMPOSE_FILE + + echo "2. Building ${PREFIX}-manual..." + docker-compose $DOCKER_HOST -f $DOCKER_COMPOSE_FILE build + ;; + "install") + git clone https://github.com/kooplex/Manual.git $SRV/_manual + ;; + "install-hydra") + # register_hydra $MODULE_NAME + ;; + "uninstall-hydra") + # unregister_hydra $MODULE_NAME + ;; + "install-nginx") + register_nginx $MODULE_NAME + ;; + "uninstall-nginx") + unregister_nginx $MODULE_NAME + ;; + + "start") + echo "Starting manual ${PREFIX}-manual" + docker-compose $DOCKERARGS -f $DOCKER_COMPOSE_FILE up -d + ;; + + "restart") + echo "Restarting manual ${PREFIX}-manual" + docker $DOCKERARGS restart $PREFIX-manual + ;; + + "init") + ;; + + "stop") + echo "Stopping manual ${PREFIX}-manual" + docker-compose $DOCKERARGS -f $DOCKER_COMPOSE_FILE down + ;; + + "remove") + echo "Removing manual ${PREFIX}-net" + docker-compose $DOCKERARGS -f $DOCKER_COMPOSE_FILE kill + docker-compose $DOCKERARGS -f $DOCKER_COMPOSE_FILE rm + ;; + + "purge") + echo "Purging manual ${PREFIX}-manual" + rm -R $RF + + docker $DOCKERARGS volume rm ${PREFIX}-manual + ;; + +esac diff --git a/docker-compose.yml-template b/docker-compose.yml-template new file mode 100644 index 0000000..b5e6957 --- /dev/null +++ b/docker-compose.yml-template @@ -0,0 +1,31 @@ +version: "3" + +services: + ##PREFIX##-manual: + container_name: ##PREFIX##-manual + image: ##PREFIX##-manual + build: + context: . + dockerfile: Dockerfile + networks: + - ##PREFIX##-net + restart: unless-stopped + logging: + options: + max-size: "10m" + max-file: "3" + environment: + - LANG=en_US.UTF-8 + - PREFIX=##PREFIX## + volumes: + - ##PREFIX##-manual:/docs + +networks: + ##PREFIX##-net: + external: true + +volumes: + ##PREFIX##-manual: + external: true + + diff --git a/nginx-conf/entrypoint.sh b/nginx-conf/entrypoint.sh new file mode 100644 index 0000000..968c13d --- /dev/null +++ b/nginx-conf/entrypoint.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +#gitbook init +# This will install plugins inserted in the book.json +#gitbook install +#gitbook serve +sleep 10000 + diff --git a/nginx-conf/nginx-conf-template b/nginx-conf/nginx-conf-template new file mode 100644 index 0000000..1f09f81 --- /dev/null +++ b/nginx-conf/nginx-conf-template @@ -0,0 +1,15 @@ + + +###### Manual + location /manual { + proxy_pass http://##PREFIX##-manual:4000/; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_read_timeout 86400; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Connection keep-alive; + proxy_set_header Host $host; + proxy_cache_bypass $http_upgrade; + } +###### Manual end