From 00fde83506fe717906cbad5907f2a067d87257b2 Mon Sep 17 00:00:00 2001 From: Apostolof Date: Sun, 22 Mar 2020 21:16:37 +0200 Subject: [PATCH 1/2] Various fixes for docker, Fix links targets, Change dark mode background color --- Dockerfile | 111 +++++++++++++++++++++++++++++++++++++++++++ default.conf | 45 ++++++++++++++++++ docker-compose.yml | 14 ++++-- env/apella-guide.env | 4 ++ makefile | 10 ++++ src/index.html | 8 ++-- 6 files changed, 183 insertions(+), 9 deletions(-) create mode 100644 Dockerfile create mode 100644 default.conf create mode 100644 env/apella-guide.env create mode 100644 makefile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1838b78 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,111 @@ +FROM alpine:3.10 + +LABEL maintainer="NGINX Docker Maintainers " + +ENV NGINX_VERSION 1.17.9 +ENV NJS_VERSION 0.3.9 +ENV PKG_RELEASE 1 + +RUN set -x \ +# create nginx user/group first, to be consistent throughout docker variants + && addgroup -g 101 -S nginx \ + && adduser -S -D -H -u 101 -h /var/cache/nginx -s /sbin/nologin -G nginx -g nginx nginx \ + && apkArch="$(cat /etc/apk/arch)" \ + && nginxPackages=" \ + nginx=${NGINX_VERSION}-r${PKG_RELEASE} \ + nginx-module-xslt=${NGINX_VERSION}-r${PKG_RELEASE} \ + nginx-module-geoip=${NGINX_VERSION}-r${PKG_RELEASE} \ + nginx-module-image-filter=${NGINX_VERSION}-r${PKG_RELEASE} \ + nginx-module-njs=${NGINX_VERSION}.${NJS_VERSION}-r${PKG_RELEASE} \ + " \ + && case "$apkArch" in \ + x86_64) \ +# arches officially built by upstream + set -x \ + && KEY_SHA512="e7fa8303923d9b95db37a77ad46c68fd4755ff935d0a534d26eba83de193c76166c68bfe7f65471bf8881004ef4aa6df3e34689c305662750c0172fca5d8552a *stdin" \ + && apk add --no-cache --virtual .cert-deps \ + openssl \ + && wget -O /tmp/nginx_signing.rsa.pub https://nginx.org/keys/nginx_signing.rsa.pub \ + && if [ "$(openssl rsa -pubin -in /tmp/nginx_signing.rsa.pub -text -noout | openssl sha512 -r)" = "$KEY_SHA512" ]; then \ + echo "key verification succeeded!"; \ + mv /tmp/nginx_signing.rsa.pub /etc/apk/keys/; \ + else \ + echo "key verification failed!"; \ + exit 1; \ + fi \ + && apk del .cert-deps \ + && apk add -X "https://nginx.org/packages/mainline/alpine/v$(egrep -o '^[0-9]+\.[0-9]+' /etc/alpine-release)/main" --no-cache $nginxPackages \ + ;; \ + *) \ +# we're on an architecture upstream doesn't officially build for +# let's build binaries from the published packaging sources + set -x \ + && tempDir="$(mktemp -d)" \ + && chown nobody:nobody $tempDir \ + && apk add --no-cache --virtual .build-deps \ + gcc \ + libc-dev \ + make \ + openssl-dev \ + pcre-dev \ + zlib-dev \ + linux-headers \ + libxslt-dev \ + gd-dev \ + geoip-dev \ + perl-dev \ + libedit-dev \ + mercurial \ + bash \ + alpine-sdk \ + findutils \ + && su nobody -s /bin/sh -c " \ + export HOME=${tempDir} \ + && cd ${tempDir} \ + && hg clone https://hg.nginx.org/pkg-oss \ + && cd pkg-oss \ + && hg up ${NGINX_VERSION}-${PKG_RELEASE} \ + && cd alpine \ + && make all \ + && apk index -o ${tempDir}/packages/alpine/${apkArch}/APKINDEX.tar.gz ${tempDir}/packages/alpine/${apkArch}/*.apk \ + && abuild-sign -k ${tempDir}/.abuild/abuild-key.rsa ${tempDir}/packages/alpine/${apkArch}/APKINDEX.tar.gz \ + " \ + && cp ${tempDir}/.abuild/abuild-key.rsa.pub /etc/apk/keys/ \ + && apk del .build-deps \ + && apk add -X ${tempDir}/packages/alpine/ --no-cache $nginxPackages \ + ;; \ + esac \ +# if we have leftovers from building, let's purge them (including extra, unnecessary build deps) + && if [ -n "$tempDir" ]; then rm -rf "$tempDir"; fi \ + && if [ -n "/etc/apk/keys/abuild-key.rsa.pub" ]; then rm -f /etc/apk/keys/abuild-key.rsa.pub; fi \ + && if [ -n "/etc/apk/keys/nginx_signing.rsa.pub" ]; then rm -f /etc/apk/keys/nginx_signing.rsa.pub; fi \ +# Bring in gettext so we can get `envsubst`, then throw +# the rest away. To do this, we need to install `gettext` +# then move `envsubst` out of the way so `gettext` can +# be deleted completely, then move `envsubst` back. + && apk add --no-cache --virtual .gettext gettext \ + && mv /usr/bin/envsubst /tmp/ \ + \ + && runDeps="$( \ + scanelf --needed --nobanner /tmp/envsubst \ + | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ + | sort -u \ + | xargs -r apk info --installed \ + | sort -u \ + )" \ + && apk add --no-cache $runDeps \ + && apk del .gettext \ + && mv /tmp/envsubst /usr/local/bin/ \ +# Bring in tzdata so users could set the timezones through the environment +# variables + && apk add --no-cache tzdata \ +# forward request and error logs to docker log collector + && ln -sf /dev/stdout /var/log/nginx/access.log \ + && ln -sf /dev/stderr /var/log/nginx/error.log + +COPY default.conf /etc/nginx/conf.d/ +EXPOSE 8000 + +STOPSIGNAL SIGTERM + +CMD ["nginx", "-g", "daemon off;"] diff --git a/default.conf b/default.conf new file mode 100644 index 0000000..8e8f72e --- /dev/null +++ b/default.conf @@ -0,0 +1,45 @@ +server { + listen 8000; + server_name localhost; + + #charset koi8-r; + #access_log /var/log/nginx/host.access.log main; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + } + + #error_page 404 /404.html; + + # redirect server error pages to the static page /50x.html + # + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + + # proxy the PHP scripts to Apache listening on 127.0.0.1:80 + # + #location ~ \.php$ { + # proxy_pass http://127.0.0.1; + #} + + # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 + # + #location ~ \.php$ { + # root html; + # fastcgi_pass 127.0.0.1:9000; + # fastcgi_index index.php; + # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; + # include fastcgi_params; + #} + + # deny access to .htaccess files, if Apache's document root + # concurs with nginx's one + # + #location ~ /\.ht { + # deny all; + #} +} + diff --git a/docker-compose.yml b/docker-compose.yml index 4d0850f..3499a5f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,17 +2,21 @@ version: '3.7' services: apella-guide: - image: nginx + build: ./ container_name: apella-guide restart: always env_file: - ./env/apella-guide.env - ports: - - "8080:80" + # ports: + # - "8000:8000" + expose: + - "8000" volumes: - ./src/:/usr/share/nginx/html:ro + networks: + - janus_apella-net # Networks in use networks: - apella-net: - driver: bridge + janus_apella-net: + external: true diff --git a/env/apella-guide.env b/env/apella-guide.env new file mode 100644 index 0000000..d1e3417 --- /dev/null +++ b/env/apella-guide.env @@ -0,0 +1,4 @@ +VIRTUAL_HOST=guide.apella.tk +VIRTUAL_PORT=8000 +LETSENCRYPT_HOST=guide.apella.tk +LETSENCRYPT_EMAIL=apotwohd@gmail.com diff --git a/makefile b/makefile new file mode 100644 index 0000000..b909566 --- /dev/null +++ b/makefile @@ -0,0 +1,10 @@ +build: + @docker-compose -p apella-guide build; +run: + @docker-compose -p apella-guide up -d +stop: + @docker-compose -p apella-guide down +clean-data: + @docker-compose -p apella-guide down -v +clean-images: + @docker rmi `docker images -q -f "dangling=true"` diff --git a/src/index.html b/src/index.html index 6f631c9..8f998ec 100644 --- a/src/index.html +++ b/src/index.html @@ -34,7 +34,7 @@ Metamask 🧐

- In order to use blockchain based, decentralized applications the user needs to setup a gateway for their browser to communicate with blockchain. This is where Metamask comes in. + In order to use blockchain based, decentralized applications the user needs to setup a gateway for their browser to communicate with blockchain. This is where Metamask comes in.

@@ -110,7 +110,7 @@

- Visit Apella and enjoy free, uncensored communication 🥳 + Visit Apella and enjoy free, uncensored communication 🥳

@@ -120,9 +120,9 @@ right: '32px', left: 'unset', time: '0.3s', - mixColor: '#fff', + mixColor: '#d7d6dc', backgroundColor: '#fff', - buttonColorDark: '#100f2c', + buttonColorDark: '#282923', buttonColorLight: '#fff', saveInCookies: false, label: '🌓', From b0bef8f163376bb78fb53da7884cad62e8e65c36 Mon Sep 17 00:00:00 2001 From: Apostolof Date: Sun, 22 Mar 2020 21:54:54 +0200 Subject: [PATCH 2/2] Rebase to ligthttpd server --- Dockerfile | 112 ++++----------------------------------------- default.conf | 45 ------------------ docker-compose.yml | 4 +- lighttpd.conf | 12 +++++ 4 files changed, 21 insertions(+), 152 deletions(-) delete mode 100644 default.conf create mode 100644 lighttpd.conf diff --git a/Dockerfile b/Dockerfile index 1838b78..85071bf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,111 +1,15 @@ -FROM alpine:3.10 +FROM alpine:3.10 as base +LABEL maintainer="Fanakis Apostolos " -LABEL maintainer="NGINX Docker Maintainers " +RUN apk add --update --no-cache openrc lighttpd \ + && rm -rf /var/cache/apk/* +RUN rc-update add lighttpd default -ENV NGINX_VERSION 1.17.9 -ENV NJS_VERSION 0.3.9 -ENV PKG_RELEASE 1 +FROM base as final -RUN set -x \ -# create nginx user/group first, to be consistent throughout docker variants - && addgroup -g 101 -S nginx \ - && adduser -S -D -H -u 101 -h /var/cache/nginx -s /sbin/nologin -G nginx -g nginx nginx \ - && apkArch="$(cat /etc/apk/arch)" \ - && nginxPackages=" \ - nginx=${NGINX_VERSION}-r${PKG_RELEASE} \ - nginx-module-xslt=${NGINX_VERSION}-r${PKG_RELEASE} \ - nginx-module-geoip=${NGINX_VERSION}-r${PKG_RELEASE} \ - nginx-module-image-filter=${NGINX_VERSION}-r${PKG_RELEASE} \ - nginx-module-njs=${NGINX_VERSION}.${NJS_VERSION}-r${PKG_RELEASE} \ - " \ - && case "$apkArch" in \ - x86_64) \ -# arches officially built by upstream - set -x \ - && KEY_SHA512="e7fa8303923d9b95db37a77ad46c68fd4755ff935d0a534d26eba83de193c76166c68bfe7f65471bf8881004ef4aa6df3e34689c305662750c0172fca5d8552a *stdin" \ - && apk add --no-cache --virtual .cert-deps \ - openssl \ - && wget -O /tmp/nginx_signing.rsa.pub https://nginx.org/keys/nginx_signing.rsa.pub \ - && if [ "$(openssl rsa -pubin -in /tmp/nginx_signing.rsa.pub -text -noout | openssl sha512 -r)" = "$KEY_SHA512" ]; then \ - echo "key verification succeeded!"; \ - mv /tmp/nginx_signing.rsa.pub /etc/apk/keys/; \ - else \ - echo "key verification failed!"; \ - exit 1; \ - fi \ - && apk del .cert-deps \ - && apk add -X "https://nginx.org/packages/mainline/alpine/v$(egrep -o '^[0-9]+\.[0-9]+' /etc/alpine-release)/main" --no-cache $nginxPackages \ - ;; \ - *) \ -# we're on an architecture upstream doesn't officially build for -# let's build binaries from the published packaging sources - set -x \ - && tempDir="$(mktemp -d)" \ - && chown nobody:nobody $tempDir \ - && apk add --no-cache --virtual .build-deps \ - gcc \ - libc-dev \ - make \ - openssl-dev \ - pcre-dev \ - zlib-dev \ - linux-headers \ - libxslt-dev \ - gd-dev \ - geoip-dev \ - perl-dev \ - libedit-dev \ - mercurial \ - bash \ - alpine-sdk \ - findutils \ - && su nobody -s /bin/sh -c " \ - export HOME=${tempDir} \ - && cd ${tempDir} \ - && hg clone https://hg.nginx.org/pkg-oss \ - && cd pkg-oss \ - && hg up ${NGINX_VERSION}-${PKG_RELEASE} \ - && cd alpine \ - && make all \ - && apk index -o ${tempDir}/packages/alpine/${apkArch}/APKINDEX.tar.gz ${tempDir}/packages/alpine/${apkArch}/*.apk \ - && abuild-sign -k ${tempDir}/.abuild/abuild-key.rsa ${tempDir}/packages/alpine/${apkArch}/APKINDEX.tar.gz \ - " \ - && cp ${tempDir}/.abuild/abuild-key.rsa.pub /etc/apk/keys/ \ - && apk del .build-deps \ - && apk add -X ${tempDir}/packages/alpine/ --no-cache $nginxPackages \ - ;; \ - esac \ -# if we have leftovers from building, let's purge them (including extra, unnecessary build deps) - && if [ -n "$tempDir" ]; then rm -rf "$tempDir"; fi \ - && if [ -n "/etc/apk/keys/abuild-key.rsa.pub" ]; then rm -f /etc/apk/keys/abuild-key.rsa.pub; fi \ - && if [ -n "/etc/apk/keys/nginx_signing.rsa.pub" ]; then rm -f /etc/apk/keys/nginx_signing.rsa.pub; fi \ -# Bring in gettext so we can get `envsubst`, then throw -# the rest away. To do this, we need to install `gettext` -# then move `envsubst` out of the way so `gettext` can -# be deleted completely, then move `envsubst` back. - && apk add --no-cache --virtual .gettext gettext \ - && mv /usr/bin/envsubst /tmp/ \ - \ - && runDeps="$( \ - scanelf --needed --nobanner /tmp/envsubst \ - | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ - | sort -u \ - | xargs -r apk info --installed \ - | sort -u \ - )" \ - && apk add --no-cache $runDeps \ - && apk del .gettext \ - && mv /tmp/envsubst /usr/local/bin/ \ -# Bring in tzdata so users could set the timezones through the environment -# variables - && apk add --no-cache tzdata \ -# forward request and error logs to docker log collector - && ln -sf /dev/stdout /var/log/nginx/access.log \ - && ln -sf /dev/stderr /var/log/nginx/error.log - -COPY default.conf /etc/nginx/conf.d/ +COPY lighttpd.conf /etc/lighttpd/lighttpd.conf EXPOSE 8000 STOPSIGNAL SIGTERM -CMD ["nginx", "-g", "daemon off;"] +CMD ["lighttpd", "-D", "-f", "/etc/lighttpd/lighttpd.conf"] diff --git a/default.conf b/default.conf deleted file mode 100644 index 8e8f72e..0000000 --- a/default.conf +++ /dev/null @@ -1,45 +0,0 @@ -server { - listen 8000; - server_name localhost; - - #charset koi8-r; - #access_log /var/log/nginx/host.access.log main; - - location / { - root /usr/share/nginx/html; - index index.html index.htm; - } - - #error_page 404 /404.html; - - # redirect server error pages to the static page /50x.html - # - error_page 500 502 503 504 /50x.html; - location = /50x.html { - root /usr/share/nginx/html; - } - - # proxy the PHP scripts to Apache listening on 127.0.0.1:80 - # - #location ~ \.php$ { - # proxy_pass http://127.0.0.1; - #} - - # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 - # - #location ~ \.php$ { - # root html; - # fastcgi_pass 127.0.0.1:9000; - # fastcgi_index index.php; - # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; - # include fastcgi_params; - #} - - # deny access to .htaccess files, if Apache's document root - # concurs with nginx's one - # - #location ~ /\.ht { - # deny all; - #} -} - diff --git a/docker-compose.yml b/docker-compose.yml index 3499a5f..c9948ac 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,12 +7,10 @@ services: restart: always env_file: - ./env/apella-guide.env - # ports: - # - "8000:8000" expose: - "8000" volumes: - - ./src/:/usr/share/nginx/html:ro + - ./src/:/var/www/servers/apella-guide/ networks: - janus_apella-net diff --git a/lighttpd.conf b/lighttpd.conf new file mode 100644 index 0000000..ba465a6 --- /dev/null +++ b/lighttpd.conf @@ -0,0 +1,12 @@ +server.document-root = "/var/www/servers/apella-guide/" + +server.port = 8000 + +mimetype.assign = ( + ".html" => "text/html", + ".js" => "application/javascript", + ".css" => "text/css", + ".png" => "image/png" +) + +index-file.names = ( "index.html" )