From e5574db63cad10ea2450d597969d592e00f5a2e3 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Sat, 11 Apr 2020 16:52:28 +0200 Subject: [PATCH] Add CrisisCleanup3 to graveyard (cherry-picked from 2018-08-10) --- extra/graveyard/crisiscleanup3/Dockerfile | 31 +++++++++ .../docker/etc/nginx/nginx.conf | 64 +++++++++++++++++++ .../docker/etc/services.d/.s6-svscan/finish | 3 + .../docker/etc/services.d/crisiscleanup/run | 6 ++ .../docker/etc/services.d/nginx/run | 3 + .../crisiscleanup3/etc/init.d/crisiscleanup | 29 +++++++++ .../crisiscleanup3/srv/crisiscleanup/conf/env | 5 ++ 7 files changed, 141 insertions(+) create mode 100644 extra/graveyard/crisiscleanup3/Dockerfile create mode 100644 extra/graveyard/crisiscleanup3/docker/etc/nginx/nginx.conf create mode 100644 extra/graveyard/crisiscleanup3/docker/etc/services.d/.s6-svscan/finish create mode 100644 extra/graveyard/crisiscleanup3/docker/etc/services.d/crisiscleanup/run create mode 100644 extra/graveyard/crisiscleanup3/docker/etc/services.d/nginx/run create mode 100644 extra/graveyard/crisiscleanup3/etc/init.d/crisiscleanup create mode 100644 extra/graveyard/crisiscleanup3/srv/crisiscleanup/conf/env diff --git a/extra/graveyard/crisiscleanup3/Dockerfile b/extra/graveyard/crisiscleanup3/Dockerfile new file mode 100644 index 0000000..e491b94 --- /dev/null +++ b/extra/graveyard/crisiscleanup3/Dockerfile @@ -0,0 +1,31 @@ +FROM alpine +MAINTAINER Disassembler + +RUN \ + # Install runtime dependencies + apk --no-cache add nodejs nginx + +RUN \ + # Install build dependencies + apk --no-cache add --virtual .deps git yarn + # Clone CrisisCleanup + && git clone --depth 1 https://github.com/CrisisCleanup/crisiscleanup-web /srv/crisiscleanup \ + # Install NodeJS dependencies + && cd /srv/crisiscleanup \ + && yarn install \ + # Generate static resources + && APP_ENV=prod yarn run build \ + # Create OS user + && addgroup -S -g 8005 cc \ + && adduser -S -u 8005 -h /srv/crisiscleanup -s /bin/false -g cc -G cc cc \ + && chown -R cc:cc /srv/crisiscleanup \ + # Cleanup + && apk --no-cache del .deps \ + && find /srv/crisiscleanup -name '.git*' -exec rm -rf {} + \ + && rm -rf /usr/local/share/.cache + +VOLUME ["/srv/crisiscleanup/config"] +EXPOSE 8080 + +WORKDIR /srv/crisiscleanup +CMD ["s6-svscan", "/etc/services.d"] diff --git a/extra/graveyard/crisiscleanup3/docker/etc/nginx/nginx.conf b/extra/graveyard/crisiscleanup3/docker/etc/nginx/nginx.conf new file mode 100644 index 0000000..72ed728 --- /dev/null +++ b/extra/graveyard/crisiscleanup3/docker/etc/nginx/nginx.conf @@ -0,0 +1,64 @@ +user nginx; +pid /run/nginx.pid; +worker_processes 1; +error_log /dev/stderr warn; + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + + access_log off; + server_tokens off; + client_max_body_size 100m; + sendfile on; + + server { + listen 8080; + server_name localhost; + + root /srv/kanboard; + index index.php; + + location / { + try_files $uri $uri/ /index.php$is_args$args; + } + + location ~ \.php$ { + try_files $uri =404; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass unix:/var/run/kanboard.sock; + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param HTTP_HOST $http_x_forwarded_host if_not_empty; + fastcgi_param HTTPS "on"; + fastcgi_param REQUEST_SCHEME "https"; + fastcgi_param SERVER_NAME $http_x_forwarded_server_name if_not_empty; + fastcgi_param SERVER_PORT $http_x_forwarded_server_port if_not_empty; + } + + location ~* ^.+\.(log|sqlite)$ { + return 404; + } + + location ~ /\.ht { + return 404; + } + + location ~* ^.+\.(ico|jpg|gif|png|css|js|svg|eot|ttf|woff|woff2|otf)$ { + log_not_found off; + expires 7d; + etag on; + } + + gzip on; + gzip_comp_level 3; + gzip_disable "msie6"; + gzip_vary on; + gzip_types text/javascript application/javascript application/json text/xml application/xml application/rss+xml text/css text/plain; + } +} diff --git a/extra/graveyard/crisiscleanup3/docker/etc/services.d/.s6-svscan/finish b/extra/graveyard/crisiscleanup3/docker/etc/services.d/.s6-svscan/finish new file mode 100644 index 0000000..78d5fdc --- /dev/null +++ b/extra/graveyard/crisiscleanup3/docker/etc/services.d/.s6-svscan/finish @@ -0,0 +1,3 @@ +#!/bin/sh + +/bin/true diff --git a/extra/graveyard/crisiscleanup3/docker/etc/services.d/crisiscleanup/run b/extra/graveyard/crisiscleanup3/docker/etc/services.d/crisiscleanup/run new file mode 100644 index 0000000..be122f9 --- /dev/null +++ b/extra/graveyard/crisiscleanup3/docker/etc/services.d/crisiscleanup/run @@ -0,0 +1,6 @@ +#!/bin/execlineb -P + +fdmove -c 2 1 +s6-setuidgid 8005:8005 +foreground { /srv/crisiscleanup/load-env.sh } +/usr/bin/node /srv/crisiscleanup/server.js diff --git a/extra/graveyard/crisiscleanup3/docker/etc/services.d/nginx/run b/extra/graveyard/crisiscleanup3/docker/etc/services.d/nginx/run new file mode 100644 index 0000000..d09b7cd --- /dev/null +++ b/extra/graveyard/crisiscleanup3/docker/etc/services.d/nginx/run @@ -0,0 +1,3 @@ +#!/bin/execlineb -P + +/usr/sbin/nginx -g "daemon off;" diff --git a/extra/graveyard/crisiscleanup3/etc/init.d/crisiscleanup b/extra/graveyard/crisiscleanup3/etc/init.d/crisiscleanup new file mode 100644 index 0000000..c58658c --- /dev/null +++ b/extra/graveyard/crisiscleanup3/etc/init.d/crisiscleanup @@ -0,0 +1,29 @@ +#!/sbin/openrc-run + +description="Crisis Cleanup docker container" + +depend() { + need docker postfix postgres +} + +start() { + /usr/bin/docker run -d --rm \ + --name crisiscleanup \ + -h crisiscleanup \ + --link postfix \ + --link postgres \ + -v /srv/crisiscleanup/conf:/srv/crisiscleanup/config \ + crisiscleanup +} + +start_post() { + /usr/bin/spotter-appmgr register-proxy crisiscleanup +} + +stop_pre() { + /usr/bin/spotter-appmgr unregister-proxy crisiscleanup +} + +stop() { + /usr/bin/docker stop crisiscleanup +} diff --git a/extra/graveyard/crisiscleanup3/srv/crisiscleanup/conf/env b/extra/graveyard/crisiscleanup3/srv/crisiscleanup/conf/env new file mode 100644 index 0000000..75db52b --- /dev/null +++ b/extra/graveyard/crisiscleanup3/srv/crisiscleanup/conf/env @@ -0,0 +1,5 @@ +GOOGLE_MAPS_API_KEY=AIzaSyAS7GowniFU4IZMZUEw0rVPyzY1EcWGXNU +LEAFLET_MAP_APP_ID=OxegEAQ46ansqN9LtNd1 +LEAFLET_MAP_APP_CODE=86XV8M-pIbpy5TUa9H_Aww +API_ENDPOINT=https://prod-api.crisiscleanup.services http://localhost:5000 +API_PHONE_ENDPOINT=https://staging-api.crisiscleanup.services