Skip to content

Commit

Permalink
Merge pull request #27 from icyflame/icyflame/put-peqp-in-static
Browse files Browse the repository at this point in the history
Put peqp in a separate volume called "static"
  • Loading branch information
icyflame committed Nov 14, 2017
2 parents b1ef80d + 392baec commit ae89734
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 64 deletions.
4 changes: 4 additions & 0 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
version: '2.1'

services:
nginx:
volumes:
- static-volume:/srv/static
backup:
build: './backup'
links:
Expand All @@ -18,3 +21,4 @@ services:

volumes:
mediawiki-volume:
static-volume:
3 changes: 2 additions & 1 deletion nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM nginx:mainline
COPY metakgp.org /etc/nginx/sites-enabled/
COPY wiki.metakgp.org /etc/nginx/sites-enabled/
COPY static.metakgp.org /etc/nginx/sites-enabled/
COPY nginx.conf /etc/nginx/
RUN rm /etc/nginx/conf.d/default.conf
40 changes: 40 additions & 0 deletions nginx/static.metakgp.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
server {
# listen 8080 default_server;
listen 80;
# listen [::]:80 default_server ipv6only=on;

root /srv/static;
autoindex off;

# Make site accessible from everywhere
server_name static.metakgp.org;

# Location for the wiki's root

location / {
try_files $uri $uri/ =404;
}

# Cloudflare masks real IPs
set_real_ip_from 199.27.128.0/21;
set_real_ip_from 173.245.48.0/20;
set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22;
set_real_ip_from 103.31.4.0/22;
set_real_ip_from 141.101.64.0/18;
set_real_ip_from 108.162.192.0/18;
set_real_ip_from 190.93.240.0/20;
set_real_ip_from 188.114.96.0/20;
set_real_ip_from 197.234.240.0/22;
set_real_ip_from 198.41.128.0/17;
set_real_ip_from 162.158.0.0/15;
set_real_ip_from 104.16.0.0/12;
set_real_ip_from 172.64.0.0/13;
set_real_ip_from 2400:cb00::/32;
set_real_ip_from 2606:4700::/32;
set_real_ip_from 2803:f800::/32;
set_real_ip_from 2405:b500::/32;
set_real_ip_from 2405:8100::/32;
set_real_ip_from 127.0.0.1/32;
real_ip_header CF-Connecting-IP;
}
64 changes: 1 addition & 63 deletions nginx/metakgp.org → nginx/wiki.metakgp.org
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
# You may add here your
# server {
# ...
# }
# statements for each of your virtual hosts to this file

##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

server {
# listen 8080 default_server;
listen 80 default_server;
Expand All @@ -27,7 +8,7 @@ server {
autoindex off;

# Make site accessible from everywhere
server_name _;
server_name wiki.metakgp.org;

# Location for the wiki's root
location / {
Expand All @@ -41,10 +22,6 @@ server {
}
}

location /peqp {
try_files $uri $uri/ =404;
}

location ~ ^/google557cb96b33ddc6b5\.html$ {}

location /images {
Expand Down Expand Up @@ -160,42 +137,3 @@ server {
set_real_ip_from 127.0.0.1/32;
real_ip_header CF-Connecting-IP;
}

# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# root html;
# index index.html index.htm;
#
# location / {
# try_files $uri $uri/ =404;
# }
#}


# HTTPS server
#
#server {
# listen 443;
# server_name localhost;
#
# root html;
# index index.html index.htm;
#
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
#
# ssl_session_timeout 5m;
#
# ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
# ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
# ssl_prefer_server_ciphers on;
#
# location / {
# try_files $uri $uri/ =404;
# }
#}
7 changes: 7 additions & 0 deletions scripts/restore-peqp-to-static.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -xe

source .env
NGINX_CONTAINER=$(docker ps --format '{{ .Names }}' | grep nginx)
docker cp $1/. $NGINX_CONTAINER:/srv/static

0 comments on commit ae89734

Please sign in to comment.