From 7cab4b087ab2dc8d4ffbfb82fcfb56a188db2d26 Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 24 Jun 2019 17:04:09 +0200 Subject: [PATCH 01/14] docker: Installing gcc and libc-dev for having a matching gcc and linker in the image. (#284) --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1a0652e..dab954f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ COPY . /go/src/github.com/tus/tusd/ WORKDIR /go/src/github.com/tus/tusd RUN apk add --no-cache \ - git \ + git gcc libc-dev \ && go get -d -v ./... \ && version="$(git tag -l --points-at HEAD)" \ && commit=$(git log --format="%H" -n 1) \ From 9c0d753f7dddedc1444178171add376cea91ec30 Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 24 Jun 2019 19:38:56 +0200 Subject: [PATCH 02/14] docker: Updated docker from alpine 3.8 to 3.9 (#286) --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index dab954f..ca0393b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,7 @@ RUN apk add --no-cache \ && apk del git # start a new stage that copies in the binary built in the previous stage -FROM alpine:3.8 +FROM alpine:3.9 COPY --from=builder /go/bin/tusd /usr/local/bin/tusd From 30811b6579c553557517ffe13d6fe7b4739730f0 Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 12 Jul 2019 16:34:43 +0200 Subject: [PATCH 03/14] docker: Added script to generate official-images/library/tusd file. (#289) * Added script to generate official-images/library/tusd file. * Moved script to .scripts. --- .scripts/generate-docker-library.sh | 54 +++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100755 .scripts/generate-docker-library.sh diff --git a/.scripts/generate-docker-library.sh b/.scripts/generate-docker-library.sh new file mode 100755 index 0000000..58a77cd --- /dev/null +++ b/.scripts/generate-docker-library.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +# +# official-images tag file generator +# +# usage: ./generate-docker-library.sh > [official-images-folder]/library/tusd +# + +cat <<-EOH +# This file is generated via https://github.com/tus/tusd/blob/master/generate-docker-library.sh +Maintainers: tus.io (@tus), Thomas A. Hirsch (@thirsch) +GitRepo: https://github.com/tus/tusd.git +EOH + +skipBeforeVersion="0.13.0" +previousVersions=(); + +function printVersion() { + version=( ${1//./ } ) + majorMinor="${version[0]}.${version[1]}" + + match=$(echo "${previousVersions[@]:0}" | grep -oE "\s?$majorMinor\s?$") + previousVersionCount=${#previousVersions[@]} + + # add the majorMinor-Version only, if it is not present yet. + if [[ ! -z $match ]] ; then + versionString=$1 + else + versionString="$1 $majorMinor" + previousVersions+=($majorMinor) + fi + + # as the versions are sorted, the very first version gets latest. + if [[ ${previousVersionCount} -eq 0 ]]; then + versionString="$versionString, latest" + fi + + cat <<-EOE + +Tags: $versionString +GitCommit: $2 + EOE +} + +for version in `git tag -l --sort=-v:refname | grep "^[0-9.]\+$"`; do + commit=`git rev-parse ${version}` + + # no official release before this version + if [[ ${version} = ${skipBeforeVersion} ]] ; then + exit 0 + fi + + printVersion "${version}" ${commit} +done \ No newline at end of file From 85a26150a3a027a339572e1f30bbf104d3955964 Mon Sep 17 00:00:00 2001 From: Marius Date: Sun, 21 Jul 2019 22:40:18 +0200 Subject: [PATCH 04/14] s3store: Filter newlines out of metadata --- config.go | 2 +- s3store/s3store.go | 4 +++- s3store/s3store_test.go | 16 ++++++++-------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/config.go b/config.go index e72c6a8..5a7326a 100644 --- a/config.go +++ b/config.go @@ -47,7 +47,7 @@ type Config struct { func (config *Config) validate() error { if config.Logger == nil { - config.Logger = log.New(os.Stdout, "[tusd] ", log.Ldate | log.Ltime) + config.Logger = log.New(os.Stdout, "[tusd] ", log.Ldate|log.Ltime) } base := config.BasePath diff --git a/s3store/s3store.go b/s3store/s3store.go index a6d2c94..8f9d440 100644 --- a/s3store/s3store.go +++ b/s3store/s3store.go @@ -90,7 +90,9 @@ import ( // This regular expression matches every character which is not defined in the // ASCII tables which range from 00 to 7F, inclusive. -var nonASCIIRegexp = regexp.MustCompile(`([^\x00-\x7F])`) +// It also matches the \r and \n characters which are not allowed in values +// for HTTP headers. +var nonASCIIRegexp = regexp.MustCompile(`([^\x00-\x7F]|[\r\n])`) // See the tusd.DataStore interface for documentation about the different // methods. diff --git a/s3store/s3store_test.go b/s3store/s3store_test.go index 463794a..070a079 100644 --- a/s3store/s3store_test.go +++ b/s3store/s3store_test.go @@ -37,7 +37,7 @@ func TestNewUpload(t *testing.T) { assert.Equal(s3obj, store.Service) s1 := "hello" - s2 := "men?" + s2 := "men???hi" gomock.InOrder( s3obj.EXPECT().CreateMultipartUpload(&s3.CreateMultipartUploadInput{ @@ -53,8 +53,8 @@ func TestNewUpload(t *testing.T) { s3obj.EXPECT().PutObject(&s3.PutObjectInput{ Bucket: aws.String("bucket"), Key: aws.String("uploadId.info"), - Body: bytes.NewReader([]byte(`{"ID":"uploadId+multipartId","Size":500,"SizeIsDeferred":false,"Offset":0,"MetaData":{"bar":"menü","foo":"hello"},"IsPartial":false,"IsFinal":false,"PartialUploads":null}`)), - ContentLength: aws.Int64(int64(171)), + Body: bytes.NewReader([]byte(`{"ID":"uploadId+multipartId","Size":500,"SizeIsDeferred":false,"Offset":0,"MetaData":{"bar":"menü\r\nhi","foo":"hello"},"IsPartial":false,"IsFinal":false,"PartialUploads":null}`)), + ContentLength: aws.Int64(int64(177)), }), ) @@ -63,7 +63,7 @@ func TestNewUpload(t *testing.T) { Size: 500, MetaData: map[string]string{ "foo": "hello", - "bar": "menü", + "bar": "menü\r\nhi", }, } @@ -243,8 +243,8 @@ func TestGetInfoWithIncompletePart(t *testing.T) { Bucket: aws.String("bucket"), Key: aws.String("uploadId.part"), }).Return(&s3.GetObjectOutput{ - ContentLength: aws.Int64(10), - Body: ioutil.NopCloser(bytes.NewReader([]byte("0123456789"))), + ContentLength: aws.Int64(10), + Body: ioutil.NopCloser(bytes.NewReader([]byte("0123456789"))), }, nil), ) @@ -730,8 +730,8 @@ func TestWriteChunkPrependsIncompletePart(t *testing.T) { Bucket: aws.String("bucket"), Key: aws.String("uploadId.part"), }).Return(&s3.GetObjectOutput{ - ContentLength: aws.Int64(3), - Body: ioutil.NopCloser(bytes.NewReader([]byte("123"))), + ContentLength: aws.Int64(3), + Body: ioutil.NopCloser(bytes.NewReader([]byte("123"))), }, nil), s3obj.EXPECT().ListParts(&s3.ListPartsInput{ Bucket: aws.String("bucket"), From 8242b4dfb57e8372875e9c7f770ed9eeeabf4333 Mon Sep 17 00:00:00 2001 From: Marius Date: Sun, 21 Jul 2019 22:40:41 +0200 Subject: [PATCH 05/14] core: Remove TCP details from connection reset message --- unrouted_handler.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/unrouted_handler.go b/unrouted_handler.go index 1c39841..edd25f9 100644 --- a/unrouted_handler.go +++ b/unrouted_handler.go @@ -815,6 +815,13 @@ func (handler *UnroutedHandler) sendError(w http.ResponseWriter, r *http.Request err = errors.New("read tcp: i/o timeout") } + // Errors for connnection resets also contain TCP details, we don't need, e.g: + // read tcp 127.0.0.1:1080->127.0.0.1:10023: read: connection reset by peer + // Therefore, we also trim those down. + if strings.HasSuffix(err.Error(), "read: connection reset by peer") { + err = errors.New("read tcp: connection reset by peer") + } + statusErr, ok := err.(HTTPError) if !ok { statusErr = NewHTTPError(err, http.StatusInternalServerError) From 4f4da61fea7ba42b6bb16c844e08df923eb94618 Mon Sep 17 00:00:00 2001 From: Marius Date: Sun, 21 Jul 2019 23:05:59 +0200 Subject: [PATCH 06/14] Install Windows package for cross-compiling Should fix https://travis-ci.org/tus/tusd/jobs/561804467#L682 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index f1c94f6..84dce8a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,6 +33,7 @@ before_deploy: - gcloud --quiet components update - gcloud --quiet components update kubectl - curl https://raw.githubusercontent.com/kubernetes/helm/d87ce93e1e287ece84d940dbfe09b0de493d9953/scripts/get | bash +- go get golang.org/x/sys/windows deploy: - provider: releases api_key: From 1089558ac36266aee533bbf3b152087467f24926 Mon Sep 17 00:00:00 2001 From: Marius Date: Sun, 21 Jul 2019 23:21:43 +0200 Subject: [PATCH 07/14] Install Windows package before compilation --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 84dce8a..b79dc63 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,6 +26,7 @@ install: script: - ./.scripts/test_all.sh before_deploy: +- go get golang.org/x/sys/windows - if [[ "$TRAVIS_TAG" != "" ]]; then ./.scripts/build_all.sh; fi - if [ ! -d "$HOME/google-cloud-sdk/bin" ]; then rm -rf $HOME/google-cloud-sdk; curl https://sdk.cloud.google.com | bash; fi - source /home/travis/google-cloud-sdk/path.bash.inc @@ -33,7 +34,6 @@ before_deploy: - gcloud --quiet components update - gcloud --quiet components update kubectl - curl https://raw.githubusercontent.com/kubernetes/helm/d87ce93e1e287ece84d940dbfe09b0de493d9953/scripts/get | bash -- go get golang.org/x/sys/windows deploy: - provider: releases api_key: From af51b797ab1d666641cea8379ab311570ffad2a6 Mon Sep 17 00:00:00 2001 From: Marius Date: Sun, 21 Jul 2019 23:38:53 +0200 Subject: [PATCH 08/14] Disable Windows compilations for now --- .scripts/build_all.sh | 8 ++++---- .travis.yml | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.scripts/build_all.sh b/.scripts/build_all.sh index e51f0cb..04f885f 100755 --- a/.scripts/build_all.sh +++ b/.scripts/build_all.sh @@ -11,14 +11,14 @@ compile linux amd64 compile linux arm compile darwin 386 compile darwin amd64 -compile windows 386 .exe -compile windows amd64 .exe +#compile windows 386 .exe +#compile windows amd64 .exe maketar linux 386 maketar linux amd64 maketar linux arm makezip darwin 386 makezip darwin amd64 -makezip windows 386 .exe -makezip windows amd64 .exe +#makezip windows 386 .exe +#makezip windows amd64 .exe makedep amd64 diff --git a/.travis.yml b/.travis.yml index b79dc63..f1c94f6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,7 +26,6 @@ install: script: - ./.scripts/test_all.sh before_deploy: -- go get golang.org/x/sys/windows - if [[ "$TRAVIS_TAG" != "" ]]; then ./.scripts/build_all.sh; fi - if [ ! -d "$HOME/google-cloud-sdk/bin" ]; then rm -rf $HOME/google-cloud-sdk; curl https://sdk.cloud.google.com | bash; fi - source /home/travis/google-cloud-sdk/path.bash.inc From b77d9aabf94bbfd1b1becc38bcb544ec28e19886 Mon Sep 17 00:00:00 2001 From: Marius Date: Fri, 26 Jul 2019 12:43:43 +0200 Subject: [PATCH 09/14] misc: Correct usage of links in FAQ --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 47d0c1c..3240056 100644 --- a/README.md +++ b/README.md @@ -267,11 +267,11 @@ Yes, this is made possible by the [hook system](/docs/hooks.md) inside the tusd ### Can I run tusd inside a VM/Vagrant/VirtualBox? -Yes, you can absolutely do so without any modifications. However, there is one known problem: If you are using tusd inside VirtualBox (the default provider for Vagrant) and are storing the files inside a shared/synced folder, you might get TemporaryErrors (Lockfile created, but doesn't exist) when trying to upload. This happens because shared folders do not support symbolic links which are necessary for tusd. Please use another non-shared folder for storing files (see https://github.com/tus/tusd/issues/201). +Yes, you can absolutely do so without any modifications. However, there is one known problem: If you are using tusd inside VirtualBox (the default provider for Vagrant) and are storing the files inside a shared/synced folder, you might get TemporaryErrors (Lockfile created, but doesn't exist) when trying to upload. This happens because shared folders do not support hard links which are necessary for tusd. Please use another non-shared folder for storing files (see https://github.com/tus/tusd/issues/201). ### I am getting TemporaryErrors (Lockfile created, but doesn't exist)! What can I do? -This error can occur when you are running tusd's disk storage on a file system which does not support symbolic links. These symbolic links are used to create lock files for ensuring that an upload's data is consistent. For example, this problem can happen when running tusd inside VirtualBox (see the answer above for more details) or when using file system interfaces to cloud storage providers (see https://github.com/tus/tusd/issues/257). We recommend you to ensure that your file system supports symbolic links, use a different file system, or use one of tusd's cloud storage abilities. If the problem still persists, please open a bug report. +This error can occur when you are running tusd's disk storage on a file system which does not support hard links. These hard links are used to create lock files for ensuring that an upload's data is consistent. For example, this problem can happen when running tusd inside VirtualBox (see the answer above for more details) or when using file system interfaces to cloud storage providers (see https://github.com/tus/tusd/issues/257). We recommend you to ensure that your file system supports hard links, use a different file system, or use one of tusd's cloud storage abilities. If the problem still persists, please open a bug report. ### How can I prevent users from downloading the uploaded files? From 4a0313550debdebefbf1579dc0899aa88d816fdd Mon Sep 17 00:00:00 2001 From: Marius Date: Mon, 12 Aug 2019 11:35:07 +0200 Subject: [PATCH 10/14] Disable SSL redirect for debugging --- .infra/kube/tusd-kube.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.infra/kube/tusd-kube.yaml b/.infra/kube/tusd-kube.yaml index cf0d648..35cf99f 100644 --- a/.infra/kube/tusd-kube.yaml +++ b/.infra/kube/tusd-kube.yaml @@ -75,6 +75,7 @@ metadata: nginx.ingress.kubernetes.io/proxy-read-timeout: "300" nginx.ingress.kubernetes.io/proxy-request-buffering: "off" nginx.ingress.kubernetes.io/proxy-send-timeout: "300" + nginx.ingress.kubernetes.io/ssl-redirect: "false" spec: tls: - hosts: From 31d31ba3b95a09a4cb98d42e22d4cd749deddde3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Contreras=20Casta=C3=B1eda?= Date: Mon, 12 Aug 2019 04:05:49 -0700 Subject: [PATCH 11/14] s3store: Properly remove temporary files (#299) --- s3store/s3store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/s3store/s3store.go b/s3store/s3store.go index 8f9d440..e600237 100644 --- a/s3store/s3store.go +++ b/s3store/s3store.go @@ -259,8 +259,8 @@ func (store S3Store) WriteChunk(id string, offset int64, src io.Reader) (int64, return 0, err } if incompletePartFile != nil { - defer incompletePartFile.Close() defer os.Remove(incompletePartFile.Name()) + defer incompletePartFile.Close() if err := store.deleteIncompletePartForUpload(uploadId); err != nil { return 0, err From 102715e2d1112b872c333131c7f3c2fb901bb0e7 Mon Sep 17 00:00:00 2001 From: kiloreux Date: Tue, 13 Aug 2019 09:50:18 +0100 Subject: [PATCH 12/14] misc: Change cloud provider for master.tus.io (#300) * Change branch and change deployment method * Fix DA DOCKER FIIIIILE * Fix docker * Maybe just update deployment ? * Switch back to base64 * Remove useless lines and replace it by stable installation * Don't use /home/kiloreux * Added kubeconfig again * Replicate stuff * Final fixes * Avoid contacting server * remove quotes * Try again * Trigger * Use master --- .infra/kube/tusd-kube.yaml | 42 ++----------------- .scripts/{deploy_gcloud.sh => deploy_kube.sh} | 27 +++++------- .travis.yml | 8 +--- Dockerfile | 2 +- 4 files changed, 17 insertions(+), 62 deletions(-) rename .scripts/{deploy_gcloud.sh => deploy_kube.sh} (53%) diff --git a/.infra/kube/tusd-kube.yaml b/.infra/kube/tusd-kube.yaml index 35cf99f..f2d43cb 100644 --- a/.infra/kube/tusd-kube.yaml +++ b/.infra/kube/tusd-kube.yaml @@ -24,27 +24,15 @@ spec: name: tusd resources: limits: - memory: "2Gi" - # requests: - # memory: "1Gi" + memory: "1Gi" + requests: + memory: "1Gi" ports: - name: tusd-web containerPort: 8080 envFrom: - - configMapRef: - name: tusd-env - secretRef: - name: tusd-s3 - securityContext: - runAsUser: 0 - fsGroup: 0 - volumeMounts: - - name: tusd-account - mountPath: /gcs - volumes: - - name: tusd-account - secret: - secretName: gcs-account + name: tusd-env --- apiVersion: v1 kind: Service @@ -99,25 +87,3 @@ spec: backend: serviceName: tusd servicePort: 80 ---- -apiVersion: autoscaling/v1 -kind: HorizontalPodAutoscaler -metadata: - name: tusd - namespace: tus -spec: - scaleTargetRef: - apiVersion: apps/v1beta1 - kind: Deployment - name: tusd - minReplicas: 1 - maxReplicas: 5 - metrics: - - type: Resource - resource: - name: cpu - targetAverageUtilization: 80 - - type: Resource - resource: - name: memory - targetAverageValue: 1800Mi diff --git a/.scripts/deploy_gcloud.sh b/.scripts/deploy_kube.sh similarity index 53% rename from .scripts/deploy_gcloud.sh rename to .scripts/deploy_kube.sh index 612934b..abd52d6 100755 --- a/.scripts/deploy_gcloud.sh +++ b/.scripts/deploy_kube.sh @@ -8,30 +8,25 @@ set -o nounset __dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" __root="$(cd "$(dirname "${__dir}")" && pwd)" - -echo "Storing ca.crt inside HOME" -echo $CA_CRT | base64 --decode -i > ${HOME}/ca.crt -echo "ca.crt is saved" +curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl +chmod +x ./kubectl +sudo mv ./kubectl /usr/local/bin/kubectl #Store the new image in docker hub docker build --quiet -t tusproject/tusd:latest -t tusproject/tusd:$TRAVIS_COMMIT ${__root}; -docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"; +docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"; docker push tusproject/tusd:$TRAVIS_COMMIT; docker push tusproject/tusd:latest; - - -gcloud config set container/use_client_certificate True -export CLOUDSDK_CONTAINER_USE_CLIENT_CERTIFICATE=True - -kubectl config set-cluster transloadit-gke-cluster --embed-certs=true --server=${CLUSTER_ENDPOINT} --certificate-authority=${HOME}/ca.crt -kubectl config set-credentials travis --token=$SA_TOKEN -kubectl config set-context travis --cluster=$CLUSTER_NAME --user=travis --namespace=tus -kubectl config use-context travis +echo "Create directory..." +mkdir ${HOME}/.kube +echo "Writing KUBECONFIG to file..." +echo $KUBECONFIGVAR | python -m base64 -d > ${HOME}/.kube/config +echo "KUBECONFIG file written" sleep 10s # This cost me some precious debugging time. -kubectl apply --validate=false -f "${__root}/.infra/kube/tusd-kube.yaml" +kubectl apply -f "${__root}/.infra/kube/tusd-kube.yaml" kubectl set image deployment/tusd --namespace=tus tusd=docker.io/tusproject/tusd:$TRAVIS_COMMIT @@ -43,7 +38,7 @@ kubectl get deployment --namespace=tus function cleanup { printf "Cleaning up...\n" - rm -f ${HOME}/ca.crt + rm -f ${HOME}/.kube/config printf "Cleaning done." } diff --git a/.travis.yml b/.travis.yml index f1c94f6..a7b4f0c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,12 +27,6 @@ script: - ./.scripts/test_all.sh before_deploy: - if [[ "$TRAVIS_TAG" != "" ]]; then ./.scripts/build_all.sh; fi -- if [ ! -d "$HOME/google-cloud-sdk/bin" ]; then rm -rf $HOME/google-cloud-sdk; curl https://sdk.cloud.google.com | bash; fi -- source /home/travis/google-cloud-sdk/path.bash.inc -- gcloud --quiet version -- gcloud --quiet components update -- gcloud --quiet components update kubectl -- curl https://raw.githubusercontent.com/kubernetes/helm/d87ce93e1e287ece84d940dbfe09b0de493d9953/scripts/get | bash deploy: - provider: releases api_key: @@ -45,7 +39,7 @@ deploy: go: 1.12 repo: tus/tusd - provider: script - script: .scripts/deploy_gcloud.sh + script: .scripts/deploy_kube.sh on: branch: master go: 1.12 diff --git a/Dockerfile b/Dockerfile index ca0393b..1af9f27 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,7 +22,7 @@ FROM alpine:3.9 COPY --from=builder /go/bin/tusd /usr/local/bin/tusd -RUN apk add --no-cache ca-certificates jq \ +RUN apk add --no-cache ca-certificates jq gcc \ && addgroup -g 1000 tusd \ && adduser -u 1000 -G tusd -s /bin/sh -D tusd \ && mkdir -p /srv/tusd-hooks \ From 571bc4df7590d5bf761db6b636bf53b01d95a27a Mon Sep 17 00:00:00 2001 From: Marius Date: Tue, 13 Aug 2019 10:51:03 +0200 Subject: [PATCH 13/14] cli: Add flag to reduce verbosity of output --- cmd/tusd/cli/flags.go | 2 ++ cmd/tusd/cli/hooks.go | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/tusd/cli/flags.go b/cmd/tusd/cli/flags.go index 3aa1e00..e39ddbd 100644 --- a/cmd/tusd/cli/flags.go +++ b/cmd/tusd/cli/flags.go @@ -30,6 +30,7 @@ var Flags struct { ExposeMetrics bool MetricsPath string BehindProxy bool + VerboseOutput bool FileHooksInstalled bool HttpHooksInstalled bool @@ -59,6 +60,7 @@ func ParseFlags() { flag.BoolVar(&Flags.ExposeMetrics, "expose-metrics", true, "Expose metrics about tusd usage") flag.StringVar(&Flags.MetricsPath, "metrics-path", "/metrics", "Path under which the metrics endpoint will be accessible") flag.BoolVar(&Flags.BehindProxy, "behind-proxy", false, "Respect X-Forwarded-* and similar headers which may be set by proxies") + flag.BoolVar(&Flags.VerboseOutput, "verbose", true, "Enable verbose logging output") flag.Parse() diff --git a/cmd/tusd/cli/hooks.go b/cmd/tusd/cli/hooks.go index aadbd79..6c36651 100644 --- a/cmd/tusd/cli/hooks.go +++ b/cmd/tusd/cli/hooks.go @@ -103,14 +103,16 @@ func invokeHookSync(typ hooks.HookType, info tusd.FileInfo, captureOutput bool) } name := string(typ) - logEv(stdout, "HookInvocationStart", "type", name, "id", info.ID) + if Flags.VerboseOutput { + logEv(stdout, "HookInvocationStart", "type", name, "id", info.ID) + } output, returnCode, err := hookHandler.InvokeHook(typ, info, captureOutput) if err != nil { logEv(stderr, "HookInvocationError", "type", string(typ), "id", info.ID, "error", err.Error()) MetricsHookErrorsTotal.WithLabelValues(string(typ)).Add(1) - } else { + } else if Flags.VerboseOutput { logEv(stdout, "HookInvocationFinish", "type", string(typ), "id", info.ID) } From 34e32999fb899f8181cf62ab12bd72699ef55419 Mon Sep 17 00:00:00 2001 From: kiloreux Date: Wed, 14 Aug 2019 13:33:36 +0100 Subject: [PATCH 14/14] Setting ssl-redirect to true --- .infra/kube/tusd-kube.yaml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.infra/kube/tusd-kube.yaml b/.infra/kube/tusd-kube.yaml index f2d43cb..f01c763 100644 --- a/.infra/kube/tusd-kube.yaml +++ b/.infra/kube/tusd-kube.yaml @@ -10,13 +10,6 @@ spec: labels: app: tusd spec: - affinity: - nodeAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - nodeSelectorTerms: - - matchExpressions: - - key: cloud.google.com/gke-preemptible - operator: DoesNotExist containers: - image: docker.io/tusproject/tusd:latest imagePullPolicy: Always @@ -63,7 +56,7 @@ metadata: nginx.ingress.kubernetes.io/proxy-read-timeout: "300" nginx.ingress.kubernetes.io/proxy-request-buffering: "off" nginx.ingress.kubernetes.io/proxy-send-timeout: "300" - nginx.ingress.kubernetes.io/ssl-redirect: "false" + nginx.ingress.kubernetes.io/ssl-redirect: "true" spec: tls: - hosts: