From 31627739dd15590381cfc7b8da71a15e2eca584f Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Tue, 9 Aug 2016 16:46:26 -0400 Subject: [PATCH] Dev setup for tonyg to run a local S3 proxy --- configs/tonyg.rkt | 12 +++++++++-- configs/tonyg/nginx.locals3proxy.conf | 30 +++++++++++++++++++++++++++ configs/tonyg/run-s3-proxy.sh | 2 ++ 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 configs/tonyg/nginx.locals3proxy.conf create mode 100755 configs/tonyg/run-s3-proxy.sh diff --git a/configs/tonyg.rkt b/configs/tonyg.rkt index a8ddaa4..b1ab43a 100644 --- a/configs/tonyg.rkt +++ b/configs/tonyg.rkt @@ -3,17 +3,25 @@ (require "../src/main.rkt") (main (hash 'port 8444 'reloadable? #t - 'package-index-url "https://localhost:8444/pkgs-all.json.gz" + 'package-index-url "file:///home/tonyg/public_html/pkg-index-static/pkgs-all.json.gz" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Either: + ;; 'static-output-type 'file 'static-content-target-directory (build-path (find-system-path 'home-dir) "public_html/pkg-catalog-static") + 'static-urlprefix "https://localhost/~tonyg/pkg-catalog-static" + ;; ;; Or: + ;; ;; 'static-output-type 'aws-s3 ;; 'aws-s3-bucket+path "pkgs.leastfixedpoint.com/" + ;; ;; These two should be set to an HTTPS proxy (e.g. nginx) proxying to S3, + ;; ;; http://pkgs.leastfixedpoint.com.s3-website-us-east-1.amazonaws.com + ;; 'static-urlprefix "https://localhost:8446" + ;; 'dynamic-static-urlprefix "https://localhost:8446" + ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - 'static-urlprefix "https://localhost/~tonyg/pkg-catalog-static" 'dynamic-urlprefix "https://localhost:8444" 'backend-baseurl "https://localhost:8445" 'pkg-index-generated-directory (build-path (find-system-path 'home-dir) diff --git a/configs/tonyg/nginx.locals3proxy.conf b/configs/tonyg/nginx.locals3proxy.conf new file mode 100644 index 0000000..ba28f8b --- /dev/null +++ b/configs/tonyg/nginx.locals3proxy.conf @@ -0,0 +1,30 @@ +# As a regular user, run +# +# nginx -p . -c nginx.locals3proxy.conf + +daemon off; +pid ./nginx.pid; +error_log locals3proxy-error.log; + +events { + worker_connections 768; +} + +http { + server { + listen 8446 default_server ssl; + + access_log locals3proxy-access.log; + error_log locals3proxy-error.log; + + ssl_certificate /home/tonyg/src/racket-pkg-website/server-cert.pem; + ssl_certificate_key /home/tonyg/src/racket-pkg-website/private-key.pem; + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; + ssl_ciphers HIGH:!aNULL:!MD5; + + location / { + proxy_pass http://pkgs.leastfixedpoint.com.s3-website-us-east-1.amazonaws.com/; + proxy_http_version 1.1; + } + } +} diff --git a/configs/tonyg/run-s3-proxy.sh b/configs/tonyg/run-s3-proxy.sh new file mode 100755 index 0000000..3535e81 --- /dev/null +++ b/configs/tonyg/run-s3-proxy.sh @@ -0,0 +1,2 @@ +#!/bin/sh +exec nginx -p . -c nginx.locals3proxy.conf