Final S3 changes

This commit is contained in:
Jay McCarthy 2013-10-11 16:37:05 -06:00
parent caf69b0c8a
commit 8ff0193ebe
7 changed files with 40 additions and 21 deletions

View File

@ -1,7 +1,3 @@
/root
/static/pkgs
/static/pkg
/static/pkgs-all
*json
/static/atom.xml
/static.gz
/static-gen
/static-gen.gz

View File

@ -27,7 +27,8 @@
(define pkgs-path (build-path root "pkgs"))
(make-directory* pkgs-path)
(define static-path (build-path src "static"))
(define static.src-path (build-path src "static"))
(define static-path (build-path src "static-gen"))
(define (package-list)
(sort (map path->string (directory-list pkgs-path))

View File

@ -53,9 +53,11 @@
(package-info p)
#hash()))
(define new-pi (hash-deep-merge pi more-pi))
(define updated-pi (let ([now (current-seconds)])
(for/fold ([pi new-pi]) ([k (in-list '(last-edit last-checked last-updated))])
(hash-set pi k now))))
(define updated-pi
(let ([now (current-seconds)])
(for/fold ([pi new-pi])
([k (in-list '(last-edit last-checked last-updated))])
(hash-set pi k now))))
(package-info-set! p updated-pi)
(signal-update! (list p)))
(response/sexpr #t)]))
@ -379,7 +381,7 @@
(printf "launching on port ~a\n" port)
(signal-static! empty)
(thread
(λ ()
(λ ()
(forever
(sleep (* 24 60 60))
(signal-update! empty))))

View File

@ -11,7 +11,7 @@
(make-directory* (path-only p)))
(define s3-config (build-path (find-system-path 'home-dir) ".s3cfg-plt"))
(define s3-bucket "pkg.racket-lang.org")
(define s3-bucket "pkgs.racket-lang.org")
(define static.gz-path (path-add-suffix static-path ".gz"))

View File

@ -2,6 +2,8 @@
(require web-server/http
web-server/dispatch
racket/file
racket/port
racket/system
racket/match
json
racket/date
@ -239,14 +241,26 @@
(define (cache url file)
(define p (build-path static-path file))
(make-directory* (path-only p))
(with-output-to-file p
#:exists 'replace
(λ () ((response-output (main-dispatch (url->request url))) (current-output-port))))
(with-output-to-file (path-add-suffix p #".json")
#:exists 'replace
(λ () (write-json (convert-to-json (file->value p)))))
(define bs
(with-output-to-bytes
(λ ()
((response-output (main-dispatch (url->request url)))
(current-output-port)))))
(unless (and (file-exists? p)
(bytes=? bs (file->bytes p)))
(with-output-to-file p
#:exists 'replace
(λ () (display bs)))
(with-output-to-file (path-add-suffix p #".json")
#:exists 'replace
(λ () (write-json (convert-to-json (file->value p))))))
(void))
(system (format "cp -pr ~a/* ~a/"
static.src-path
static-path))
(cache "/atom.xml" "atom.xml")
(cache "/pkgs" "pkgs")
(cache "/pkgs-all" "pkgs-all")

View File

@ -1,5 +1,8 @@
var dynamic_host = "pkgd.racket-lang.org";
var dynamic_port = 443;
// xxx change this once the new dns entries are in
//var dynamic_host = "pkgd.racket-lang.org";
//var dynamic_port = 443;
var dynamic_host = "plt-etc.byu.edu";
var dynamic_port = 9004;
function dynamic_url ( u ) {
return "https://" + dynamic_host + ":" + dynamic_port + u + "?callback=?"; }

View File

@ -1,10 +1,13 @@
#!/bin/sh
# planet-compat
rsync -a --progress -h --delete --exclude root --exclude compiled --exclude doc ../../meta/pkg-index/ plt-etc:local/new-plt/pkgs/plt-services/meta/pkg-index/
rsync -a --progress -h --delete --exclude root --exclude static-gen --exclude static-gen.gz --exclude compiled --exclude doc ../../meta/pkg-index/ plt-etc:local/new-plt/pkgs/plt-services/meta/pkg-index/
rsync -a --progress -h --delete plt-etc:local/galaxy-roots/planet-compat/ planet-compat/root/
rsync -a --progress -h --delete plt-etc:local/galaxy-roots/official/ official/root/
rsync -a --progress -h --delete plt-etc:local/new-plt/pkgs/plt-services/meta/pkg-index//official/static-gen official/static-gen
rsync -a --progress -h --delete plt-etc:local/new-plt/pkgs/plt-services/meta/pkg-index//official/static-gen.gz official/static-gen.gz
# official
rsync -a --progress -h --delete --exclude root --exclude compiled --exclude doc ../../meta/pkg-index/ plt-etc:local/galaxy/meta/pkg-index/