Rebuild env so it can be deployed to the tus server
This commit is contained in:
parent
2205a84499
commit
f0f16865a9
|
@ -156,7 +156,7 @@
|
||||||
ansistrano_group = "ubuntu"
|
ansistrano_group = "ubuntu"
|
||||||
|
|
||||||
[[deploy.playbooks.tasks]]
|
[[deploy.playbooks.tasks]]
|
||||||
copy = "src=../env.sh dest={{{config.global.approot}}}/current/tusd_linux_amd64/env.sh mode=0600 owner=root group=root"
|
copy = "src={{ playbook_dir }}/env.sh dest={{{config.global.approot}}}/current/tusd_linux_amd64/env.sh mode=0600 owner=root group=root"
|
||||||
name = "tusd | Upload environment"
|
name = "tusd | Upload environment"
|
||||||
|
|
||||||
[[deploy.playbooks.tasks]]
|
[[deploy.playbooks.tasks]]
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# Uppy-server. Copyright (c) 2016, Transloadit Ltd.
|
||||||
|
#
|
||||||
|
# This file:
|
||||||
|
#
|
||||||
|
# - Walks over any FREY_ and TUSD_ environment variable (except for _AWS_)
|
||||||
|
# - Adds encrypted keys ready for use to .travis.yml
|
||||||
|
#
|
||||||
|
# Run as:
|
||||||
|
#
|
||||||
|
# source env.sh && ./encrypt.sh
|
||||||
|
#
|
||||||
|
# Authors:
|
||||||
|
#
|
||||||
|
# - Kevin van Zonneveld <kevin@transloadit.com>
|
||||||
|
|
||||||
|
set -o pipefail
|
||||||
|
set -o errexit
|
||||||
|
set -o nounset
|
||||||
|
# set -o xtrace
|
||||||
|
|
||||||
|
if [ -z "${FREY_DOMAIN:-}" ]; then
|
||||||
|
echo "FREY_DOMAIN not present. "
|
||||||
|
echo "Please first source env.sh"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set magic variables for current file & dir
|
||||||
|
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
|
||||||
|
__base="$(basename ${__file} .sh)"
|
||||||
|
__freyroot="$(dirname "${__dir}")"
|
||||||
|
|
||||||
|
for var in $(env |awk -F= '{print $1}' |egrep '^(FREY|TUSD)_[A-Z0-9_]+$' |grep -v '_AWS_' |sort); do
|
||||||
|
echo "Encrypting and adding '${var}'"
|
||||||
|
travis encrypt "${var}=${!var}" --add env.global
|
||||||
|
done
|
|
@ -0,0 +1,47 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# tusd. Copyright (c) 2016, Transloadit Ltd.
|
||||||
|
|
||||||
|
# This file:
|
||||||
|
#
|
||||||
|
# - Creates a brand new env.sh based on env.example.sh that is shipped with Git
|
||||||
|
# - Walks over any FREY_ and TUSD_ environment variable
|
||||||
|
# - Adds them as exports to to env.sh inside $__freyroot
|
||||||
|
#
|
||||||
|
# Run as:
|
||||||
|
#
|
||||||
|
# ./rebuild-env.sh
|
||||||
|
#
|
||||||
|
# Authors:
|
||||||
|
#
|
||||||
|
# - Kevin van Zonneveld <kevin@transloadit.com>
|
||||||
|
|
||||||
|
set -o pipefail
|
||||||
|
set -o errexit
|
||||||
|
set -o nounset
|
||||||
|
# set -o xtrace
|
||||||
|
|
||||||
|
if [ -z "${FREY_DOMAIN:-}" ]; then
|
||||||
|
echo "FREY_DOMAIN not present. "
|
||||||
|
echo "Please make sure your environment is set properly (via e.g. travis encrypt)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set magic variables for current file & dir
|
||||||
|
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
|
||||||
|
__base="$(basename ${__file} .sh)"
|
||||||
|
__freyroot="$(dirname "${__dir}")"
|
||||||
|
|
||||||
|
if [ -f "${__freyroot}/env.sh" ]; then
|
||||||
|
echo "You alreayd have a '${__freyroot}/env.sh'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cp -v "${__freyroot}/env.example.sh" "${__freyroot}/env.sh"
|
||||||
|
chmod 600 "${__freyroot}/env.sh"
|
||||||
|
for var in $(env |awk -F= '{print $1}' |egrep '^(FREY|TUSD)_[A-Z0-9_]+$'| grep -v '_AWS_' |sort); do
|
||||||
|
echo "Adding '${var}' to env.sh"
|
||||||
|
echo "export ${var}=\"${!var}\"" >> "${__freyroot}/env.sh"
|
||||||
|
done
|
||||||
|
|
||||||
|
ls -al "${__freyroot}/env.sh"
|
|
@ -29,6 +29,7 @@ before_deploy:
|
||||||
- go get github.com/laher/goxc
|
- go get github.com/laher/goxc
|
||||||
- goxc -t -bc="linux darwin windows"
|
- goxc -t -bc="linux darwin windows"
|
||||||
- goxc -d=./ -wd=./cmd/tusd -bc="linux darwin windows" -build-ldflags="-X main.VersionName=$TRAVIS_TAG -X main.GitCommit=$TRAVIS_COMMIT -X 'main.BuildDate=$(date --utc)'"
|
- goxc -d=./ -wd=./cmd/tusd -bc="linux darwin windows" -build-ldflags="-X main.VersionName=$TRAVIS_TAG -X main.GitCommit=$TRAVIS_COMMIT -X 'main.BuildDate=$(date --utc)'"
|
||||||
|
- .infra/scripts/rebuild-env.sh
|
||||||
- if [ "${TRAVIS_PULL_REQUEST}" == "false" ] && [ "${TRAVIS_BRANCH}" == "master" ]; then (make frey && frey setup --force-yes --projectDir .infra); else echo "Skipping deploy fornon-master/PRs"; fi
|
- if [ "${TRAVIS_PULL_REQUEST}" == "false" ] && [ "${TRAVIS_BRANCH}" == "master" ]; then (make frey && frey setup --force-yes --projectDir .infra); else echo "Skipping deploy fornon-master/PRs"; fi
|
||||||
deploy:
|
deploy:
|
||||||
provider: releases
|
provider: releases
|
||||||
|
|
Loading…
Reference in New Issue