Compare commits
No commits in common. 'gh-pages' and 'main' have entirely different histories.
58 changed files with 464 additions and 7533 deletions
@ -0,0 +1,8 @@ |
|||||||
|
*.j2 |
||||||
|
site/ |
||||||
|
letsencrypt/ |
||||||
|
letsencrypt_certs/ |
||||||
|
nginx.conf.default |
||||||
|
conf.d/ |
||||||
|
conf.d_templates/http.DOMAIN.conf |
||||||
|
conf.d_templates/https.DOMAIN.conf |
@ -0,0 +1,3 @@ |
|||||||
|
[submodule "mkdocs-material"] |
||||||
|
path = mkdocs-material |
||||||
|
url = https://git.charlesreid1.com/charlesreid1/mkdocs-material.git |
@ -0,0 +1,29 @@ |
|||||||
|
# d-nginx-charlesreid1 |
||||||
|
|
||||||
|
This repo contains docker containers |
||||||
|
and a docker compose file for running |
||||||
|
an nginx web server for static content |
||||||
|
on charlesreid1.com. |
||||||
|
|
||||||
|
This repo is used in |
||||||
|
[pod-charlesreid1](https://git.charlesreid1.com/docker/pod-charlesreid1.git). |
||||||
|
|
||||||
|
The services are just: |
||||||
|
|
||||||
|
* nginx |
||||||
|
|
||||||
|
If you want to do SSL you can, but you have to |
||||||
|
run Let's Encrypt outside of the container |
||||||
|
and bind-mount your certificates into the |
||||||
|
container at `/etc/letsencrypt`. |
||||||
|
|
||||||
|
Pretty simple, right? |
||||||
|
|
||||||
|
## Links |
||||||
|
|
||||||
|
[documentation: d-nginx-charlesreid1 container](https://pages.charlesreid1.com/d-nginx-charlesreid1/) (you are here) |
||||||
|
|
||||||
|
[source code on git.charlesreid1.com: d-nginx-charlesreid1](https://git.charlesreid1.com/docker/d-nginx-charlesreid1) |
||||||
|
|
||||||
|
[source code on github.com: charlesreid1-docker/d-nginx-charlesreid1](https://github.com/charlesreid1-docker/d-nginx-charlesreid1) |
||||||
|
|
@ -0,0 +1,100 @@ |
|||||||
|
import os, re, sys |
||||||
|
from jinja2 import Environment, FileSystemLoader, select_autoescape |
||||||
|
|
||||||
|
""" |
||||||
|
Apply Default Values to Jinja Templates |
||||||
|
|
||||||
|
|
||||||
|
This script applies default values to |
||||||
|
nginx configuration templates in the |
||||||
|
conf.d_templates/ directory in order to |
||||||
|
create hard-coded default configuration files. |
||||||
|
|
||||||
|
The configuration templates are useful for Ansible, |
||||||
|
but the hard-coded configuration files are useful |
||||||
|
for everyone else. |
||||||
|
|
||||||
|
All configuration files are for charlesreid1.com |
||||||
|
docker pod, nginx, and realted infrastructure. |
||||||
|
""" |
||||||
|
|
||||||
|
|
||||||
|
# Where templates live |
||||||
|
TEMPLATEDIR = 'conf.d_templates' |
||||||
|
|
||||||
|
# Where rendered templates will go |
||||||
|
#OUTDIR = 'conf.d_examples' |
||||||
|
OUTDIR = 'conf.d' |
||||||
|
|
||||||
|
# Should existing files be overwritten |
||||||
|
OVERWRITE = True |
||||||
|
|
||||||
|
# Template variables |
||||||
|
TV = { |
||||||
|
'server_name_default': 'charlesreid1.com', |
||||||
|
|
||||||
|
# CHANGE THIS, OR THIS SCRIPT WILL NOT WORK |
||||||
|
'nginx_subdomains_ip': 'localhost', |
||||||
|
|
||||||
|
'port_default': '80', |
||||||
|
'port_gitea': '80', |
||||||
|
'port_files': '80', |
||||||
|
'port_pages': '80', |
||||||
|
'port_hooks': '80', |
||||||
|
'port_bots': '80', |
||||||
|
|
||||||
|
'port_ssl_default': '443', |
||||||
|
'port_ssl_gitea': '443', |
||||||
|
'port_ssl_files': '443', |
||||||
|
'port_ssl_pages': '443', |
||||||
|
'port_ssl_hooks': '443', |
||||||
|
'port_ssl_bots': '443', |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def apply_templates(template_dir, output_dir, template_vars, overwrite=False): |
||||||
|
"""Apply the template variables to the template files |
||||||
|
to create rendered nginx configuration files. |
||||||
|
""" |
||||||
|
|
||||||
|
if not os.path.exists(output_dir): |
||||||
|
msg = "Error: output dir %s does not exist!"%(output_dir) |
||||||
|
raise Exception(msg) |
||||||
|
|
||||||
|
if not os.path.exists(template_dir): |
||||||
|
msg = "Error: template dir %s does not exist!"%(output_dir) |
||||||
|
raise Exception(msg) |
||||||
|
|
||||||
|
# Jinja env |
||||||
|
env = Environment(loader=FileSystemLoader('conf.d_templates/')) |
||||||
|
|
||||||
|
# Render templates |
||||||
|
render_files = ['http.DOMAIN.conf', 'https.DOMAIN.conf', 'https.DOMAIN.subdomains.conf'] |
||||||
|
template_files = [f+'.j2' for f in render_files] |
||||||
|
|
||||||
|
render_files = [re.sub('DOMAIN',template_vars['server_name_default'],s) for s in render_files] |
||||||
|
|
||||||
|
for rfile,tfile in zip(render_files,template_files): |
||||||
|
|
||||||
|
# Get rendered template content |
||||||
|
content = env.get_template(tfile).render(**template_vars) |
||||||
|
|
||||||
|
# Write to file |
||||||
|
dest = os.path.join(output_dir,rfile) |
||||||
|
if os.path.exists(dest) and overwrite is False: |
||||||
|
msg = "Error: template rendering destination %s already exists!"%(dest) |
||||||
|
raise Exception(msg) |
||||||
|
|
||||||
|
with open(dest,'w') as f: |
||||||
|
f.write(content) |
||||||
|
|
||||||
|
print("Rendered the following templates:%s\nOutput files:%s\n"%( |
||||||
|
"".join(["\n- "+os.path.join(template_dir,j) for j in template_files]), |
||||||
|
"".join(["\n- "+os.path.join(output_dir,j) for j in render_files]) |
||||||
|
)) |
||||||
|
|
||||||
|
|
||||||
|
if __name__=="__main__": |
||||||
|
apply_templates(TEMPLATEDIR,OUTDIR,TV,OVERWRITE) |
||||||
|
|
File diff suppressed because one or more lines are too long
@ -1,13 +0,0 @@ |
|||||||
/*! |
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not |
|
||||||
* use this file except in compliance with the License. You may obtain a copy |
|
||||||
* of the License at: |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
* |
|
||||||
* UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING, SOFTWARE |
|
||||||
* DISTRIBUTED UNDER THE LICENSE IS DISTRIBUTED ON AN "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. |
|
||||||
* SEE THE LICENSE FOR THE SPECIFIC LANGUAGE GOVERNING PERMISSIONS AND |
|
||||||
* LIMITATIONS UNDER THE LICENSE. |
|
||||||
*/@font-face{font-family:"Material Icons";font-style:normal;font-weight:400;src:local("Material Icons"),local("MaterialIcons-Regular"),url("specimen/MaterialIcons-Regular.woff2") format("woff2"),url("specimen/MaterialIcons-Regular.woff") format("woff"),url("specimen/MaterialIcons-Regular.ttf") format("truetype")} |
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 521 B |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.6 KiB |
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@ |
|||||||
!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");var r,i,n;e.da=function(){this.pipeline.reset(),this.pipeline.add(e.da.trimmer,e.da.stopWordFilter,e.da.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.da.stemmer))},e.da.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",e.da.trimmer=e.trimmerSupport.generateTrimmer(e.da.wordCharacters),e.Pipeline.registerFunction(e.da.trimmer,"trimmer-da"),e.da.stemmer=(r=e.stemmerSupport.Among,i=e.stemmerSupport.SnowballProgram,n=new function(){var e,n,t,s=[new r("hed",-1,1),new r("ethed",0,1),new r("ered",-1,1),new r("e",-1,1),new r("erede",3,1),new r("ende",3,1),new r("erende",5,1),new r("ene",3,1),new r("erne",3,1),new r("ere",3,1),new r("en",-1,1),new r("heden",10,1),new r("eren",10,1),new r("er",-1,1),new r("heder",13,1),new r("erer",13,1),new r("s",-1,2),new r("heds",16,1),new r("es",16,1),new r("endes",18,1),new r("erendes",19,1),new r("enes",18,1),new r("ernes",18,1),new r("eres",18,1),new r("ens",16,1),new r("hedens",24,1),new r("erens",24,1),new r("ers",16,1),new r("ets",16,1),new r("erets",28,1),new r("et",-1,1),new r("eret",30,1)],o=[new r("gd",-1,-1),new r("dt",-1,-1),new r("gt",-1,-1),new r("kt",-1,-1)],a=[new r("ig",-1,1),new r("lig",0,1),new r("elig",1,1),new r("els",-1,1),new r("løst",-1,2)],d=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,48,0,128],u=[239,254,42,3,0,0,0,0,0,0,0,0,0,0,0,0,16],c=new i;function l(){var e,r=c.limit-c.cursor;c.cursor>=n&&(e=c.limit_backward,c.limit_backward=n,c.ket=c.cursor,c.find_among_b(o,4)?(c.bra=c.cursor,c.limit_backward=e,c.cursor=c.limit-r,c.cursor>c.limit_backward&&(c.cursor--,c.bra=c.cursor,c.slice_del())):c.limit_backward=e)}this.setCurrent=function(e){c.setCurrent(e)},this.getCurrent=function(){return c.getCurrent()},this.stem=function(){var r,i=c.cursor;return function(){var r,i=c.cursor+3;if(n=c.limit,0<=i&&i<=c.limit){for(e=i;;){if(r=c.cursor,c.in_grouping(d,97,248)){c.cursor=r;break}if(c.cursor=r,r>=c.limit)return;c.cursor++}for(;!c.out_grouping(d,97,248);){if(c.cursor>=c.limit)return;c.cursor++}(n=c.cursor)<e&&(n=e)}}(),c.limit_backward=i,c.cursor=c.limit,function(){var e,r;if(c.cursor>=n&&(r=c.limit_backward,c.limit_backward=n,c.ket=c.cursor,e=c.find_among_b(s,32),c.limit_backward=r,e))switch(c.bra=c.cursor,e){case 1:c.slice_del();break;case 2:c.in_grouping_b(u,97,229)&&c.slice_del()}}(),c.cursor=c.limit,l(),c.cursor=c.limit,function(){var e,r,i,t=c.limit-c.cursor;if(c.ket=c.cursor,c.eq_s_b(2,"st")&&(c.bra=c.cursor,c.eq_s_b(2,"ig")&&c.slice_del()),c.cursor=c.limit-t,c.cursor>=n&&(r=c.limit_backward,c.limit_backward=n,c.ket=c.cursor,e=c.find_among_b(a,5),c.limit_backward=r,e))switch(c.bra=c.cursor,e){case 1:c.slice_del(),i=c.limit-c.cursor,l(),c.cursor=c.limit-i;break;case 2:c.slice_from("løs")}}(),c.cursor=c.limit,c.cursor>=n&&(r=c.limit_backward,c.limit_backward=n,c.ket=c.cursor,c.out_grouping_b(d,97,248)?(c.bra=c.cursor,t=c.slice_to(t),c.limit_backward=r,c.eq_v_b(t)&&c.slice_del()):c.limit_backward=r),!0}},function(e){return"function"==typeof e.update?e.update(function(e){return n.setCurrent(e),n.stem(),n.getCurrent()}):(n.setCurrent(e),n.stem(),n.getCurrent())}),e.Pipeline.registerFunction(e.da.stemmer,"stemmer-da"),e.da.stopWordFilter=e.generateStopWordFilter("ad af alle alt anden at blev blive bliver da de dem den denne der deres det dette dig din disse dog du efter eller en end er et for fra ham han hans har havde have hende hendes her hos hun hvad hvis hvor i ikke ind jeg jer jo kunne man mange med meget men mig min mine mit mod ned noget nogle nu når og også om op os over på selv sig sin sine sit skal skulle som sådan thi til ud under var vi vil ville vor være været".split(" ")),e.Pipeline.registerFunction(e.da.stopWordFilter,"stopWordFilter-da")}}); |
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@ |
|||||||
!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");var r="2"==e.version[0];e.jp=function(){this.pipeline.reset(),this.pipeline.add(e.jp.stopWordFilter,e.jp.stemmer),r?this.tokenizer=e.jp.tokenizer:(e.tokenizer&&(e.tokenizer=e.jp.tokenizer),this.tokenizerFn&&(this.tokenizerFn=e.jp.tokenizer))};var t=new e.TinySegmenter;e.jp.tokenizer=function(n){if(!arguments.length||null==n||null==n)return[];if(Array.isArray(n))return n.map(function(t){return r?new e.Token(t.toLowerCase()):t.toLowerCase()});for(var i=n.toString().toLowerCase().replace(/^\s+/,""),o=i.length-1;o>=0;o--)if(/\S/.test(i.charAt(o))){i=i.substring(0,o+1);break}return t.segment(i).filter(function(e){return!!e}).map(function(t){return r?new e.Token(t):t})},e.jp.stemmer=function(e){return e},e.Pipeline.registerFunction(e.jp.stemmer,"stemmer-jp"),e.jp.wordCharacters="一二三四五六七八九十百千万億兆一-龠々〆ヵヶぁ-んァ-ヴーア-ン゙a-zA-Za-zA-Z0-90-9",e.jp.stopWordFilter=function(t){if(-1===e.jp.stopWordFilter.stopWords.indexOf(r?t.toString():t))return t},e.jp.stopWordFilter=e.generateStopWordFilter("これ それ あれ この その あの ここ そこ あそこ こちら どこ だれ なに なん 何 私 貴方 貴方方 我々 私達 あの人 あのかた 彼女 彼 です あります おります います は が の に を で え から まで より も どの と し それで しかし".split(" ")),e.Pipeline.registerFunction(e.jp.stopWordFilter,"stopWordFilter-jp")}}); |
|
@ -1 +0,0 @@ |
|||||||
!function(e,i){"function"==typeof define&&define.amd?define(i):"object"==typeof exports?module.exports=i():i()(e.lunr)}(this,function(){return function(e){e.multiLanguage=function(){for(var i=Array.prototype.slice.call(arguments),t=i.join("-"),r="",n=[],s=[],p=0;p<i.length;++p)"en"==i[p]?(r+="\\w",n.unshift(e.stopWordFilter),n.push(e.stemmer),s.push(e.stemmer)):(r+=e[i[p]].wordCharacters,n.unshift(e[i[p]].stopWordFilter),n.push(e[i[p]].stemmer),s.push(e[i[p]].stemmer));var o=e.trimmerSupport.generateTrimmer(r);return e.Pipeline.registerFunction(o,"lunr-multi-trimmer-"+t),n.unshift(o),function(){this.pipeline.reset(),this.pipeline.add.apply(this.pipeline,n),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add.apply(this.searchPipeline,s))}}}}); |
|
@ -1 +0,0 @@ |
|||||||
!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");var r,n,i;e.no=function(){this.pipeline.reset(),this.pipeline.add(e.no.trimmer,e.no.stopWordFilter,e.no.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.no.stemmer))},e.no.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",e.no.trimmer=e.trimmerSupport.generateTrimmer(e.no.wordCharacters),e.Pipeline.registerFunction(e.no.trimmer,"trimmer-no"),e.no.stemmer=(r=e.stemmerSupport.Among,n=e.stemmerSupport.SnowballProgram,i=new function(){var e,i,t=[new r("a",-1,1),new r("e",-1,1),new r("ede",1,1),new r("ande",1,1),new r("ende",1,1),new r("ane",1,1),new r("ene",1,1),new r("hetene",6,1),new r("erte",1,3),new r("en",-1,1),new r("heten",9,1),new r("ar",-1,1),new r("er",-1,1),new r("heter",12,1),new r("s",-1,2),new r("as",14,1),new r("es",14,1),new r("edes",16,1),new r("endes",16,1),new r("enes",16,1),new r("hetenes",19,1),new r("ens",14,1),new r("hetens",21,1),new r("ers",14,1),new r("ets",14,1),new r("et",-1,1),new r("het",25,1),new r("ert",-1,3),new r("ast",-1,1)],o=[new r("dt",-1,-1),new r("vt",-1,-1)],s=[new r("leg",-1,1),new r("eleg",0,1),new r("ig",-1,1),new r("eig",2,1),new r("lig",2,1),new r("elig",4,1),new r("els",-1,1),new r("lov",-1,1),new r("elov",7,1),new r("slov",7,1),new r("hetslov",9,1)],a=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,48,0,128],m=[119,125,149,1],l=new n;this.setCurrent=function(e){l.setCurrent(e)},this.getCurrent=function(){return l.getCurrent()},this.stem=function(){var r,n,u,d,c=l.cursor;return function(){var r,n=l.cursor+3;if(i=l.limit,0<=n||n<=l.limit){for(e=n;;){if(r=l.cursor,l.in_grouping(a,97,248)){l.cursor=r;break}if(r>=l.limit)return;l.cursor=r+1}for(;!l.out_grouping(a,97,248);){if(l.cursor>=l.limit)return;l.cursor++}(i=l.cursor)<e&&(i=e)}}(),l.limit_backward=c,l.cursor=l.limit,function(){var e,r,n;if(l.cursor>=i&&(r=l.limit_backward,l.limit_backward=i,l.ket=l.cursor,e=l.find_among_b(t,29),l.limit_backward=r,e))switch(l.bra=l.cursor,e){case 1:l.slice_del();break;case 2:n=l.limit-l.cursor,l.in_grouping_b(m,98,122)?l.slice_del():(l.cursor=l.limit-n,l.eq_s_b(1,"k")&&l.out_grouping_b(a,97,248)&&l.slice_del());break;case 3:l.slice_from("er")}}(),l.cursor=l.limit,n=l.limit-l.cursor,l.cursor>=i&&(r=l.limit_backward,l.limit_backward=i,l.ket=l.cursor,l.find_among_b(o,2)?(l.bra=l.cursor,l.limit_backward=r,l.cursor=l.limit-n,l.cursor>l.limit_backward&&(l.cursor--,l.bra=l.cursor,l.slice_del())):l.limit_backward=r),l.cursor=l.limit,l.cursor>=i&&(d=l.limit_backward,l.limit_backward=i,l.ket=l.cursor,(u=l.find_among_b(s,11))?(l.bra=l.cursor,l.limit_backward=d,1==u&&l.slice_del()):l.limit_backward=d),!0}},function(e){return"function"==typeof e.update?e.update(function(e){return i.setCurrent(e),i.stem(),i.getCurrent()}):(i.setCurrent(e),i.stem(),i.getCurrent())}),e.Pipeline.registerFunction(e.no.stemmer,"stemmer-no"),e.no.stopWordFilter=e.generateStopWordFilter("alle at av bare begge ble blei bli blir blitt både båe da de deg dei deim deira deires dem den denne der dere deres det dette di din disse ditt du dykk dykkar då eg ein eit eitt eller elles en enn er et ett etter for fordi fra før ha hadde han hans har hennar henne hennes her hjå ho hoe honom hoss hossen hun hva hvem hver hvilke hvilken hvis hvor hvordan hvorfor i ikke ikkje ikkje ingen ingi inkje inn inni ja jeg kan kom korleis korso kun kunne kva kvar kvarhelst kven kvi kvifor man mange me med medan meg meget mellom men mi min mine mitt mot mykje ned no noe noen noka noko nokon nokor nokre nå når og også om opp oss over på samme seg selv si si sia sidan siden sin sine sitt sjøl skal skulle slik so som som somme somt så sånn til um upp ut uten var vart varte ved vere verte vi vil ville vore vors vort vår være være vært å".split(" ")),e.Pipeline.registerFunction(e.no.stopWordFilter,"stopWordFilter-no")}}); |
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@ |
|||||||
!function(r,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():t()(r.lunr)}(this,function(){return function(r){r.stemmerSupport={Among:function(r,t,i,s){if(this.toCharArray=function(r){for(var t=r.length,i=new Array(t),s=0;s<t;s++)i[s]=r.charCodeAt(s);return i},!r&&""!=r||!t&&0!=t||!i)throw"Bad Among initialisation: s:"+r+", substring_i: "+t+", result: "+i;this.s_size=r.length,this.s=this.toCharArray(r),this.substring_i=t,this.result=i,this.method=s},SnowballProgram:function(){var r;return{bra:0,ket:0,limit:0,cursor:0,limit_backward:0,setCurrent:function(t){r=t,this.cursor=0,this.limit=t.length,this.limit_backward=0,this.bra=this.cursor,this.ket=this.limit},getCurrent:function(){var t=r;return r=null,t},in_grouping:function(t,i,s){if(this.cursor<this.limit){var e=r.charCodeAt(this.cursor);if(e<=s&&e>=i&&t[(e-=i)>>3]&1<<(7&e))return this.cursor++,!0}return!1},in_grouping_b:function(t,i,s){if(this.cursor>this.limit_backward){var e=r.charCodeAt(this.cursor-1);if(e<=s&&e>=i&&t[(e-=i)>>3]&1<<(7&e))return this.cursor--,!0}return!1},out_grouping:function(t,i,s){if(this.cursor<this.limit){var e=r.charCodeAt(this.cursor);if(e>s||e<i)return this.cursor++,!0;if(!(t[(e-=i)>>3]&1<<(7&e)))return this.cursor++,!0}return!1},out_grouping_b:function(t,i,s){if(this.cursor>this.limit_backward){var e=r.charCodeAt(this.cursor-1);if(e>s||e<i)return this.cursor--,!0;if(!(t[(e-=i)>>3]&1<<(7&e)))return this.cursor--,!0}return!1},eq_s:function(t,i){if(this.limit-this.cursor<t)return!1;for(var s=0;s<t;s++)if(r.charCodeAt(this.cursor+s)!=i.charCodeAt(s))return!1;return this.cursor+=t,!0},eq_s_b:function(t,i){if(this.cursor-this.limit_backward<t)return!1;for(var s=0;s<t;s++)if(r.charCodeAt(this.cursor-t+s)!=i.charCodeAt(s))return!1;return this.cursor-=t,!0},find_among:function(t,i){for(var s=0,e=i,n=this.cursor,u=this.limit,o=0,h=0,c=!1;;){for(var a=s+(e-s>>1),f=0,l=o<h?o:h,_=t[a],m=l;m<_.s_size;m++){if(n+l==u){f=-1;break}if(f=r.charCodeAt(n+l)-_.s[m])break;l++}if(f<0?(e=a,h=l):(s=a,o=l),e-s<=1){if(s>0||e==s||c)break;c=!0}}for(;;){if(o>=(_=t[s]).s_size){if(this.cursor=n+_.s_size,!_.method)return _.result;var b=_.method();if(this.cursor=n+_.s_size,b)return _.result}if((s=_.substring_i)<0)return 0}},find_among_b:function(t,i){for(var s=0,e=i,n=this.cursor,u=this.limit_backward,o=0,h=0,c=!1;;){for(var a=s+(e-s>>1),f=0,l=o<h?o:h,_=(m=t[a]).s_size-1-l;_>=0;_--){if(n-l==u){f=-1;break}if(f=r.charCodeAt(n-1-l)-m.s[_])break;l++}if(f<0?(e=a,h=l):(s=a,o=l),e-s<=1){if(s>0||e==s||c)break;c=!0}}for(;;){var m;if(o>=(m=t[s]).s_size){if(this.cursor=n-m.s_size,!m.method)return m.result;var b=m.method();if(this.cursor=n-m.s_size,b)return m.result}if((s=m.substring_i)<0)return 0}},replace_s:function(t,i,s){var e=s.length-(i-t),n=r.substring(0,t),u=r.substring(i);return r=n+s+u,this.limit+=e,this.cursor>=i?this.cursor+=e:this.cursor>t&&(this.cursor=t),e},slice_check:function(){if(this.bra<0||this.bra>this.ket||this.ket>this.limit||this.limit>r.length)throw"faulty slice operation"},slice_from:function(r){this.slice_check(),this.replace_s(this.bra,this.ket,r)},slice_del:function(){this.slice_from("")},insert:function(r,t,i){var s=this.replace_s(r,t,i);r<=this.bra&&(this.bra+=s),r<=this.ket&&(this.ket+=s)},slice_to:function(){return this.slice_check(),r.substring(this.bra,this.ket)},eq_v_b:function(r){return this.eq_s_b(r.length,r)}}}},r.trimmerSupport={generateTrimmer:function(r){var t=new RegExp("^[^"+r+"]+"),i=new RegExp("[^"+r+"]+$");return function(r){return"function"==typeof r.update?r.update(function(r){return r.replace(t,"").replace(i,"")}):r.replace(t,"").replace(i,"")}}}}}); |
|
@ -1 +0,0 @@ |
|||||||
!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");var r,n,t;e.sv=function(){this.pipeline.reset(),this.pipeline.add(e.sv.trimmer,e.sv.stopWordFilter,e.sv.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.sv.stemmer))},e.sv.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",e.sv.trimmer=e.trimmerSupport.generateTrimmer(e.sv.wordCharacters),e.Pipeline.registerFunction(e.sv.trimmer,"trimmer-sv"),e.sv.stemmer=(r=e.stemmerSupport.Among,n=e.stemmerSupport.SnowballProgram,t=new function(){var e,t,i=[new r("a",-1,1),new r("arna",0,1),new r("erna",0,1),new r("heterna",2,1),new r("orna",0,1),new r("ad",-1,1),new r("e",-1,1),new r("ade",6,1),new r("ande",6,1),new r("arne",6,1),new r("are",6,1),new r("aste",6,1),new r("en",-1,1),new r("anden",12,1),new r("aren",12,1),new r("heten",12,1),new r("ern",-1,1),new r("ar",-1,1),new r("er",-1,1),new r("heter",18,1),new r("or",-1,1),new r("s",-1,2),new r("as",21,1),new r("arnas",22,1),new r("ernas",22,1),new r("ornas",22,1),new r("es",21,1),new r("ades",26,1),new r("andes",26,1),new r("ens",21,1),new r("arens",29,1),new r("hetens",29,1),new r("erns",21,1),new r("at",-1,1),new r("andet",-1,1),new r("het",-1,1),new r("ast",-1,1)],s=[new r("dd",-1,-1),new r("gd",-1,-1),new r("nn",-1,-1),new r("dt",-1,-1),new r("gt",-1,-1),new r("kt",-1,-1),new r("tt",-1,-1)],a=[new r("ig",-1,1),new r("lig",0,1),new r("els",-1,1),new r("fullt",-1,3),new r("löst",-1,2)],o=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,24,0,32],u=[119,127,149],m=new n;this.setCurrent=function(e){m.setCurrent(e)},this.getCurrent=function(){return m.getCurrent()},this.stem=function(){var r,n=m.cursor;return function(){var r,n=m.cursor+3;if(t=m.limit,0<=n||n<=m.limit){for(e=n;;){if(r=m.cursor,m.in_grouping(o,97,246)){m.cursor=r;break}if(m.cursor=r,m.cursor>=m.limit)return;m.cursor++}for(;!m.out_grouping(o,97,246);){if(m.cursor>=m.limit)return;m.cursor++}(t=m.cursor)<e&&(t=e)}}(),m.limit_backward=n,m.cursor=m.limit,function(){var e,r=m.limit_backward;if(m.cursor>=t&&(m.limit_backward=t,m.cursor=m.limit,m.ket=m.cursor,e=m.find_among_b(i,37),m.limit_backward=r,e))switch(m.bra=m.cursor,e){case 1:m.slice_del();break;case 2:m.in_grouping_b(u,98,121)&&m.slice_del()}}(),m.cursor=m.limit,r=m.limit_backward,m.cursor>=t&&(m.limit_backward=t,m.cursor=m.limit,m.find_among_b(s,7)&&(m.cursor=m.limit,m.ket=m.cursor,m.cursor>m.limit_backward&&(m.bra=--m.cursor,m.slice_del())),m.limit_backward=r),m.cursor=m.limit,function(){var e,r;if(m.cursor>=t){if(r=m.limit_backward,m.limit_backward=t,m.cursor=m.limit,m.ket=m.cursor,e=m.find_among_b(a,5))switch(m.bra=m.cursor,e){case 1:m.slice_del();break;case 2:m.slice_from("lös");break;case 3:m.slice_from("full")}m.limit_backward=r}}(),!0}},function(e){return"function"==typeof e.update?e.update(function(e){return t.setCurrent(e),t.stem(),t.getCurrent()}):(t.setCurrent(e),t.stem(),t.getCurrent())}),e.Pipeline.registerFunction(e.sv.stemmer,"stemmer-sv"),e.sv.stopWordFilter=e.generateStopWordFilter("alla allt att av blev bli blir blivit de dem den denna deras dess dessa det detta dig din dina ditt du där då efter ej eller en er era ert ett från för ha hade han hans har henne hennes hon honom hur här i icke ingen inom inte jag ju kan kunde man med mellan men mig min mina mitt mot mycket ni nu när någon något några och om oss på samma sedan sig sin sina sitta själv skulle som så sådan sådana sådant till under upp ut utan vad var vara varför varit varje vars vart vem vi vid vilka vilkas vilken vilket vår våra vårt än är åt över".split(" ")),e.Pipeline.registerFunction(e.sv.stopWordFilter,"stopWordFilter-sv")}}); |
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,6 @@ |
|||||||
|
# https://serverfault.com/a/525011 |
||||||
|
server { |
||||||
|
server_name _; |
||||||
|
listen *:80 default_server deferred; |
||||||
|
return 444; |
||||||
|
} |
@ -0,0 +1 @@ |
|||||||
|
add_header Content-Security-Policy-Report-Only "default-src 'self' 'unsafe-inline' 'unsafe-eval';"; |
@ -0,0 +1 @@ |
|||||||
|
add_header Content-Security-Policy-Report-Only "default-src 'self' 'unsafe-inline' 'unsafe-eval';"; |
@ -0,0 +1,29 @@ |
|||||||
|
#################### |
||||||
|
# |
||||||
|
# {{ server_name_default }} |
||||||
|
# http/{{ port_default }} |
||||||
|
# |
||||||
|
# basically, just redirects to https |
||||||
|
# |
||||||
|
#################### |
||||||
|
|
||||||
|
server { |
||||||
|
listen 80; |
||||||
|
listen [::]:80; |
||||||
|
server_name {{ server_name_default }}; |
||||||
|
return 301 https://{{ server_name_default }}$request_uri; |
||||||
|
} |
||||||
|
|
||||||
|
server { |
||||||
|
listen 80; |
||||||
|
listen [::]:80; |
||||||
|
server_name www.{{ server_name_default }}; |
||||||
|
return 301 https://www.{{ server_name_default }}$request_uri; |
||||||
|
} |
||||||
|
|
||||||
|
server { |
||||||
|
listen 80; |
||||||
|
listen [::]:80; |
||||||
|
server_name git.{{ server_name_default }}; |
||||||
|
return 301 https://git.{{ server_name_default }}$request_uri; |
||||||
|
} |
@ -0,0 +1,111 @@ |
|||||||
|
#################### |
||||||
|
# |
||||||
|
# {{ server_name_default }} |
||||||
|
# https/443 |
||||||
|
# |
||||||
|
# {{ server_name_default }} and www.{{ server_name_default }} |
||||||
|
# should handle the following cases: |
||||||
|
# - w/ and wiki/ should reverse proxy story_mw |
||||||
|
# - gitea subdomain should reverse proxy stormy_gitea |
||||||
|
# |
||||||
|
#################### |
||||||
|
|
||||||
|
|
||||||
|
# default |
||||||
|
server { |
||||||
|
listen 443 ssl; |
||||||
|
listen [::]:443 ssl; |
||||||
|
server_name {{ server_name_default }} default_server; |
||||||
|
|
||||||
|
ssl_certificate /etc/letsencrypt/live/{{ server_name_default }}/fullchain.pem; |
||||||
|
ssl_certificate_key /etc/letsencrypt/live/{{ server_name_default }}/privkey.pem; |
||||||
|
include /etc/letsencrypt/options-ssl-nginx.conf; |
||||||
|
include /etc/nginx/conf.d/secheaders.conf; |
||||||
|
include /etc/nginx/conf.d/csp.conf; |
||||||
|
|
||||||
|
location / { |
||||||
|
try_files $uri $uri/ =404; |
||||||
|
root /www/{{ server_name_default }}/htdocs; |
||||||
|
index index.html; |
||||||
|
} |
||||||
|
|
||||||
|
location /wiki/ { |
||||||
|
proxy_set_header X-Real-IP $remote_addr; |
||||||
|
proxy_set_header X-Forwarded-For $remote_addr; |
||||||
|
proxy_set_header Host $host; |
||||||
|
proxy_pass http://stormy_mw:8989/wiki/; |
||||||
|
} |
||||||
|
|
||||||
|
location /w/ { |
||||||
|
proxy_set_header X-Real-IP $remote_addr; |
||||||
|
proxy_set_header X-Forwarded-For $remote_addr; |
||||||
|
proxy_set_header Host $host; |
||||||
|
proxy_pass http://stormy_mw:8989/w/; |
||||||
|
} |
||||||
|
|
||||||
|
# ~ means case-sensitive regex match, rather than string literal |
||||||
|
# (ignores .git, .gitignore, etc.) |
||||||
|
location ~ /\.git { |
||||||
|
deny all; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
# www |
||||||
|
server { |
||||||
|
listen 443 ssl; |
||||||
|
listen [::]:443 ssl; |
||||||
|
server_name www.{{ server_name_default }}; |
||||||
|
|
||||||
|
ssl_certificate /etc/letsencrypt/live/www.{{ server_name_default }}/fullchain.pem; |
||||||
|
ssl_certificate_key /etc/letsencrypt/live/www.{{ server_name_default }}/privkey.pem; |
||||||
|
include /etc/letsencrypt/options-ssl-nginx.conf; |
||||||
|
include /etc/nginx/conf.d/secheaders.conf; |
||||||
|
include /etc/nginx/conf.d/csp.conf; |
||||||
|
|
||||||
|
root /www/{{ server_name_default }}/htdocs; |
||||||
|
|
||||||
|
location / { |
||||||
|
try_files $uri $uri/ =404; |
||||||
|
index index.html; |
||||||
|
} |
||||||
|
|
||||||
|
location /wiki/ { |
||||||
|
proxy_set_header X-Real-IP $remote_addr; |
||||||
|
proxy_set_header X-Forwarded-For $remote_addr; |
||||||
|
proxy_set_header Host $host; |
||||||
|
proxy_pass http://stormy_mw:8989/wiki/; |
||||||
|
} |
||||||
|
|
||||||
|
location /w/ { |
||||||
|
proxy_set_header X-Real-IP $remote_addr; |
||||||
|
proxy_set_header X-Forwarded-For $remote_addr; |
||||||
|
proxy_set_header Host $host; |
||||||
|
proxy_pass http://stormy_mw:8989/w/; |
||||||
|
} |
||||||
|
|
||||||
|
location ~ /\.git { |
||||||
|
deny all; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
# gitea |
||||||
|
server { |
||||||
|
listen 443 ssl; |
||||||
|
listen [::]:443 ssl; |
||||||
|
server_name git.{{ server_name_default }}; |
||||||
|
|
||||||
|
ssl_certificate /etc/letsencrypt/live/git.{{ server_name_default }}/fullchain.pem; |
||||||
|
ssl_certificate_key /etc/letsencrypt/live/git.{{ server_name_default }}/privkey.pem; |
||||||
|
include /etc/letsencrypt/options-ssl-nginx.conf; |
||||||
|
include /etc/nginx/conf.d/secheaders.conf; |
||||||
|
include /etc/nginx/conf.d/giteacsp.conf; |
||||||
|
|
||||||
|
location / { |
||||||
|
proxy_set_header X-Real-IP $remote_addr; |
||||||
|
proxy_set_header X-Forwarded-For $remote_addr; |
||||||
|
proxy_set_header Host $host; |
||||||
|
proxy_pass http://stormy_gitea:3000/; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,8 @@ |
|||||||
|
server_tokens off; |
||||||
|
|
||||||
|
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload"; |
||||||
|
add_header X-Frame-Options SAMEORIGIN; |
||||||
|
add_header X-Content-Type-Options nosniff; |
||||||
|
add_header X-XSS-Protection "1; mode=block"; |
||||||
|
|
||||||
|
client_max_body_size 100m; |
@ -0,0 +1,17 @@ |
|||||||
|
# https://hub.docker.com/r/kvaps/letsencrypt-webroot/ |
||||||
|
# https://github.com/dib-lab/wort/blob/master/docker-compose.yml |
||||||
|
version: "3.1" |
||||||
|
services: |
||||||
|
stormy_nginx: |
||||||
|
restart: always |
||||||
|
image: nginx |
||||||
|
hostname: charlesreid1.blue |
||||||
|
command: /bin/bash -c "nginx -g 'daemon off;'" |
||||||
|
volumes: |
||||||
|
- "./conf.d:/etc/nginx/conf.d" |
||||||
|
- "/etc/localtime:/etc/localtime:ro" |
||||||
|
- "/etc/letsencrypt:/etc/letsencrypt" |
||||||
|
- "./www:/usr/share/nginx/html:ro" |
||||||
|
ports: |
||||||
|
- "80:80" |
||||||
|
- "443:443" |
@ -0,0 +1,83 @@ |
|||||||
|
# d-nginx-charlesreid1 |
||||||
|
|
||||||
|
This repo contains docker containers |
||||||
|
and a docker compose file for running |
||||||
|
an nginx web server for static content |
||||||
|
on charlesreid1.com. |
||||||
|
|
||||||
|
This repo is used in [pod-charlesreid1](https://git.charlesreid1.com/docker/pod-charlesreid1.git). |
||||||
|
|
||||||
|
The services are just: |
||||||
|
|
||||||
|
* nginx |
||||||
|
|
||||||
|
If you want to do SSL you can, but you have to |
||||||
|
run Let's Encrypt outside of the container |
||||||
|
and bind-mount your certificates into the |
||||||
|
container at `/etc/letsencrypt`. |
||||||
|
|
||||||
|
Pretty simple, right? |
||||||
|
|
||||||
|
## Config files |
||||||
|
|
||||||
|
All `*.conf` files in the `conf.d/` directory will be picked up by nginx. |
||||||
|
|
||||||
|
The config files must be named `*.conf`. |
||||||
|
|
||||||
|
## Volumes |
||||||
|
|
||||||
|
No data volumes are used. |
||||||
|
|
||||||
|
* nginx static content is a bind-mounted host directory |
||||||
|
* lets encrypt generates site certs, which will be bind-mounted into host directory |
||||||
|
|
||||||
|
``` |
||||||
|
web: |
||||||
|
volumes: |
||||||
|
- ./letsencrypt_certs:/etc/nginx/certs |
||||||
|
- ./letsencrypt_www:/var/www/letsencrypt |
||||||
|
|
||||||
|
letsencrypt: |
||||||
|
image: certbot/certbot |
||||||
|
command: /bin/true |
||||||
|
volumes: |
||||||
|
- ./letsencrypt_certs:/etc/letsencrypt |
||||||
|
- ./letsencrypt_www:/var/www/letsencrypt |
||||||
|
``` |
||||||
|
|
||||||
|
## Certs and Secrets |
||||||
|
|
||||||
|
Lets Encrypt should generate certificates at `/etc/letsencrypt/live/domain/`: |
||||||
|
|
||||||
|
``` |
||||||
|
root@krash:/home/charles/codes/docker/pod-charlesreid1-site# ls -l /etc/letsencrypt/live/charlesreid1.blue/ |
||||||
|
total 4 |
||||||
|
lrwxrwxrwx 1 root root 41 Mar 27 01:03 cert.pem -> ../../archive/charlesreid1.blue/cert1.pem |
||||||
|
lrwxrwxrwx 1 root root 42 Mar 27 01:03 chain.pem -> ../../archive/charlesreid1.blue/chain1.pem |
||||||
|
lrwxrwxrwx 1 root root 46 Mar 27 01:03 fullchain.pem -> ../../archive/charlesreid1.blue/fullchain1.pem |
||||||
|
lrwxrwxrwx 1 root root 44 Mar 27 01:03 privkey.pem -> ../../archive/charlesreid1.blue/privkey1.pem |
||||||
|
-rw-r--r-- 1 root root 543 Mar 27 01:03 README |
||||||
|
``` |
||||||
|
|
||||||
|
These certificate files will be bind-mounted into the nginx container. |
||||||
|
|
||||||
|
## Backups |
||||||
|
|
||||||
|
Site content comes from github. |
||||||
|
Nothing to back up. |
||||||
|
|
||||||
|
## Static Content |
||||||
|
|
||||||
|
Question: should we bake the site's |
||||||
|
static content into the container, |
||||||
|
and require rebuild/redeploy when |
||||||
|
site content changes? |
||||||
|
|
||||||
|
Answer: No. We clone a local copy of |
||||||
|
the gh-pages branch, and bind-mount |
||||||
|
that into the container. |
||||||
|
|
||||||
|
This enables webhooks to update |
||||||
|
the static site contents |
||||||
|
without disturbing the container. |
||||||
|
|
@ -1,476 +0,0 @@ |
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!DOCTYPE html> |
|
||||||
<html lang="en" class="no-js"> |
|
||||||
<head> |
|
||||||
|
|
||||||
<meta charset="utf-8"> |
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1"> |
|
||||||
<meta http-equiv="x-ua-compatible" content="ie=edge"> |
|
||||||
|
|
||||||
|
|
||||||
<link rel="canonical" href="https://pages.charlesreid1.com/d-nginx-charlesreid1/"> |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<meta name="lang:clipboard.copy" content="Copy to clipboard"> |
|
||||||
|
|
||||||
<meta name="lang:clipboard.copied" content="Copied to clipboard"> |
|
||||||
|
|
||||||
<meta name="lang:search.language" content="en"> |
|
||||||
|
|
||||||
<meta name="lang:search.pipeline.stopwords" content="True"> |
|
||||||
|
|
||||||
<meta name="lang:search.pipeline.trimmer" content="True"> |
|
||||||
|
|
||||||
<meta name="lang:search.result.none" content="No matching documents"> |
|
||||||
|
|
||||||
<meta name="lang:search.result.one" content="1 matching document"> |
|
||||||
|
|
||||||
<meta name="lang:search.result.other" content="# matching documents"> |
|
||||||
|
|
||||||
<meta name="lang:search.tokenizer" content="[\s\-]+"> |
|
||||||
|
|
||||||
<link rel="shortcut icon" href="."> |
|
||||||
<meta name="generator" content="mkdocs-1.0, mkdocs-material-3.0.3"> |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<title>d-nginx-charlesreid1</title> |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="assets/stylesheets/application.451f80e5.css"> |
|
||||||
|
|
||||||
<link rel="stylesheet" href="assets/stylesheets/application-palette.22915126.css"> |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<meta name="theme-color" content="#7cb342"> |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script src="assets/javascripts/modernizr.1aa3b519.js"></script> |
|
||||||
|
|
||||||
|
|
||||||
<link href="https://fonts.gstatic.com" rel="preconnect" crossorigin> |
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700|Roboto+Mono"> |
|
||||||
<style>body,input{font-family:"Roboto","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono","Courier New",Courier,monospace}</style> |
|
||||||
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="assets/fonts/material-icons.css"> |
|
||||||
|
|
||||||
<link rel="stylesheet" href="css/custom.css"> |
|
||||||
|
|
||||||
|
|
||||||
</head> |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<body dir="ltr" data-md-color-primary="light-green" data-md-color-accent="light-green"> |
|
||||||
|
|
||||||
<svg class="md-svg"> |
|
||||||
<defs> |
|
||||||
|
|
||||||
|
|
||||||
</defs> |
|
||||||
</svg> |
|
||||||
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off"> |
|
||||||
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off"> |
|
||||||
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label> |
|
||||||
|
|
||||||
<a href="#d-nginx-charlesreid1" tabindex="1" class="md-skip"> |
|
||||||
Skip to content |
|
||||||
</a> |
|
||||||
|
|
||||||
|
|
||||||
<header class="md-header" data-md-component="header"> |
|
||||||
<nav class="md-header-nav md-grid"> |
|
||||||
<div class="md-flex"> |
|
||||||
<div class="md-flex__cell md-flex__cell--shrink"> |
|
||||||
<a href="https://pages.charlesreid1.com/d-nginx-charlesreid1" title="d-nginx-charlesreid1" class="md-header-nav__button md-logo"> |
|
||||||
|
|
||||||
<i class="md-icon">input</i> |
|
||||||
|
|
||||||
</a> |
|
||||||
</div> |
|
||||||
<div class="md-flex__cell md-flex__cell--shrink"> |
|
||||||
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label> |
|
||||||
</div> |
|
||||||
<div class="md-flex__cell md-flex__cell--stretch"> |
|
||||||
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title"> |
|
||||||
|
|
||||||
|
|
||||||
<span class="md-header-nav__topic"> |
|
||||||
d-nginx-charlesreid1 |
|
||||||
</span> |
|
||||||
<span class="md-header-nav__topic"> |
|
||||||
Home |
|
||||||
</span> |
|
||||||
|
|
||||||
|
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<div class="md-flex__cell md-flex__cell--shrink"> |
|
||||||
|
|
||||||
|
|
||||||
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label> |
|
||||||
|
|
||||||
<div class="md-search" data-md-component="search" role="dialog"> |
|
||||||
<label class="md-search__overlay" for="__search"></label> |
|
||||||
<div class="md-search__inner" role="search"> |
|
||||||
<form class="md-search__form" name="search"> |
|
||||||
<input type="text" class="md-search__input" name="query" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active"> |
|
||||||
<label class="md-icon md-search__icon" for="__search"></label> |
|
||||||
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1"> |
|
||||||
 |
|
||||||
</button> |
|
||||||
</form> |
|
||||||
<div class="md-search__output"> |
|
||||||
<div class="md-search__scrollwrap" data-md-scrollfix> |
|
||||||
<div class="md-search-result" data-md-component="result"> |
|
||||||
<div class="md-search-result__meta"> |
|
||||||
Type to start searching |
|
||||||
</div> |
|
||||||
<ol class="md-search-result__list"></ol> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
|
|
||||||
|
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="md-flex__cell md-flex__cell--shrink"> |
|
||||||
<div class="md-header-nav__source"> |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a href="https://git.charlesreid1.com/docker/d-nginx-charlesreid1" title="Go to repository" class="md-source" data-md-source=""> |
|
||||||
|
|
||||||
<div class="md-source__repository"> |
|
||||||
d-nginx-charlesreid1 |
|
||||||
</div> |
|
||||||
</a> |
|
||||||
|
|
||||||
</div> |
|
||||||
</div> |
|
||||||
|
|
||||||
</div> |
|
||||||
</nav> |
|
||||||
</header> |
|
||||||
|
|
||||||
<div class="md-container"> |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<main class="md-main"> |
|
||||||
<div class="md-main__inner md-grid" data-md-component="container"> |
|
||||||
|
|
||||||
|
|
||||||
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation"> |
|
||||||
<div class="md-sidebar__scrollwrap"> |
|
||||||
<div class="md-sidebar__inner"> |
|
||||||
<nav class="md-nav md-nav--primary" data-md-level="0"> |
|
||||||
<label class="md-nav__title md-nav__title--site" for="__drawer"> |
|
||||||
<a href="https://pages.charlesreid1.com/d-nginx-charlesreid1" title="d-nginx-charlesreid1" class="md-nav__button md-logo"> |
|
||||||
|
|
||||||
<i class="md-icon">input</i> |
|
||||||
|
|
||||||
</a> |
|
||||||
d-nginx-charlesreid1 |
|
||||||
</label> |
|
||||||
|
|
||||||
<div class="md-nav__source"> |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a href="https://git.charlesreid1.com/docker/d-nginx-charlesreid1" title="Go to repository" class="md-source" data-md-source=""> |
|
||||||
|
|
||||||
<div class="md-source__repository"> |
|
||||||
d-nginx-charlesreid1 |
|
||||||
</div> |
|
||||||
</a> |
|
||||||
|
|
||||||
</div> |
|
||||||
|
|
||||||
<ul class="md-nav__list" data-md-scrollfix> |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<li class="md-nav__item md-nav__item--active"> |
|
||||||
|
|
||||||
<input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="__toc"> |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<label class="md-nav__link md-nav__link--active" for="__toc"> |
|
||||||
Home |
|
||||||
</label> |
|
||||||
|
|
||||||
<a href="." title="Home" class="md-nav__link md-nav__link--active"> |
|
||||||
Home |
|
||||||
</a> |
|
||||||
|
|
||||||
|
|
||||||
<nav class="md-nav md-nav--secondary"> |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<label class="md-nav__title" for="__toc">Table of contents</label> |
|
||||||
<ul class="md-nav__list" data-md-scrollfix> |
|
||||||
|
|
||||||
<li class="md-nav__item"> |
|
||||||
<a href="#config-files" title="Config files" class="md-nav__link"> |
|
||||||
Config files |
|
||||||
</a> |
|
||||||
|
|
||||||
</li> |
|
||||||
|
|
||||||
<li class="md-nav__item"> |
|
||||||
<a href="#volumes" title="Volumes" class="md-nav__link"> |
|
||||||
Volumes |
|
||||||
</a> |
|
||||||
|
|
||||||
</li> |
|
||||||
|
|
||||||
<li class="md-nav__item"> |
|
||||||
<a href="#certs-and-secrets" title="Certs and Secrets" class="md-nav__link"> |
|
||||||
Certs and Secrets |
|
||||||
</a> |
|
||||||
|
|
||||||
</li> |
|
||||||
|
|
||||||
<li class="md-nav__item"> |
|
||||||
<a href="#backups" title="Backups" class="md-nav__link"> |
|
||||||
Backups |
|
||||||
</a> |
|
||||||
|
|
||||||
</li> |
|
||||||
|
|
||||||
<li class="md-nav__item"> |
|
||||||
<a href="#static-content" title="Static Content" class="md-nav__link"> |
|
||||||
Static Content |
|
||||||
</a> |
|
||||||
|
|
||||||
</li> |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</ul> |
|
||||||
|
|
||||||
</nav> |
|
||||||
|
|
||||||
</li> |
|
||||||
|
|
||||||
|
|
||||||
</ul> |
|
||||||
</nav> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
|
|
||||||
|
|
||||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc"> |
|
||||||
<div class="md-sidebar__scrollwrap"> |
|
||||||
<div class="md-sidebar__inner"> |
|
||||||
|
|
||||||
<nav class="md-nav md-nav--secondary"> |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<label class="md-nav__title" for="__toc">Table of contents</label> |
|
||||||
<ul class="md-nav__list" data-md-scrollfix> |
|
||||||
|
|
||||||
<li class="md-nav__item"> |
|
||||||
<a href="#config-files" title="Config files" class="md-nav__link"> |
|
||||||
Config files |
|
||||||
</a> |
|
||||||
|
|
||||||
</li> |
|
||||||
|
|
||||||
<li class="md-nav__item"> |
|
||||||
<a href="#volumes" title="Volumes" class="md-nav__link"> |
|
||||||
Volumes |
|
||||||
</a> |
|
||||||
|
|
||||||
</li> |
|
||||||
|
|
||||||
<li class="md-nav__item"> |
|
||||||
<a href="#certs-and-secrets" title="Certs and Secrets" class="md-nav__link"> |
|
||||||
Certs and Secrets |
|
||||||
</a> |
|
||||||
|
|
||||||
</li> |
|
||||||
|
|
||||||
<li class="md-nav__item"> |
|
||||||
<a href="#backups" title="Backups" class="md-nav__link"> |
|
||||||
Backups |
|
||||||
</a> |
|
||||||
|
|
||||||
</li> |
|
||||||
|
|
||||||
<li class="md-nav__item"> |
|
||||||
<a href="#static-content" title="Static Content" class="md-nav__link"> |
|
||||||
Static Content |
|
||||||
</a> |
|
||||||
|
|
||||||
</li> |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</ul> |
|
||||||
|
|
||||||
</nav> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
|
|
||||||
|
|
||||||
<div class="md-content"> |
|
||||||
<article class="md-content__inner md-typeset"> |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h1 id="d-nginx-charlesreid1">d-nginx-charlesreid1<a class="headerlink" href="#d-nginx-charlesreid1" title="Permanent link">¶</a></h1> |
|
||||||
<p>This repo contains docker containers |
|
||||||
and a docker compose file for running |
|
||||||
an nginx web server for static content |
|
||||||
on charlesreid1.com.</p> |
|
||||||
<p>This repo is used in <a href="https://git.charlesreid1.com/docker/pod-charlesreid1.git">pod-charlesreid1</a>.</p> |
|
||||||
<p>The services are just:</p> |
|
||||||
<ul> |
|
||||||
<li>nginx</li> |
|
||||||
</ul> |
|
||||||
<p>If you want to do SSL you can, but you have to |
|
||||||
run Let's Encrypt outside of the container |
|
||||||
and bind-mount your certificates into the |
|
||||||
container at <code>/etc/letsencrypt</code>.</p> |
|
||||||
<p>Pretty simple, right?</p> |
|
||||||
<h2 id="config-files">Config files<a class="headerlink" href="#config-files" title="Permanent link">¶</a></h2> |
|
||||||
<p>All <code>*.conf</code> files in the <code>conf.d/</code> directory will be picked up by nginx.</p> |
|
||||||
<p>The config files must be named <code>*.conf</code>.</p> |
|
||||||
<h2 id="volumes">Volumes<a class="headerlink" href="#volumes" title="Permanent link">¶</a></h2> |
|
||||||
<p>No data volumes are used.</p> |
|
||||||
<ul> |
|
||||||
<li>nginx static content is a bind-mounted host directory</li> |
|
||||||
<li>lets encrypt generates site certs, which will be bind-mounted into host directory</li> |
|
||||||
</ul> |
|
||||||
<div class="codehilite"><pre><span></span> web: |
|
||||||
volumes: |
|
||||||
- ./letsencrypt_certs:/etc/nginx/certs |
|
||||||
- ./letsencrypt_www:/var/www/letsencrypt |
|
||||||
|
|
||||||
letsencrypt: |
|
||||||
image: certbot/certbot |
|
||||||
command: /bin/true |
|
||||||
volumes: |
|
||||||
- ./letsencrypt_certs:/etc/letsencrypt |
|
||||||
- ./letsencrypt_www:/var/www/letsencrypt |
|
||||||
</pre></div> |
|
||||||
|
|
||||||
|
|
||||||
<h2 id="certs-and-secrets">Certs and Secrets<a class="headerlink" href="#certs-and-secrets" title="Permanent link">¶</a></h2> |
|
||||||
<p>Lets Encrypt should generate certificates at <code>/etc/letsencrypt/live/domain/</code>:</p> |
|
||||||
<div class="codehilite"><pre><span></span>root@krash:/home/charles/codes/docker/pod-charlesreid1-site# ls -l /etc/letsencrypt/live/charlesreid1.blue/ |
|
||||||
total 4 |
|
||||||
lrwxrwxrwx 1 root root 41 Mar 27 01:03 cert.pem -> ../../archive/charlesreid1.blue/cert1.pem |
|
||||||
lrwxrwxrwx 1 root root 42 Mar 27 01:03 chain.pem -> ../../archive/charlesreid1.blue/chain1.pem |
|
||||||
lrwxrwxrwx 1 root root 46 Mar 27 01:03 fullchain.pem -> ../../archive/charlesreid1.blue/fullchain1.pem |
|
||||||
lrwxrwxrwx 1 root root 44 Mar 27 01:03 privkey.pem -> ../../archive/charlesreid1.blue/privkey1.pem |
|
||||||
-rw-r--r-- 1 root root 543 Mar 27 01:03 README |
|
||||||
</pre></div> |
|
||||||
|
|
||||||
|
|
||||||
<p>These certificate files will be bind-mounted into the nginx container.</p> |
|
||||||
<h2 id="backups">Backups<a class="headerlink" href="#backups" title="Permanent link">¶</a></h2> |
|
||||||
<p>Site content comes from github. |
|
||||||
Nothing to back up.</p> |
|
||||||
<h2 id="static-content">Static Content<a class="headerlink" href="#static-content" title="Permanent link">¶</a></h2> |
|
||||||
<p>Question: should we bake the site's |
|
||||||
static content into the container, |
|
||||||
and require rebuild/redeploy when |
|
||||||
site content changes?</p> |
|
||||||
<p>Answer: No. We clone a local copy of |
|
||||||
the gh-pages branch, and bind-mount |
|
||||||
that into the container.</p> |
|
||||||
<p>This enables webhooks to update |
|
||||||
the static site contents |
|
||||||
without disturbing the container.</p> |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</article> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</main> |
|
||||||
|
|
||||||
|
|
||||||
<footer class="md-footer"> |
|
||||||
|
|
||||||
<div class="md-footer-meta md-typeset"> |
|
||||||
<div class="md-footer-meta__inner md-grid"> |
|
||||||
<div class="md-footer-copyright"> |
|
||||||
|
|
||||||
<div class="md-footer-copyright__highlight"> |
|
||||||
Copyright © 2018 <a href="https://charlesreid1.com">Charles Reid</a>, released under the <a href="https://opensource.org/licenses/MIT">MIT license</a> |
|
||||||
</div> |
|
||||||
|
|
||||||
powered by |
|
||||||
<a href="https://www.mkdocs.org">MkDocs</a> |
|
||||||
and |
|
||||||
<a href="https://squidfunk.github.io/mkdocs-material/"> |
|
||||||
Material for MkDocs</a> |
|
||||||
</div> |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</footer> |
|
||||||
|
|
||||||
</div> |
|
||||||
|
|
||||||
<script src="assets/javascripts/application.e72fd936.js"></script> |
|
||||||
|
|
||||||
<script>app.initialize({version:"1.0",url:{base:"."}})</script> |
|
||||||
|
|
||||||
<script src="search/main.js"></script> |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</body> |
|
||||||
</html> |
|
@ -0,0 +1,36 @@ |
|||||||
|
site_name: d-nginx-charlesreid1 |
||||||
|
site_url: https://pages.charlesreid1.com/d-nginx-charlesreid1 |
||||||
|
repo_name: d-nginx-charlesreid1 |
||||||
|
repo_url: https://git.charlesreid1.com/docker/d-nginx-charlesreid1 |
||||||
|
edit_uri: "" |
||||||
|
|
||||||
|
copyright: 'Copyright © 2018 <a href="https://charlesreid1.com">Charles Reid</a>, released under the <a href="https://opensource.org/licenses/MIT">MIT license</a>' |
||||||
|
|
||||||
|
docs_dir: docs |
||||||
|
site_dir: site |
||||||
|
extra_css: |
||||||
|
- css/custom.css |
||||||
|
theme: |
||||||
|
name: null |
||||||
|
custom_dir: 'mkdocs-material/material' |
||||||
|
palette: |
||||||
|
primary: 'light green' |
||||||
|
accent: 'light green' |
||||||
|
logo: |
||||||
|
icon: 'input' |
||||||
|
font: |
||||||
|
text: 'Roboto' |
||||||
|
code: 'Roboto Mono' |
||||||
|
nav: |
||||||
|
- 'Home': 'index.md' |
||||||
|
|
||||||
|
# Extensions |
||||||
|
markdown_extensions: |
||||||
|
- admonition |
||||||
|
- codehilite: |
||||||
|
guess_lang: false |
||||||
|
- toc: |
||||||
|
permalink: true |
||||||
|
|
||||||
|
|
||||||
|
strict: true |
@ -0,0 +1,30 @@ |
|||||||
|
import glob |
||||||
|
import os |
||||||
|
import subprocess |
||||||
|
|
||||||
|
""" |
||||||
|
Clean d-nginx-charlesreid1 conf.d directory |
||||||
|
|
||||||
|
|
||||||
|
This script cleans out the conf.d directory |
||||||
|
in the d-nginx-charlesreid1 repo. |
||||||
|
|
||||||
|
This script should be run before you generate a new set |
||||||
|
of config files from the nginx config file templates in |
||||||
|
d-nginx-charlesreid1/conf.d_templates/ |
||||||
|
|
||||||
|
This script cleans out all the config files in the folder |
||||||
|
d-nginx-charlesreid1/conf.d/ |
||||||
|
|
||||||
|
That way there are no old config files to clash with the |
||||||
|
new ones. |
||||||
|
""" |
||||||
|
|
||||||
|
HERE = os.path.abspath(os.path.dirname(__file__)) |
||||||
|
CONF = os.path.abspath(os.path.join(HERE,'..','conf.d')) |
||||||
|
|
||||||
|
for f in glob.glob(os.path.join(CONF,"*.conf")): |
||||||
|
if os.path.basename(f)!="_.conf": |
||||||
|
cmd = ['rm','-fr',f] |
||||||
|
subprocess.call(cmd) |
||||||
|
|
@ -1,94 +0,0 @@ |
|||||||
function getSearchTermFromLocation() { |
|
||||||
var sPageURL = window.location.search.substring(1); |
|
||||||
var sURLVariables = sPageURL.split('&'); |
|
||||||
for (var i = 0; i < sURLVariables.length; i++) { |
|
||||||
var sParameterName = sURLVariables[i].split('='); |
|
||||||
if (sParameterName[0] == 'q') { |
|
||||||
return decodeURIComponent(sParameterName[1].replace(/\+/g, '%20')); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
function formatResult (location, title, summary) { |
|
||||||
return '<article><h3><a href="' + base_url + '/' + location + '">'+ title + '</a></h3><p>' + summary +'</p></article>'; |
|
||||||
} |
|
||||||
|
|
||||||
function displayResults (results) { |
|
||||||
var search_results = document.getElementById("mkdocs-search-results"); |
|
||||||
while (search_results.firstChild) { |
|
||||||
search_results.removeChild(search_results.firstChild); |
|
||||||
} |
|
||||||
if (results.length > 0){ |
|
||||||
for (var i=0; i < results.length; i++){ |
|
||||||
var result = results[i]; |
|
||||||
var html = formatResult(result.location, result.title, result.summary); |
|
||||||
search_results.insertAdjacentHTML('beforeend', html); |
|
||||||
} |
|
||||||
} else { |
|
||||||
search_results.insertAdjacentHTML('beforeend', "<p>No results found</p>"); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
function doSearch () { |
|
||||||
var query = document.getElementById('mkdocs-search-query').value; |
|
||||||
if (query.length > 2) { |
|
||||||
console.log('Searching with query: ' + query); |
|
||||||
if (!window.Worker) { |
|
||||||
displayResults(search(query)); |
|
||||||
} else { |
|
||||||
searchWorker.postMessage({query: query}); |
|
||||||
} |
|
||||||
} else { |
|
||||||
// Clear results for short queries
|
|
||||||
displayResults([]); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
function initSearch () { |
|
||||||
var search_input = document.getElementById('mkdocs-search-query'); |
|
||||||
if (search_input) { |
|
||||||
search_input.addEventListener("keyup", doSearch); |
|
||||||
} |
|
||||||
|
|
||||||
var term = getSearchTermFromLocation(); |
|
||||||
if (term) { |
|
||||||
search_input.value = term; |
|
||||||
doSearch(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
function onWorkerMessage (e) { |
|
||||||
if (e.data.results) { |
|
||||||
var results = e.data.results; |
|
||||||
displayResults(results); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
if (!window.Worker) { |
|
||||||
console.log('Web Worker API not supported'); |
|
||||||
// load index in main thread
|
|
||||||
$.getScript(base_url + "/search/worker.js").done(function () { |
|
||||||
console.log('Loaded worker'); |
|
||||||
init(); |
|
||||||
}).fail(function (jqxhr, settings, exception) { |
|
||||||
console.error('Could not load worker.js'); |
|
||||||
}); |
|
||||||
} else { |
|
||||||
// Wrap search in a web worker
|
|
||||||
var searchWorker = new Worker(base_url + "/search/worker.js"); |
|
||||||
searchWorker.postMessage({init: true}); |
|
||||||
searchWorker.onmessage = onWorkerMessage; |
|
||||||
} |
|
||||||
|
|
||||||
$(function() { |
|
||||||
var search_input = document.getElementById('mkdocs-search-query'); |
|
||||||
if (search_input) { |
|
||||||
search_input.addEventListener("keyup", doSearch); |
|
||||||
} |
|
||||||
|
|
||||||
var term = getSearchTermFromLocation(); |
|
||||||
if (term) { |
|
||||||
search_input.value = term; |
|
||||||
doSearch(); |
|
||||||
} |
|
||||||
}); |
|
@ -1 +0,0 @@ |
|||||||
{"config":{"lang":["en"],"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"d-nginx-charlesreid1 \u00b6 This repo contains docker containers and a docker compose file for running an nginx web server for static content on charlesreid1.com. This repo is used in pod-charlesreid1 . The services are just: nginx If you want to do SSL you can, but you have to run Let's Encrypt outside of the container and bind-mount your certificates into the container at /etc/letsencrypt . Pretty simple, right? Config files \u00b6 All *.conf files in the conf.d/ directory will be picked up by nginx. The config files must be named *.conf . Volumes \u00b6 No data volumes are used. nginx static content is a bind-mounted host directory lets encrypt generates site certs, which will be bind-mounted into host directory web: volumes: - ./letsencrypt_certs:/etc/nginx/certs - ./letsencrypt_www:/var/www/letsencrypt letsencrypt: image: certbot/certbot command: /bin/true volumes: - ./letsencrypt_certs:/etc/letsencrypt - ./letsencrypt_www:/var/www/letsencrypt Certs and Secrets \u00b6 Lets Encrypt should generate certificates at /etc/letsencrypt/live/domain/ : root@krash:/home/charles/codes/docker/pod-charlesreid1-site# ls -l /etc/letsencrypt/live/charlesreid1.blue/ total 4 lrwxrwxrwx 1 root root 41 Mar 27 01:03 cert.pem -> ../../archive/charlesreid1.blue/cert1.pem lrwxrwxrwx 1 root root 42 Mar 27 01:03 chain.pem -> ../../archive/charlesreid1.blue/chain1.pem lrwxrwxrwx 1 root root 46 Mar 27 01:03 fullchain.pem -> ../../archive/charlesreid1.blue/fullchain1.pem lrwxrwxrwx 1 root root 44 Mar 27 01:03 privkey.pem -> ../../archive/charlesreid1.blue/privkey1.pem -rw-r--r-- 1 root root 543 Mar 27 01:03 README These certificate files will be bind-mounted into the nginx container. Backups \u00b6 Site content comes from github. Nothing to back up. Static Content \u00b6 Question: should we bake the site's static content into the container, and require rebuild/redeploy when site content changes? Answer: No. We clone a local copy of the gh-pages branch, and bind-mount that into the container. This enables webhooks to update the static site contents without disturbing the container.","title":"Home"},{"location":"#d-nginx-charlesreid1","text":"This repo contains docker containers and a docker compose file for running an nginx web server for static content on charlesreid1.com. This repo is used in pod-charlesreid1 . The services are just: nginx If you want to do SSL you can, but you have to run Let's Encrypt outside of the container and bind-mount your certificates into the container at /etc/letsencrypt . Pretty simple, right?","title":"d-nginx-charlesreid1"},{"location":"#config-files","text":"All *.conf files in the conf.d/ directory will be picked up by nginx. The config files must be named *.conf .","title":"Config files"},{"location":"#volumes","text":"No data volumes are used. nginx static content is a bind-mounted host directory lets encrypt generates site certs, which will be bind-mounted into host directory web: volumes: - ./letsencrypt_certs:/etc/nginx/certs - ./letsencrypt_www:/var/www/letsencrypt letsencrypt: image: certbot/certbot command: /bin/true volumes: - ./letsencrypt_certs:/etc/letsencrypt - ./letsencrypt_www:/var/www/letsencrypt","title":"Volumes"},{"location":"#certs-and-secrets","text":"Lets Encrypt should generate certificates at /etc/letsencrypt/live/domain/ : root@krash:/home/charles/codes/docker/pod-charlesreid1-site# ls -l /etc/letsencrypt/live/charlesreid1.blue/ total 4 lrwxrwxrwx 1 root root 41 Mar 27 01:03 cert.pem -> ../../archive/charlesreid1.blue/cert1.pem lrwxrwxrwx 1 root root 42 Mar 27 01:03 chain.pem -> ../../archive/charlesreid1.blue/chain1.pem lrwxrwxrwx 1 root root 46 Mar 27 01:03 fullchain.pem -> ../../archive/charlesreid1.blue/fullchain1.pem lrwxrwxrwx 1 root root 44 Mar 27 01:03 privkey.pem -> ../../archive/charlesreid1.blue/privkey1.pem -rw-r--r-- 1 root root 543 Mar 27 01:03 README These certificate files will be bind-mounted into the nginx container.","title":"Certs and Secrets"},{"location":"#backups","text":"Site content comes from github. Nothing to back up.","title":"Backups"},{"location":"#static-content","text":"Question: should we bake the site's static content into the container, and require rebuild/redeploy when site content changes? Answer: No. We clone a local copy of the gh-pages branch, and bind-mount that into the container. This enables webhooks to update the static site contents without disturbing the container.","title":"Static Content"}]} |
|
@ -1,127 +0,0 @@ |
|||||||
var base_path = 'function' === typeof importScripts ? '.' : '/search/'; |
|
||||||
var allowSearch = false; |
|
||||||
var index; |
|
||||||
var documents = {}; |
|
||||||
var lang = ['en']; |
|
||||||
var data; |
|
||||||
|
|
||||||
function getScript(script, callback) { |
|
||||||
console.log('Loading script: ' + script); |
|
||||||
$.getScript(base_path + script).done(function () { |
|
||||||
callback(); |
|
||||||
}).fail(function (jqxhr, settings, exception) { |
|
||||||
console.log('Error: ' + exception); |
|
||||||
}); |
|
||||||
} |
|
||||||
|
|
||||||
function getScriptsInOrder(scripts, callback) { |
|
||||||
if (scripts.length === 0) { |
|
||||||
callback(); |
|
||||||
return; |
|
||||||
} |
|
||||||
getScript(scripts[0], function() { |
|
||||||
getScriptsInOrder(scripts.slice(1), callback); |
|
||||||
}); |
|
||||||
} |
|
||||||
|
|
||||||
function loadScripts(urls, callback) { |
|
||||||
if( 'function' === typeof importScripts ) { |
|
||||||
importScripts.apply(null, urls); |
|
||||||
callback(); |
|
||||||
} else { |
|
||||||
getScriptsInOrder(urls, callback); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
function onJSONLoaded () { |
|
||||||
data = JSON.parse(this.responseText); |
|
||||||
var scriptsToLoad = ['lunr.js']; |
|
||||||
if (data.config && data.config.lang && data.config.lang.length) { |
|
||||||
lang = data.config.lang; |
|
||||||
} |
|
||||||
if (lang.length > 1 || lang[0] !== "en") { |
|
||||||
scriptsToLoad.push('lunr.stemmer.support.js'); |
|
||||||
if (lang.length > 1) { |
|
||||||
scriptsToLoad.push('lunr.multi.js'); |
|
||||||
} |
|
||||||
for (var i=0; i < lang.length; i++) { |
|
||||||
if (lang[i] != 'en') { |
|
||||||
scriptsToLoad.push(['lunr', lang[i], 'js'].join('.')); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
loadScripts(scriptsToLoad, onScriptsLoaded); |
|
||||||
} |
|
||||||
|
|
||||||
function onScriptsLoaded () { |
|
||||||
console.log('All search scripts loaded, building Lunr index...'); |
|
||||||
if (data.config && data.config.separator && data.config.separator.length) { |
|
||||||
lunr.tokenizer.separator = new RegExp(data.config.separator); |
|
||||||
} |
|
||||||
if (data.index) { |
|
||||||
index = lunr.Index.load(data.index); |
|
||||||
data.docs.forEach(function (doc) { |
|
||||||
documents[doc.location] = doc; |
|
||||||
}); |
|
||||||
console.log('Lunr pre-built index loaded, search ready'); |
|
||||||
} else { |
|
||||||
index = lunr(function () { |
|
||||||
if (lang.length === 1 && lang[0] !== "en" && lunr[lang[0]]) { |
|
||||||
this.use(lunr[lang[0]]); |
|
||||||
} else if (lang.length > 1) { |
|
||||||
this.use(lunr.multiLanguage.apply(null, lang)); // spread operator not supported in all browsers: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator#Browser_compatibility
|
|
||||||
} |
|
||||||
this.field('title'); |
|
||||||
this.field('text'); |
|
||||||
this.ref('location'); |
|
||||||
|
|
||||||
for (var i=0; i < data.docs.length; i++) { |
|
||||||
var doc = data.docs[i]; |
|
||||||
this.add(doc); |
|
||||||
documents[doc.location] = doc; |
|
||||||
} |
|
||||||
}); |
|
||||||
console.log('Lunr index built, search ready'); |
|
||||||
} |
|
||||||
allowSearch = true; |
|
||||||
} |
|
||||||
|
|
||||||
function init () { |
|
||||||
var oReq = new XMLHttpRequest(); |
|
||||||
oReq.addEventListener("load", onJSONLoaded); |
|
||||||
var index_path = base_path + '/search_index.json'; |
|
||||||
if( 'function' === typeof importScripts ){ |
|
||||||
index_path = 'search_index.json'; |
|
||||||
} |
|
||||||
oReq.open("GET", index_path); |
|
||||||
oReq.send(); |
|
||||||
} |
|
||||||
|
|
||||||
function search (query) { |
|
||||||
if (!allowSearch) { |
|
||||||
console.error('Assets for search still loading'); |
|
||||||
return; |
|
||||||
} |
|
||||||
|
|
||||||
var resultDocuments = []; |
|
||||||
var results = index.search(query); |
|
||||||
for (var i=0; i < results.length; i++){ |
|
||||||
var result = results[i]; |
|
||||||
doc = documents[result.ref]; |
|
||||||
doc.summary = doc.text.substring(0, 200); |
|
||||||
resultDocuments.push(doc); |
|
||||||
} |
|
||||||
return resultDocuments; |
|
||||||
} |
|
||||||
|
|
||||||
if( 'function' === typeof importScripts ) { |
|
||||||
onmessage = function (e) { |
|
||||||
if (e.data.init) { |
|
||||||
init(); |
|
||||||
} else if (e.data.query) { |
|
||||||
postMessage({ results: search(e.data.query) }); |
|
||||||
} else { |
|
||||||
console.error("Worker - Unrecognized message: " + e); |
|
||||||
} |
|
||||||
}; |
|
||||||
} |
|
@ -1,8 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> |
|
||||||
<url> |
|
||||||
<loc>https://pages.charlesreid1.com/d-nginx-charlesreid1/</loc> |
|
||||||
<lastmod>2018-08-11</lastmod> |
|
||||||
<changefreq>daily</changefreq> |
|
||||||
</url> |
|
||||||
</urlset> |
|
Binary file not shown.
Loading…
Reference in new issue