fixup! misc: Remove dots from folders

This commit is contained in:
Marius 2019-09-12 21:39:00 +02:00
parent 76f8489d37
commit 03d478eb5c
7 changed files with 300 additions and 0 deletions

17
infra/console.sh Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
# Copyright (c) 2018, Transloadit Ltd.
# Authors:
# - Kevin van Zonneveld <kevin@transloadit.com>
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

82
infra/kube/tusd-kube.yaml Normal file
View File

@ -0,0 +1,82 @@
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

24
scripts/build_all.sh Executable file
View File

@ -0,0 +1,24 @@
#!/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

72
scripts/build_funcs.sh Executable file
View File

@ -0,0 +1,72 @@
#!/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 <maerious@gmail.com>" >> "./$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

45
scripts/deploy_kube.sh Executable file
View File

@ -0,0 +1,45 @@
#!/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

View File

@ -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

6
scripts/test_all.sh Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -e
go test ./pkg/...
go vet ./pkg/...