From 76f8489d37f2f7382cca075b594b94c0d3d2e0e1 Mon Sep 17 00:00:00 2001 From: Marius Date: Thu, 12 Sep 2019 13:10:51 +0200 Subject: [PATCH] misc: Remove dots from folders --- .infra/console.sh | 17 ----- .infra/kube/tusd-kube.yaml | 82 ----------------------- .scripts/build_all.sh | 24 ------- .scripts/build_funcs.sh | 72 -------------------- .scripts/deploy_kube.sh | 45 ------------- .scripts/generate-docker-library.sh | 54 --------------- .scripts/test_all.sh | 16 ----- .travis.yml | 6 +- README.md | 4 +- {docs => examples}/apache2.conf | 0 {.hooks => examples/hooks}/post-create | 0 {.hooks => examples/hooks}/post-finish | 0 {.hooks => examples/hooks}/post-receive | 0 {.hooks => examples/hooks}/post-terminate | 0 {.hooks => examples/hooks}/pre-create | 0 {docs => examples}/nginx.conf | 0 16 files changed, 5 insertions(+), 315 deletions(-) delete mode 100755 .infra/console.sh delete mode 100644 .infra/kube/tusd-kube.yaml delete mode 100755 .scripts/build_all.sh delete mode 100755 .scripts/build_funcs.sh delete mode 100755 .scripts/deploy_kube.sh delete mode 100755 .scripts/generate-docker-library.sh delete mode 100755 .scripts/test_all.sh rename {docs => examples}/apache2.conf (100%) rename {.hooks => examples/hooks}/post-create (100%) rename {.hooks => examples/hooks}/post-finish (100%) rename {.hooks => examples/hooks}/post-receive (100%) rename {.hooks => examples/hooks}/post-terminate (100%) rename {.hooks => examples/hooks}/pre-create (100%) rename {docs => examples}/nginx.conf (100%) diff --git a/.infra/console.sh b/.infra/console.sh deleted file mode 100755 index df88705..0000000 --- a/.infra/console.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash -# Copyright (c) 2018, Transloadit Ltd. -# Authors: -# - Kevin van Zonneveld - -set -o pipefail -set -o errexit -set -o nounset -# set -o xtrace - -# # Set magic variables for current FILE & DIR -# __dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -# __file="${__dir}/$(basename "${0}")" -# __base="$(basename ${__file})" -# __root="$(cd "$(dirname "${__dir}")" && pwd)" - -kubectl exec -it $(kubectl get pods --namespace tus -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}') --namespace tus -- /bin/sh \ No newline at end of file diff --git a/.infra/kube/tusd-kube.yaml b/.infra/kube/tusd-kube.yaml deleted file mode 100644 index f01c763..0000000 --- a/.infra/kube/tusd-kube.yaml +++ /dev/null @@ -1,82 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: tusd - namespace: tus -spec: - replicas: 1 - template: - metadata: - labels: - app: tusd - spec: - containers: - - image: docker.io/tusproject/tusd:latest - imagePullPolicy: Always - args: ["-s3-bucket","tusdtest.transloadit.com","-port=8080","-behind-proxy","-max-size=20000000000","-timeout=6000"] - name: tusd - resources: - limits: - memory: "1Gi" - requests: - memory: "1Gi" - ports: - - name: tusd-web - containerPort: 8080 - envFrom: - - secretRef: - name: tusd-env ---- -apiVersion: v1 -kind: Service -metadata: - name: tusd - namespace: tus -spec: - ports: - - name: tusd-web - port: 80 - targetPort: 8080 - protocol: TCP - selector: - app: tusd ---- -apiVersion: extensions/v1beta1 -kind: Ingress -metadata: - name: tusd - namespace: tus - annotations: - certmanager.k8s.io/cluster-issuer: "letsencrypt-prod" - certmanager.k8s.io/acme-challenge-type: "http01" - kubernetes.io/tls-acme: "true" - kubernetes.io/ingress.class: "nginx" - nginx.ingress.kubernetes.io/proxy-body-size: 0m - nginx.ingress.kubernetes.io/proxy-connect-timeout: "300" - 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: "true" -spec: - tls: - - hosts: - - tusd.tus.io - secretName: tusd-tls - - hosts: - - master.tus.io - secretName: master-tls - rules: - - host: tusd.tus.io - http: - paths: - - path: / - backend: - serviceName: tusd - servicePort: 80 - - host: master.tus.io - http: - paths: - - path: / - backend: - serviceName: tusd - servicePort: 80 diff --git a/.scripts/build_all.sh b/.scripts/build_all.sh deleted file mode 100755 index 04f885f..0000000 --- a/.scripts/build_all.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash - -set -e - -__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" - -source "${__dir}/build_funcs.sh" - -compile linux 386 -compile linux amd64 -compile linux arm -compile darwin 386 -compile darwin amd64 -#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 -makedep amd64 diff --git a/.scripts/build_funcs.sh b/.scripts/build_funcs.sh deleted file mode 100755 index 0fe61b6..0000000 --- a/.scripts/build_funcs.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env bash - -set -e - -version="$(git tag -l --points-at HEAD)" -commit=$(git log --format="%H" -n 1) - -function compile { - local os=$1 - local arch=$2 - local ext=$3 - - echo "Compiling for $os/$arch..." - - local dir="tusd_${os}_${arch}" - rm -rf "$dir" - mkdir -p "$dir" - GOOS=$os GOARCH=$arch go build \ - -ldflags="-X github.com/tus/tusd/cmd/tusd/cli.VersionName=${version} -X github.com/tus/tusd/cmd/tusd/cli.GitCommit=${commit} -X 'github.com/tus/tusd/cmd/tusd/cli.BuildDate=$(date --utc)'" \ - -o "$dir/tusd$ext" ./cmd/tusd/main.go -} - -function makezip { - local os=$1 - local arch=$2 - local ext=$3 - - echo "Zipping for $os/$arch..." - - local dir="tusd_${os}_${arch}" - zip "$dir.zip" "$dir/tusd$ext" LICENSE.txt README.md -} - -function maketar { - local os=$1 - local arch=$2 - - echo "Tarring for $os/$arch..." - - local dir="tusd_${os}_${arch}" - tar -czf "$dir.tar.gz" "$dir/tusd" LICENSE.txt README.md -} - -function makedep { - local arch=$1 - - echo "Debbing for $arch..." - - local dir="tusd_snapshot_${arch}" - rm -rf "$dir" - mkdir -p "$dir" - mkdir -p "$dir/DEBIAN" - mkdir -p "$dir/usr/bin" - cp "./tusd_linux_${arch}/tusd" "./$dir/usr/bin/tusd" - - echo "Package: tusd" >> "./$dir/DEBIAN/control" - echo "Maintainer: Marius " >> "./$dir/DEBIAN/control" - echo "Section: devel" >> "./$dir/DEBIAN/control" - echo "Priority: optional" >> "./$dir/DEBIAN/control" - echo "Version: ${version}" >> "./$dir/DEBIAN/control" - echo "Architecture: ${arch}" >> "./$dir/DEBIAN/control" - echo "Homepage: https://github.com/tus/tusd" >> "./$dir/DEBIAN/control" - echo "Built-Using: $(go version)" >> "./$dir/DEBIAN/control" - echo "Description: The official server implementation of the tus resumable upload protocol." >> "./$dir/DEBIAN/control" - - dpkg-deb --build "$dir" -} - -export -f compile -export -f maketar -export -f makezip -export -f makedep diff --git a/.scripts/deploy_kube.sh b/.scripts/deploy_kube.sh deleted file mode 100755 index abd52d6..0000000 --- a/.scripts/deploy_kube.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env bash -set -o pipefail -set -o errexit -set -o nounset -# set -o xtrace - -# Set magic variables for current FILE & DIR -__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -__root="$(cd "$(dirname "${__dir}")" && pwd)" - -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 push tusproject/tusd:$TRAVIS_COMMIT; -docker push tusproject/tusd:latest; - - -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 -f "${__root}/.infra/kube/tusd-kube.yaml" - - -kubectl set image deployment/tusd --namespace=tus tusd=docker.io/tusproject/tusd:$TRAVIS_COMMIT - -kubectl get pods --namespace=tus -kubectl get service --namespace=tus -kubectl get deployment --namespace=tus - - -function cleanup { - printf "Cleaning up...\n" - rm -f ${HOME}/.kube/config - printf "Cleaning done." -} - -trap cleanup EXIT diff --git a/.scripts/generate-docker-library.sh b/.scripts/generate-docker-library.sh deleted file mode 100755 index 58a77cd..0000000 --- a/.scripts/generate-docker-library.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/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 diff --git a/.scripts/test_all.sh b/.scripts/test_all.sh deleted file mode 100755 index 0070857..0000000 --- a/.scripts/test_all.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash - -set -e - -install_etcd_pkgs() { - ETCD_VERSION="3.3.10" - wget -q -O /tmp/etcd.tar.gz "https://github.com/etcd-io/etcd/releases/download/v$ETCD_VERSION/etcd-v$ETCD_VERSION-linux-amd64.tar.gz" - tar xvzf /tmp/etcd.tar.gz -C /tmp - export PATH="$PATH:/tmp/etcd-v$ETCD_VERSION-linux-amd64" -} - -# Install the etcd binary which is not vendored. -install_etcd_pkgs - -go test ./pkg/... -go vet ./pkg/... diff --git a/.travis.yml b/.travis.yml index d846996..6d7e2b4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,9 +19,9 @@ env: install: - true script: -- ./.scripts/test_all.sh +- ./scripts/test_all.sh before_deploy: -- if [[ "$TRAVIS_TAG" != "" ]]; then ./.scripts/build_all.sh; fi +- if [[ "$TRAVIS_TAG" != "" ]]; then ./scripts/build_all.sh; fi deploy: - provider: releases api_key: @@ -35,7 +35,7 @@ deploy: repo: tus/tusd os: linux - provider: script - script: .scripts/deploy_kube.sh + script: scripts/deploy_kube.sh on: branch: master go: 1.12 diff --git a/README.md b/README.md index c4a040c..083713b 100644 --- a/README.md +++ b/README.md @@ -249,7 +249,7 @@ go test -v ./... ### How can I access tusd using HTTPS? -The tusd binary, once executed, listens on the provided port for only non-encrypted HTTP requests and *does not accept* HTTPS connections. This decision has been made to limit the functionality inside this repository which has to be developed, tested and maintained. If you want to send requests to tusd in a secure fashion - what we absolutely encourage, we recommend you to utilize a reverse proxy in front of tusd which accepts incoming HTTPS connections and forwards them to tusd using plain HTTP. More information about this topic, including sample configurations for Nginx and Apache, can be found in [issue #86](https://github.com/tus/tusd/issues/86#issuecomment-269569077) and in the [Apache example configuration](/docs/apache2.conf). +The tusd binary, once executed, listens on the provided port for only non-encrypted HTTP requests and *does not accept* HTTPS connections. This decision has been made to limit the functionality inside this repository which has to be developed, tested and maintained. If you want to send requests to tusd in a secure fashion - what we absolutely encourage, we recommend you to utilize a reverse proxy in front of tusd which accepts incoming HTTPS connections and forwards them to tusd using plain HTTP. More information about this topic, including sample configurations for Nginx and Apache, can be found in [issue #86](https://github.com/tus/tusd/issues/86#issuecomment-269569077) and in the [Apache example configuration](/examples/apache2.conf). ### Can I run tusd behind a reverse proxy? @@ -261,7 +261,7 @@ Yes, it is absolutely possible to do so. Firstly, you should execute the tusd bi - *Forward hostname and scheme.* If the proxy rewrites the request URL, the tusd server does not know the original URL which was used to reach the proxy. This behavior can lead to situations, where tusd returns a redirect to a URL which can not be reached by the client. To avoid this confusion, you can explicitly tell tusd which hostname and scheme to use by supplying the `X-Forwarded-Host` and `X-Forwarded-Proto` headers. -Explicit examples for the above points can be found in the [Nginx configuration](/docs/nginx.conf) which is used to power the [master.tus.io](https://master.tus.io) instace. +Explicit examples for the above points can be found in the [Nginx configuration](/examples/nginx.conf) which is used to power the [master.tus.io](https://master.tus.io) instace. ### Can I run custom verification/authentication checks before an upload begins? diff --git a/docs/apache2.conf b/examples/apache2.conf similarity index 100% rename from docs/apache2.conf rename to examples/apache2.conf diff --git a/.hooks/post-create b/examples/hooks/post-create similarity index 100% rename from .hooks/post-create rename to examples/hooks/post-create diff --git a/.hooks/post-finish b/examples/hooks/post-finish similarity index 100% rename from .hooks/post-finish rename to examples/hooks/post-finish diff --git a/.hooks/post-receive b/examples/hooks/post-receive similarity index 100% rename from .hooks/post-receive rename to examples/hooks/post-receive diff --git a/.hooks/post-terminate b/examples/hooks/post-terminate similarity index 100% rename from .hooks/post-terminate rename to examples/hooks/post-terminate diff --git a/.hooks/pre-create b/examples/hooks/pre-create similarity index 100% rename from .hooks/pre-create rename to examples/hooks/pre-create diff --git a/docs/nginx.conf b/examples/nginx.conf similarity index 100% rename from docs/nginx.conf rename to examples/nginx.conf