Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Put peqp in a separate volume called "static" #27

Merged
merged 9 commits into from
Nov 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a slight preference against having scripts to do very simple things, like run docker cp. Perhaps this belongs to the runbook instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, We could put this in the runbook, this script just felt natural beside the mysql backup restore script. I think we should keep it.