Browse Source

Add Wekan

Dennis Rodewyk 7 years ago
parent
commit
581bdc6a4a

+ 23 - 0
data/services/wekan/containers.sh

@@ -0,0 +1,23 @@
+wekan_db_dockerbunker() {
+	docker run -d \
+		--name=${FUNCNAME[0]//_/-} \
+		--restart=always \
+		--network dockerbunker-${SERVICE_NAME} --net-alias=db \
+		-p=27017 \
+		--env-file="${SERVICE_ENV}" \
+		-v ${SERVICE_NAME}-db-vol-1:${volumes[${SERVICE_NAME}-db-vol-1]} \
+		-v ${SERVICE_NAME}-db-vol-1:${volumes[${SERVICE_NAME}-db-vol-2]} \
+	${IMAGES[db]} mongod --smallfiles --oplogSize 128 >/dev/null
+}
+
+wekan_service_dockerbunker() {
+	docker run -d \
+		--name=${FUNCNAME[0]//_/-} \
+		--restart=always \
+		--network dockerbunker-${SERVICE_NAME} \
+		--env-file="${SERVICE_ENV}" \
+	${IMAGES[service]} >/dev/null
+}
+
+
+

+ 60 - 0
data/services/wekan/nginx/wekan.conf

@@ -0,0 +1,60 @@
+map $http_upgrade $connection_upgrade {
+    default upgrade;
+    ''      close;
+}
+
+upstream wekan {
+ server wekan-service-dockerbunker:80;
+}
+
+server {
+    listen 80;
+	server_name ${SERVICE_DOMAIN};
+    return 301 https://$host$request_uri;
+	add_header X-Content-Type-Options "nosniff" always;
+	add_header X-XSS-Protection "1; mode=block" always;
+	add_header X-Frame-Options "DENY" always;
+	add_header Referrer-Policy "strict-origin" always;
+	add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
+	server_tokens off;
+}
+
+server {
+    listen 443;
+	server_name ${SERVICE_DOMAIN};
+    ssl on;
+	ssl_certificate /etc/nginx/ssl/${SERVICE_DOMAIN}/cert.pem;
+	ssl_certificate_key /etc/nginx/ssl/${SERVICE_DOMAIN}/key.pem;
+	include /etc/nginx/includes/ssl.conf;
+
+	add_header X-Content-Type-Options "nosniff" always;
+	add_header X-XSS-Protection "1; mode=block" always;
+	add_header X-Frame-Options "DENY" always;
+	add_header Referrer-Policy "strict-origin" always;
+	add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
+	server_tokens off;
+
+	include /etc/nginx/includes/gzip.conf;
+
+location / {
+        proxy_pass http://wekan/;
+        proxy_http_version 1.1;
+        proxy_set_header Upgrade $http_upgrade; # allow websockets
+        proxy_set_header Connection $connection_upgrade;
+        proxy_set_header X-Forwarded-For $remote_addr; # preserve client IP
+
+        # this setting allows the browser to cache the application in a way compatible with Meteor
+        # on every applicaiton update the name of CSS and JS file is different, so they can be cache infinitely (here: 30 days)
+        # the root path (/) MUST NOT be cached
+        #if ($uri != '/wekan') {
+        #    expires 30d;
+        #}
+    }
+
+	location ~ /.well-known {
+        allow all;
+		root /var/www/html;
+	}
+}
+
+

+ 54 - 0
data/services/wekan/wekan.sh

@@ -0,0 +1,54 @@
+#!/usr/bin/env bash
+while true;do ls | grep -q dockerbunker.sh;if [[ $? == 0 ]];then BASE_DIR=$PWD;break;else cd ../;fi;done
+
+PROPER_NAME="Wekan"
+SERVICE_NAME="$(echo -e "${PROPER_NAME,,}" | tr -d '[:space:]')"
+PROMPT_SSL=1
+
+declare -a environment=( "data/env/dockerbunker.env" "data/include/init.sh" )
+
+for env in "${environment[@]}";do
+	[[ -f "${BASE_DIR}"/$env ]] && source "${BASE_DIR}"/$env
+done
+
+declare -A WEB_SERVICES
+declare -a containers=( "${SERVICE_NAME}-service-dockerbunker" "${SERVICE_NAME}-db-dockerbunker" )
+declare -a add_to_network=( "${SERVICE_NAME}-service-dockerbunker" )
+declare -A IMAGES=( [service]="quay.io/wekan/wekan" [db]="mongo:3.2.12" )
+declare -A volumes=( [${SERVICE_NAME}-db-vol-1]="/data/db" [${SERVICE_NAME}-db-vol-2]="/dump" )
+declare -a networks=( "dockerbunker-${SERVICE_NAME}" )
+
+[[ -z $1 ]] && options_menu
+
+configure() {
+	pre_configure_routine
+	
+	echo -e "# \e[4mWekan Settings\e[0m"
+
+	set_domain
+	
+	cat <<-EOF >> "${SERVICE_ENV}"
+	PROPER_NAME=${PROPER_NAME}
+	SERVICE_NAME=${SERVICE_NAME}
+	SSL_CHOICE=${SSL_CHOICE}
+	LE_EMAIL=${LE_EMAIL}
+
+	SERVICE_DOMAIN=${SERVICE_DOMAIN}
+	
+	# ------------------------------
+	# SQL database configuration
+	# ------------------------------
+
+	MONGO_URL=mongodb://db:27017/wekan
+	ROOT_URL=http://localhost
+	
+	EOF
+	
+	post_configure_routine
+}
+
+if [[ $1 == "letsencrypt" ]];then
+	$1 $*
+else
+	$1
+fi

+ 1 - 0
dockerbunker.sh

@@ -37,6 +37,7 @@ declare -a ALL_SERVICES=( \
 	"Searx" \
 	"Send" \
 	"sFTP Server" \
+	"Wekan" \
 	"Wordpress" \
 	)