Merge branch 'master' of github.com:tus/tusd
This commit is contained in:
commit
51a6afccbc
|
@ -24,27 +24,15 @@ spec:
|
||||||
name: tusd
|
name: tusd
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
memory: "2Gi"
|
memory: "1Gi"
|
||||||
# requests:
|
requests:
|
||||||
# memory: "1Gi"
|
memory: "1Gi"
|
||||||
ports:
|
ports:
|
||||||
- name: tusd-web
|
- name: tusd-web
|
||||||
containerPort: 8080
|
containerPort: 8080
|
||||||
envFrom:
|
envFrom:
|
||||||
- configMapRef:
|
|
||||||
name: tusd-env
|
|
||||||
- secretRef:
|
- secretRef:
|
||||||
name: tusd-s3
|
name: tusd-env
|
||||||
securityContext:
|
|
||||||
runAsUser: 0
|
|
||||||
fsGroup: 0
|
|
||||||
volumeMounts:
|
|
||||||
- name: tusd-account
|
|
||||||
mountPath: /gcs
|
|
||||||
volumes:
|
|
||||||
- name: tusd-account
|
|
||||||
secret:
|
|
||||||
secretName: gcs-account
|
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
|
@ -99,25 +87,3 @@ spec:
|
||||||
backend:
|
backend:
|
||||||
serviceName: tusd
|
serviceName: tusd
|
||||||
servicePort: 80
|
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
|
|
||||||
|
|
|
@ -8,30 +8,25 @@ set -o nounset
|
||||||
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
__root="$(cd "$(dirname "${__dir}")" && 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
|
||||||
echo "Storing ca.crt inside HOME"
|
chmod +x ./kubectl
|
||||||
echo $CA_CRT | base64 --decode -i > ${HOME}/ca.crt
|
sudo mv ./kubectl /usr/local/bin/kubectl
|
||||||
echo "ca.crt is saved"
|
|
||||||
|
|
||||||
#Store the new image in docker hub
|
#Store the new image in docker hub
|
||||||
docker build --quiet -t tusproject/tusd:latest -t tusproject/tusd:$TRAVIS_COMMIT ${__root};
|
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:$TRAVIS_COMMIT;
|
||||||
docker push tusproject/tusd:latest;
|
docker push tusproject/tusd:latest;
|
||||||
|
|
||||||
|
|
||||||
|
echo "Create directory..."
|
||||||
|
mkdir ${HOME}/.kube
|
||||||
gcloud config set container/use_client_certificate True
|
echo "Writing KUBECONFIG to file..."
|
||||||
export CLOUDSDK_CONTAINER_USE_CLIENT_CERTIFICATE=True
|
echo $KUBECONFIGVAR | python -m base64 -d > ${HOME}/.kube/config
|
||||||
|
echo "KUBECONFIG file written"
|
||||||
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
|
|
||||||
|
|
||||||
sleep 10s # This cost me some precious debugging time.
|
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
|
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 {
|
function cleanup {
|
||||||
printf "Cleaning up...\n"
|
printf "Cleaning up...\n"
|
||||||
rm -f ${HOME}/ca.crt
|
rm -f ${HOME}/.kube/config
|
||||||
printf "Cleaning done."
|
printf "Cleaning done."
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,12 +27,6 @@ script:
|
||||||
- ./.scripts/test_all.sh
|
- ./.scripts/test_all.sh
|
||||||
before_deploy:
|
before_deploy:
|
||||||
- if [[ "$TRAVIS_TAG" != "" ]]; then ./.scripts/build_all.sh; fi
|
- 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:
|
deploy:
|
||||||
- provider: releases
|
- provider: releases
|
||||||
api_key:
|
api_key:
|
||||||
|
@ -45,7 +39,7 @@ deploy:
|
||||||
go: 1.12
|
go: 1.12
|
||||||
repo: tus/tusd
|
repo: tus/tusd
|
||||||
- provider: script
|
- provider: script
|
||||||
script: .scripts/deploy_gcloud.sh
|
script: .scripts/deploy_kube.sh
|
||||||
on:
|
on:
|
||||||
branch: master
|
branch: master
|
||||||
go: 1.12
|
go: 1.12
|
||||||
|
|
|
@ -22,7 +22,7 @@ FROM alpine:3.9
|
||||||
|
|
||||||
COPY --from=builder /go/bin/tusd /usr/local/bin/tusd
|
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 \
|
&& addgroup -g 1000 tusd \
|
||||||
&& adduser -u 1000 -G tusd -s /bin/sh -D tusd \
|
&& adduser -u 1000 -G tusd -s /bin/sh -D tusd \
|
||||||
&& mkdir -p /srv/tusd-hooks \
|
&& mkdir -p /srv/tusd-hooks \
|
||||||
|
|
Loading…
Reference in New Issue