diff --git a/.s3cfg b/.s3cfg new file mode 100644 index 000000000..0dccd6261 --- /dev/null +++ b/.s3cfg @@ -0,0 +1,38 @@ +[default] +access_key +secret_key +bucket_location = US +cloudfront_host = cloudfront.amazonaws.com +cloudfront_resource = /2010-07-15/distribution +default_mime_type = binary/octet-stream +delete_removed = False +dry_run = False +encoding = UTF-8 +encrypt = False +follow_symlinks = False +force = False +get_continue = False +gpg_command = None +gpg_decrypt = %(gpg_command)s -d --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s +gpg_encrypt = %(gpg_command)s -c --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s +gpg_passphrase = +guess_mime_type = True +host_base = s3.amazonaws.com +host_bucket = %(bucket)s.s3.amazonaws.com +human_readable_sizes = False +list_md5 = False +log_target_prefix = +preserve_attrs = True +progress_meter = True +proxy_host = +proxy_port = 0 +recursive = False +recv_chunk = 4096 +reduced_redundancy = False +send_chunk = 4096 +simpledb_host = sdb.amazonaws.com +skip_existing = False +socket_timeout = 300 +urlencoding_mode = normal +use_https = False +verbosity = WARNING diff --git a/.travis.yml b/.travis.yml index 8786019b0..d7e1906df 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,2 +1,15 @@ --- -script: sudo bash bootstrap.sh +script: cd tests && ./run_ec2 progrium +before_install: + - "apt-get install -y ec2-api-tools" + - "apt-get install -y s3cmd" + - "sed --in-place 's/access_key/access_key = $AWS_ACCESS_KEY' .s3cfg" + - "sed --in-place 's/secret_key/secret_key = $AWS_SECRET_KEY' .s3cfg" + - "s3cmd get s3://progrium-private/ec2_cert.pem /tmp/cert" + - "s3cmd get s3://progirum-private/ec2_pk.pem /tmp/pk" +env: + global: + - EC2_CERT=/tmp/cert + - EC2_PRIVATE_KEY=/tmp/pk + - secure: "flDyaNZ6Xn2W1JyI3N1DCzI+K7ACgAZJ38vVfSde6rmI/V2iaAR4YH+7PC/x\nb/uCW9JCl+IVq5DJ0vu59HkAXlV4i4S9gVDExygt/fAo+sfGiMWubRUZMZeC\nHKK+92kexmqGRJLU8s5wDakddMAZ4+y7QPfVdxAHp/Tuijq+9iE=" + - secure: "gSYrtzzmbwumE60J9sUhIaA5vakfXnP4NtCbxha0pyepPFrlds3YO0lxoH7J\nYdG8Yl5ObdqyDNQ2Yb/FL7wmctuPZSZ3OHQNjDpOqsqOqr7M2+b8aVM8URKE\n/Lki+GP8M8kajBr6zKgIV1W+e8SZQsAazhHwKRaJJQVWT58Aghk=" diff --git a/tests/nodejs/express/Procfile b/tests/apps/nodejs-express/Procfile similarity index 100% rename from tests/nodejs/express/Procfile rename to tests/apps/nodejs-express/Procfile diff --git a/tests/apps/nodejs-express/check_deploy b/tests/apps/nodejs-express/check_deploy new file mode 100755 index 000000000..3bb12d4c4 --- /dev/null +++ b/tests/apps/nodejs-express/check_deploy @@ -0,0 +1,3 @@ +#!/bin/bash +set -e +test "$(curl $1)" == "nodejs/express2" \ No newline at end of file diff --git a/tests/nodejs/express/package.json b/tests/apps/nodejs-express/package.json similarity index 100% rename from tests/nodejs/express/package.json rename to tests/apps/nodejs-express/package.json diff --git a/tests/nodejs/express/web.js b/tests/apps/nodejs-express/web.js similarity index 100% rename from tests/nodejs/express/web.js rename to tests/apps/nodejs-express/web.js diff --git a/tests/run_ec2 b/tests/run_ec2 index 7fcba7c26..d62934fa6 100755 --- a/tests/run_ec2 +++ b/tests/run_ec2 @@ -12,7 +12,7 @@ terminate() { echo "-----> Terminating $INSTANCE..." ec2-terminate-instances $INSTANCE &>/dev/null && echo " Shutting down" } -[[ $DEBUG ]] || trap "terminate" EXIT +[[ $NOCLEANUP ]] || trap "terminate" EXIT sleep 30 status="" while [[ "$status" != "running" ]]; do @@ -32,4 +32,12 @@ while [[ ! $(echo | nc $PUBLIC_IP 22) ]]; do echo " Waiting..." done echo "-----> Connecting and running boostrap script..." -cat ../bootstrap.sh | ssh -o "StrictHostKeyChecking=no" ubuntu@$PUBLIC_IP "HOSTNAME=$PUBLIC_IP sudo bash" 2>&1 | indent \ No newline at end of file +cat ../bootstrap.sh | ssh -o "StrictHostKeyChecking=no" ubuntu@$PUBLIC_IP "HOSTNAME=$PUBLIC_IP sudo bash" 2>&1 | indent +echo "-----> Installing SSH public keys..." +ssh-add -L | ssh -o "StrictHostKeyChecking=no" ubuntu@$PUBLIC_IP "sudo gitreceive upload-key test" > /dev/null +ssh-add -L | ssh -o "StrictHostKeyChecking=no" ubuntu@$PUBLIC_IP "sudo sshcommand acl-add dokku test" > /dev/null +for app_path in apps/*; do + app=$(basename $app_path) + echo "-----> Running test deploy of $app..." + ./test_deploy $app_path $PUBLIC_IP +done \ No newline at end of file diff --git a/tests/test_deploy b/tests/test_deploy index 4be9b8f09..ac1961e89 100755 --- a/tests/test_deploy +++ b/tests/test_deploy @@ -1,5 +1,5 @@ #!/bin/bash -# set -e +set -e SELF=`which $0`; APP="$1"; TARGET="$2" TMP=$(mktemp -d -t $TARGET) trap "rm -rf $TMP" EXIT @@ -11,11 +11,5 @@ git commit -m 'initial commit' REPO="test-$RANDOM" git remote add target git@$TARGET:$REPO URL_FILE=$(mktemp -t url) -git push target master 2>&1 | while read line; do - echo "$line" - [[ $(echo "$line" | grep $TARGET | grep remote) ]] && echo "$line" | awk '{print $2}' > $URL_FILE -done -set -x -URL=$(<$URL_FILE) -curl -v "$URL:8080" # GAHAHHHHH WHY DOESNT THIS WORK -rm $URL_FILE \ No newline at end of file +git push target master +./check_deploy "$(ssh dokku@$TARGET url $REPO)" && echo "-----> Deploy success!" \ No newline at end of file