diff --git a/CHANGES b/CHANGES new file mode 100644 index 00000000..bf97da94 --- /dev/null +++ b/CHANGES @@ -0,0 +1,21 @@ +Version 0.2.10 (Feb 16, 2015) + +* fixes for null-origin situations (#75, #96) +* better bash examples (#103) +* changelog and checksums for released files (#101, #105) + + +Version 0.2.9 (May 19, 2014) + +* ability to listen multiple IP addresses (#40, #43) +* proper support for TLS (#17) +* resource limits enforcement (a.k.a. maxforks feature, #46) +* passenv option to limit environment variables visible by running commands (#4) +* fix for problem of closing upgraded websocket connection when script is not found (#29) +* websocket origin restrictions via command line option (#20) +* minor update for help flag behavior +* minor fix for devconsole + +Version 0.2.8 (Jan 11, 2014) + +* ... \ No newline at end of file diff --git a/libwebsocketd/http_test.go b/libwebsocketd/http_test.go index a6142e86..7af5a30f 100644 --- a/libwebsocketd/http_test.go +++ b/libwebsocketd/http_test.go @@ -72,6 +72,8 @@ var CheckOriginTests = []struct { {"server.example.com", ReqHTTP, "http://example.com", OriginCouldDiffer, []string{"example.com:81"}, ReturnsError, "origin allowed port mismatch"}, {"server.example.com", ReqHTTP, "http://example.com", OriginCouldDiffer, []string{"example.com:81"}, ReturnsError, "origin allowed port mismatch"}, {"server.example.com", ReqHTTP, "http://example.com:81", OriginCouldDiffer, []string{"example.com:81"}, ReturnsPass, "origin allowed port 81 match"}, + {"server.example.com", ReqHTTP, "null", OriginCouldDiffer, NoOriginList, ReturnsPass, "any origin allowed, even null"}, + {"server.example.com", ReqHTTP, "", OriginCouldDiffer, NoOriginList, ReturnsPass, "any origin allowed, even empty"}, } func TestCheckOrigin(t *testing.T) { diff --git a/release/Makefile b/release/Makefile index aff7116d..1860fbab 100644 --- a/release/Makefile +++ b/release/Makefile @@ -19,7 +19,7 @@ LAST_PATCH_VERSION:=$(shell git ls-remote git@github.com:joewalnes/websocketd.gi VERSION_PATCH:=$(if $(LAST_PATCH_VERSION),$(shell expr $(LAST_PATCH_VERSION)),0) RELEASE_VERSION=$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH) -GO_VERSION=1.4 +GO_VERSION=1.4.1 PLATFORMS=linux_amd64 linux_386 linux_arm darwin_amd64 darwin_386 freebsd_amd64 freebsd_386 windows_386 windows_amd64 GO_SRC_URL=https://storage.googleapis.com/golang/go$(GO_VERSION).src.tar.gz @@ -45,14 +45,14 @@ FLAGS_windows_amd64 = $(FLAGS_all) GOOS=windows GOARCH=amd64 CGO_ENABLED=0 EXTENSION_windows_386=.exe EXTENSION_windows_amd64=.exe -msg=@/bin/echo -e "\x1b[33;01m>>> $1\x1b[0m" - -all: build deb rpm +all: build .PHONY: all -go-path/src/github.com/joewalnes/websocketd: +go-path/src/github.com/joewalnes/websocketd: ../*.go ../libwebsocketd/*.go + rm -f $@ mkdir -p go-path/src/github.com/joewalnes - ln -s ../../../../../ go-path/src/github.com/joewalnes/websocketd + cd go-path/src/github.com/joewalnes && ln -s ../../../../../ websocketd + # Download Go source code $(GO_DOWNLOAD): @@ -63,7 +63,6 @@ $(GO_DOWNLOAD): go-download: $(GO_DOWNLOAD) .PHONY: go-download - # Unpack Go source code $(GO_UNPACKED): $(GO_DOWNLOAD) $(call msg,"Unpacking Go $(GO_VERSION)") @@ -78,46 +77,62 @@ go-unpack: $(GO_UNPACKED) # Cross-compile Go package for target platform $(GO_DIR)/go/pkg/%/.built: $(GO_UNPACKED) + rm -rf gopath/pkg/$* $(call msg,"Building Go for $*") - cd $(GO_DIR)/go/src && $(FLAGS_$*) ./make.bash --no-clean >/dev/null 2>&1 - touch $@ + cd $(GO_DIR)/go/src && $(FLAGS_$*) ./make.bash --no-clean >lastbuild.log 2>&1 + touch $(GO_DIR)/go/pkg/$*/.built go-compile: $(foreach PLATFORM,$(PLATFORMS),$(GO_DIR)/go/pkg/$(PLATFORM)/.built) .PHONY: go-compile # Cross-compile final applications -out/$(RELEASE_VERSION)/%/websocketd: $(GO_DIR)/go/pkg/%/.built $(wildcard ../*.go) go-path/src/github.com/joewalnes/websocketd +out/$(RELEASE_VERSION)/%/websocketd out/$(RELEASE_VERSION)/%/websocketd.exe: $(GO_DIR)/go/pkg/%/.built $(wildcard ../*.go) go-path/src/github.com/joewalnes/websocketd $(call msg,"Compiling release for $*") rm -f $@ mkdir -p $(dir $@) - $(FLAGS_$*) $(GO_DIR)/go/bin/go get ./go-path/src/github.com/joewalnes/websocketd + go get golang.org/x/net/websocket + go test github.com/joewalnes/websocketd/libwebsocketd $(FLAGS_$*) $(GO_DIR)/go/bin/go build -ldflags "-X main.version $(RELEASE_VERSION)" -o out/$(RELEASE_VERSION)/$*/websocketd$(EXTENSION_$*) $(wildcard ../*.go) touch $@ out/$(RELEASE_VERSION)/websocketd-$(RELEASE_VERSION)-%.zip: out/$(RELEASE_VERSION)/%/websocketd $(wildcard ../*.go) go-path/src/github.com/joewalnes/websocketd rm -f $@ - zip -j $@ out/$(RELEASE_VERSION)/$*/* ../{INSTALL,README.md,LICENSE} + zip -j $@ out/$(RELEASE_VERSION)/$*/* ../{README.md,LICENSE,CHANGES} -build: $(foreach PLATFORM,$(PLATFORMS),out/$(RELEASE_VERSION)/$(PLATFORM)/websocketd) $(foreach PLATFORM,$(PLATFORMS),out/$(RELEASE_VERSION)/websocketd-$(RELEASE_VERSION)-$(PLATFORM).zip) +BINARIES = $(foreach PLATFORM,$(PLATFORMS),out/$(RELEASE_VERSION)/$(PLATFORM)/websocketd$(EXTENSION_$(PLATFORM))) +ZIPS = $(foreach PLATFORM,$(PLATFORMS),out/$(RELEASE_VERSION)/websocketd-$(RELEASE_VERSION)-$(PLATFORM).zip) +DEBS = out/$(RELEASE_VERSION)/websocketd-$(RELEASE_VERSION)_386.deb out/$(RELEASE_VERSION)/websocketd-$(RELEASE_VERSION)_amd64.deb +RPMS = out/$(RELEASE_VERSION)/websocketd.$(RELEASE_VERSION).i386.rpm out/$(RELEASE_VERSION)/websocketd.$(RELEASE_VERSION).x86_64.rpm + +binaries: $(BINARIES) +.PHONY: websocketd + +build: out/$(RELEASE_VERSION)/CHECKSUMS .PHONY: build +out/$(RELEASE_VERSION)/CHECKSUMS: $(BINARIES) $(ZIPS) $(DEBS) $(RPMS) + sha256sum $^ | sed -e 's/out\/$(RELEASE_VERSION)\///' >$@ + + BASEFPM=--description "WebSockets server that converts STDIO scripts to powerful HTML5 applications." --url http://websocketd.com/ --license MIT --vendor "websocketd team " --maintainer "abc@alexsergeyev.com" DEBFPM="" RPMFPM=--rpm-os linux -deb: out/$(RELEASE_VERSION)/websocketd-$(RELEASE_VERSION)_386.deb out/$(RELEASE_VERSION)/websocketd-$(RELEASE_VERSION)_amd64.deb +deb: $(DEBS) +.PHONY: deb -rpm: out/$(RELEASE_VERSION)/websocketd-$(RELEASE_VERSION).i386.rpm out/$(RELEASE_VERSION)/websocketd-$(RELEASE_VERSION).x86_64.rpm +rpm: $(RPMS) +.PHONY: rpm out/$(RELEASE_VERSION)/websocketd-$(RELEASE_VERSION)_386.deb: $(GO_DIR)/go/pkg/linux_386/.built out/$(RELEASE_VERSION)/linux_386/websocketd mkdir -p out/$(RELEASE_VERSION)/deb32/{usr/bin,usr/share/man/man1,usr/share/doc/websocketd-$(RELEASE_VERSION)} cp out/$(RELEASE_VERSION)/linux_386/websocketd out/$(RELEASE_VERSION)/deb32/usr/bin/ - cp ../{LICENSE,AUTHORS,README.md} out/$(RELEASE_VERSION)/deb32/usr/share/doc/websocketd-$(RELEASE_VERSION) + cp ../{LICENSE,AUTHORS,CHANGES,README.md} out/$(RELEASE_VERSION)/deb32/usr/share/doc/websocketd-$(RELEASE_VERSION) cat websocketd.man | gzip > out/$(RELEASE_VERSION)/deb32/usr/share/man/man1/websocket.1.gz fpm -f -s dir -t deb -a 386 -n websocketd -v $(RELEASE_VERSION) -C out/$(RELEASE_VERSION)/deb32/ -p out/$(RELEASE_VERSION)/websocketd-VERSION_ARCH.deb $(BASEFPM) $(DEB_FPM) usr/ rm -rf out/$(RELEASE_VERSION)/deb32/ @@ -125,36 +140,41 @@ out/$(RELEASE_VERSION)/websocketd-$(RELEASE_VERSION)_386.deb: $(GO_DIR)/go/pkg/l out/$(RELEASE_VERSION)/websocketd-$(RELEASE_VERSION)_amd64.deb: $(GO_DIR)/go/pkg/linux_amd64/.built out/$(RELEASE_VERSION)/linux_amd64/websocketd mkdir -p out/$(RELEASE_VERSION)/deb64/{usr/bin,usr/share/man/man1,usr/share/doc/websocketd-$(RELEASE_VERSION)} cp out/$(RELEASE_VERSION)/linux_amd64/websocketd out/$(RELEASE_VERSION)/deb64/usr/bin/ - cp ../{LICENSE,AUTHORS,README.md} out/$(RELEASE_VERSION)/deb64/usr/share/doc/websocketd-$(RELEASE_VERSION) + cp ../{LICENSE,AUTHORS,CHANGES,README.md} out/$(RELEASE_VERSION)/deb64/usr/share/doc/websocketd-$(RELEASE_VERSION) cat websocketd.man | gzip > out/$(RELEASE_VERSION)/deb64/usr/share/man/man1/websocket.1.gz fpm -f -s dir -t deb -a amd64 -n websocketd -v $(RELEASE_VERSION) -C out/$(RELEASE_VERSION)/deb64/ -p out/$(RELEASE_VERSION)/websocketd-VERSION_ARCH.deb $(BASEFPM) $(DEB_FPM) usr/ rm -rf out/$(RELEASE_VERSION)/deb64/ -out/$(RELEASE_VERSION)/websocketd-$(RELEASE_VERSION).x86_64.rpm: $(GO_DIR)/go/pkg/linux_amd64/.built out/$(RELEASE_VERSION)/linux_amd64/websocketd +out/$(RELEASE_VERSION)/websocketd.$(RELEASE_VERSION).x86_64.rpm: $(GO_DIR)/go/pkg/linux_amd64/.built out/$(RELEASE_VERSION)/linux_amd64/websocketd mkdir -p out/$(RELEASE_VERSION)/rpm64/{usr/bin,etc/default,usr/libexec,usr/share/man/man1,usr/share/doc/websocketd-$(RELEASE_VERSION),usr/lib/systemd/system} cp out/$(RELEASE_VERSION)/linux_amd64/websocketd out/$(RELEASE_VERSION)/rpm64/usr/bin/ - cp ../{LICENSE,AUTHORS,README.md} out/$(RELEASE_VERSION)/rpm64/usr/share/doc/websocketd-$(RELEASE_VERSION) + cp ../{LICENSE,AUTHORS,CHANGES,README.md} out/$(RELEASE_VERSION)/rpm64/usr/share/doc/websocketd-$(RELEASE_VERSION) cat websocketd.man | gzip > out/$(RELEASE_VERSION)/rpm64/usr/share/man/man1/websocket.1.gz fpm -f -s dir -t rpm -a x86_64 -n websocketd -v $(RELEASE_VERSION) -C out/$(RELEASE_VERSION)/rpm64/ -p out/$(RELEASE_VERSION)/websocketd.VERSION.ARCH.rpm $(BASEFPM) $(RPMFPM) usr/ rm -rf out/$(RELEASE_VERSION)/rpm64/ -out/$(RELEASE_VERSION)/websocketd-$(RELEASE_VERSION).i386.rpm: $(GO_DIR)/go/pkg/linux_386/.built out/$(RELEASE_VERSION)/linux_386/websocketd +out/$(RELEASE_VERSION)/websocketd.$(RELEASE_VERSION).i386.rpm: $(GO_DIR)/go/pkg/linux_386/.built out/$(RELEASE_VERSION)/linux_386/websocketd mkdir -p out/$(RELEASE_VERSION)/rpm32/{usr/bin,etc/default,usr/libexec,usr/share/man/man1,usr/share/doc/websocketd-$(RELEASE_VERSION),usr/lib/systemd/system} cp out/$(RELEASE_VERSION)/linux_386/websocketd out/$(RELEASE_VERSION)/rpm32/usr/bin/ - cp ../{LICENSE,AUTHORS,README.md} out/$(RELEASE_VERSION)/rpm32/usr/share/doc/websocketd-$(RELEASE_VERSION) + cp ../{LICENSE,AUTHORS,CHANGES,README.md} out/$(RELEASE_VERSION)/rpm32/usr/share/doc/websocketd-$(RELEASE_VERSION) cat websocketd.man | gzip > out/$(RELEASE_VERSION)/rpm32/usr/share/man/man1/websocket.1.gz fpm -f -s dir -t rpm -a i386 -n websocketd -v $(RELEASE_VERSION) -C out/$(RELEASE_VERSION)/rpm32/ -p out/$(RELEASE_VERSION)/websocketd.VERSION.ARCH.rpm $(BASEFPM) $(RPMFPM) usr/ rm -rf out/$(RELEASE_VERSION)/rpm32/ - - # Clean up -clean: - rm -rf out go-path -.PHONY: clean +clobber: clean +.PHONY: clobber +clean: clean-go clean-out +.PHONY: clean -clobber: clean +clean-go: rm -rf go-local -.PHONY: clobber + rm -rf go-path +.PHONY: clean-go + +clean-out: + rm -rf out +.PHONY: clean-out + diff --git a/release/README b/release/README index d28867a4..a3b359b3 100644 --- a/release/README +++ b/release/README @@ -1,39 +1,52 @@ Release scripts for websocketd ============================== -Perform a fully automated repeatable release of websocketd. Including: +Perform a fully automated repeatable release of websocketd. -* Downloading the correct version of Go -* Cross-compiling Go for all required platforms -* Inferring the next websocketd release version -* Cross-compiling websocketd for all required platforms -* Uploading releases to http://download.websocketd.com/ -* Git tagging the version +This is three-stage process in normal release cycle that's performed by +repository maintainers. -The release process has been built and test on Ubuntu. +* Tag +* Build +* Release -Pre-reqs: +Those that do not have permissions to push tags could still use this build +chain to build their own customized versions or packages. - sudo apt-get install libc6-dev-i386 s3cmd git mercurial - s3cmd --configure # Setup Amazon S3 credentials +## Step 1: Tag -The actual Go release will be downloaded and cross-compiled. All compilation -occurs in an isolated environment to ensure there are no conflicts with any -system install Go. The first build will be really slow (cross compiling Go core), -but subsequent builds are incremental. +Annotated tags require for release: -To build the packages for all platforms: + git tag -a vx.x.x - make build +To see currently tagged version run tag with -l option. -To perform a release to http://download.websocketd.com/ -(version number will be automatically determined based on last git tag): +## Step 2: Build +release/Makefile contains all required to download pre-verified for build release of Go and cross-compile +websocketd for all platforms that we release for. + + cd release make -To clean up: +Is generally recommended but other build options are available: + +* go-compile: build cross-platform golang pakages +* binaries: only create websocketd binaries, do not generate zip distributions +* deb, rpm: only create particular kind of packages +* clean-go: remove build files for go +* clean-out: remove built binaries, zip and linux packages +* clean: remove everything (go and release files) + +Building requires to have gcc and other build tools installed. Building rpm/deb files would fail without fpm ("gem install fpm" itself requires ruby devel tools). + +## Step 3: Release + +In order to make release official following steps required: + + # push tags (assuming joewalnes repo is origin): + go push --tags origin master:master - make clean +Upload files to github release (to be automated). Use these instructions for now: https://github.com/blog/1547-release-your-software --Joe Walnes