Skip to content

Commit

Permalink
Merge pull request #322 from camathieu/master
Browse files Browse the repository at this point in the history
1.3
  • Loading branch information
camathieu committed Sep 29, 2020
2 parents 8b2386d + 458651a commit 2d15cbe
Show file tree
Hide file tree
Showing 42 changed files with 968 additions and 541 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ documentation
release
releases
server/plikd
server/common/version.go
testing
webapp/node_modules
webapp/bower_components
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ webapp/dist
clients
client/client
servers
server/common/version.go
release
releases
debs
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ language: go
sudo: required

go:
- 1.14
- 1.15.2

go_import_path: github.com/root-gg/plik

Expand Down
10 changes: 9 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,16 @@ WORKDIR /go/src/github.com/root-gg/plik
# Add the source code ( see .dockerignore )
ADD . .

# Build everything
# Build clients ( all arch )
RUN make clients

# Set server target arch
ARG GOOS=""
ARG GOARCH=""
ENV GOOS=${GOOS}
ENV GOARCH=${GOARCH}

# Build server
RUN make server

##################################################################################
Expand Down
61 changes: 36 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
SHELL = /bin/bash

RELEASE_VERSION=$(shell version/version.sh)
RELEASE_DIR="release/plik-$(RELEASE_VERSION)"
RELEASE_TARGETS=darwin-386 darwin-amd64 freebsd-386 \
RELEASE_VERSION = $(shell version/version.sh)
RELEASE_DIR = "release/plik-$(RELEASE_VERSION)"
RELEASE_TARGETS = darwin-amd64 freebsd-386 \
freebsd-amd64 linux-386 linux-amd64 linux-arm openbsd-386 \
openbsd-amd64 windows-amd64 windows-386

GOHOSTOS=$(shell go env GOHOSTOS)
GOHOSTARCH=$(shell go env GOHOSTARCH)
GOHOSTOS = $(if $(GOOS),$(GOOS),$(shell go env GOHOSTOS))
GOHOSTARCH = $(if $(GOARCH),$(GOARCH),$(shell go env GOHOSTARCH))

DEBROOT_SERVER=debs/server
DEBROOT_CLIENT=debs/client
DEBROOT_SERVER = debs/server
DEBROOT_CLIENT = debs/client

BUILD_INFO = $(shell server/gen_build_info.sh $(RELEASE_VERSION) base64)
BUILD_FLAG = -ldflags="-X github.com/root-gg/plik/server/common.buildInfoString=$(BUILD_INFO)"

GO_BUILD = go build $(BUILD_FLAG)
GO_TEST = GORACE="halt_on_error=1" go test $(BUILD_FLAG) -race -cover -p 1

race_detector = GORACE="halt_on_error=1" go build -race
ifdef ENABLE_RACE_DETECTOR
build = $(race_detector)
else
build = go build
GO_BUILD := GORACE="halt_on_error=1" $(GO_BUILD) -race
endif
test: build = $(race_detector)

all: clean clean-frontend frontend clients server

Expand All @@ -34,15 +36,15 @@ frontend:
# Build plik server for the current architecture
###
server:
@server/gen_build_info.sh $(RELEASE_VERSION)
@server/gen_build_info.sh $(RELEASE_VERSION) info
@echo "Building Plik server"
@cd server && $(build) -o plikd ./
@cd server && $(GO_BUILD) -o plikd

###
# Build plik server for all architectures
###
servers: frontend
@server/gen_build_info.sh $(RELEASE_VERSION)
@server/gen_build_info.sh $(RELEASE_VERSION) info
@cd server && for target in $(RELEASE_TARGETS) ; do \
SERVER_DIR=../servers/$$target; \
SERVER_PATH=$$SERVER_DIR/plikd; \
Expand All @@ -52,23 +54,23 @@ servers: frontend
if [ $$GOOS = "windows" ] ; then SERVER_PATH=$$SERVER_DIR/plikd.exe ; fi ; \
if [ -e $$SERVER_PATH ] ; then continue ; fi ; \
echo "Building Plik server for $$target to $$SERVER_PATH"; \
$(build) -o $$SERVER_PATH ; \
$(GO_BUILD) -o $$SERVER_PATH ; \
done

###
# Build plik client for the current architecture
###
client:
@server/gen_build_info.sh $(RELEASE_VERSION)
@server/gen_build_info.sh $(RELEASE_VERSION) info
@echo "Building Plik client"
@cd client && $(build) -o plik ./
@cd client && $(GO_BUILD) -o plik ./


###
# Build plik client for all architectures
###
clients:
@server/gen_build_info.sh $(RELEASE_VERSION)
@server/gen_build_info.sh $(RELEASE_VERSION) info
@cd client && for target in $(RELEASE_TARGETS) ; do \
CLIENT_DIR=../clients/$$target; \
CLIENT_PATH=$$CLIENT_DIR/plik; \
Expand All @@ -79,7 +81,7 @@ clients:
if [ $$GOOS = "windows" ] ; then CLIENT_PATH=$$CLIENT_DIR/plik.exe ; fi ; \
if [ -e $$CLIENT_PATH ] ; then continue ; fi ; \
echo "Building Plik client for $$target to $$CLIENT_PATH"; \
$(build) -o $$CLIENT_PATH ; \
$(GO_BUILD) -o $$CLIENT_PATH ; \
md5sum $$CLIENT_PATH | awk '{print $$1}' > $$CLIENT_MD5; \
done
@mkdir -p clients/bash && cp client/plik.sh clients/bash
Expand Down Expand Up @@ -185,7 +187,7 @@ releases: release-template servers
# Generate build info
###
build-info:
@server/gen_build_info.sh $(RELEASE_VERSION)
@server/gen_build_info.sh $(RELEASE_VERSION) info

###
# Run linters
Expand All @@ -210,8 +212,7 @@ fmt:
###
test:
@if curl -s 127.0.0.1:8080 > /dev/null ; then echo "Plik server probably already running" && exit 1 ; fi
@server/gen_build_info.sh $(RELEASE_VERSION)
@GORACE="halt_on_error=1" go test -race -cover -p 1 ./... 2>&1 | grep -v "no test files"; test $${PIPESTATUS[0]} -eq 0
@$(GO_TEST) ./... 2>&1 | grep -v "no test files"; test $${PIPESTATUS[0]} -eq 0
@echo "cli client integration tests :" && cd client && ./test.sh

###
Expand All @@ -224,13 +225,23 @@ test-backends:
# Build docker
###
docker:
docker build -t rootgg/plik:$(RELEASE_VERSION) .
docker build --build-arg "GOOS=$$GOOS" --build-arg "GOARCH=$$GOARCH" -t rootgg/plik-$(GOHOSTOS)-$(GOHOSTARCH):$(RELEASE_VERSION) .

###
# Build dockers
###
dockers:
@for target in $(RELEASE_TARGETS) ; do \
GOOS=`echo $$target | cut -d "-" -f 1`; \
GOARCH=`echo $$target | cut -d "-" -f 2`; \
docker build --build-arg "GOOS=$$GOOS" --build-arg "GOARCH=$$GOARCH" -t rootgg/plik-$$target:$(RELEASE_VERSION) . ; \
done


###
# Remove server build files
###
clean:
@rm -rf server/common/version.go
@rm -rf server/plikd
@rm -rf client/plik
@rm -rf clients
Expand Down
23 changes: 18 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ Plik is a scalable & friendly temporary file upload system ( wetransfer like ) i
- [Filelink for Plik](https://gitlab.com/joendres/filelink-plik) : Thunderbird Addon to upload attachments to Plik

### Version
1.3-RC1
1.3

### Installation

##### From release
To run plik, it's very simple :
```sh
$ wget https://github.com/root-gg/plik/releases/download/1.3-RC1/plik-1.3-RC1-linux-64bits.tar.gz
$ tar xzvf plik-1.3-RC1-linux-64bits.tar.gz
$ cd plik-1.3-RC1/server
$ wget https://github.com/root-gg/plik/releases/download/1.3/plik-1.3-linux-64bits.tar.gz
$ tar xzvf plik-1.3-linux-64bits.tar.gz
$ cd plik-1.3/server
$ ./plikd
```
Et voilà ! You now have a fully functional instance of Plik running on http://127.0.0.1:8080.
Expand All @@ -63,7 +63,6 @@ To compile plik from sources, you'll need golang and npm installed on your syste
First, get the project and libs via go get :
```sh
$ go get github.com/root-gg/plik/server
go/src/github.com/root-gg/plik/server/handlers/misc.go:51: undefined: common.GetBuildInfo <== ignore this warning
$ cd $GOPATH/src/github.com/root-gg/plik/
```

Expand Down Expand Up @@ -350,3 +349,17 @@ Please be sure to also run/update the test suite :
make test
make test-backends
```

* Cross compilation

To target a specific architecture :
```
GOOS=linux GOARCH=arm make server
GOOS=linux GOARCH=arm make client
GOOS=linux GOARCH=arm make docker
```

The `make releases` target build a release package for each architecture specified in Makefile
The `make dockers` target build a docker image for each architecture specified in Makefile
The `make clients` target build the plik clients for each architecture specified in Makefile
The `make servers` target build the plik servers for each architecture specified in Makefile
29 changes: 29 additions & 0 deletions changelog/1.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Plik 1.3

Hi, today we're releasing Plik 1.3 !

Here is the changelog :

New
- Add --info to cli client to display server configuration

Fixed
- Fix common.AskConfirmation handling of no input
- Fix missing unit in frontend menu when default TTL equals 86400s
- Fix missing downloadDomain in bash script if not given in plikd.cfg
- Fix missing focus and submit in login form
- Fix bypass ~/.plikrc creation if --server cli param is provided

Removed
- darwin-386 target ( https://github.com/golang/go/issues/37610 )

Misc
- Improved cross-compilation in Makefile
- Cross-compiled docker images
- Pass build info using ldflags
- EnhancedWebSecurity configuration parameter removes sensible information form /version API endpoint

Binaries are compiled using Go v1.15.2

Faithfully,
The Plik team
Loading

0 comments on commit 2d15cbe

Please sign in to comment.