Skip to content
This repository has been archived by the owner on May 9, 2020. It is now read-only.

Commit

Permalink
Bundle docker-worker package using tar
Browse files Browse the repository at this point in the history
  • Loading branch information
gregarndt committed Mar 20, 2017
1 parent 14887a8 commit b91bf74
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 40 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -10,5 +10,7 @@
docker-worker.conf.json
*.box
docker-worker-*.pub
docker-worker.tgz
build
.test
yarn-error.log
4 changes: 2 additions & 2 deletions deploy/bin/build
Expand Up @@ -31,7 +31,7 @@ packer_config() {

cmd_app() {
# Package up the node app.
local npm_package=$(yarn pack)
tar --exclude='./node_modules' --exclude='./*.pub' --exclude='./build/' --exclude='./deploy' --exclude='.test' --exclude='.git' --exclude='.vagrant' --exclude='./.DS_Store' --exclude='./vagrant/' --exclude='app.box' -zcvf docker-worker.tgz .
local git_rev=$(git rev-parse --verify HEAD)

# Configure the deployment if needed...
Expand All @@ -42,7 +42,7 @@ cmd_app() {
$@ \
-var-file $(template_vars app) \
-var "templateContents=deploy/deploy.tar.gz" \
-var "npmPackage=$npm_package" \
-var "npmPackage=docker-worker.tgz" \
-var "workerRevision=$git_rev" \
$(packer_config app)
}
Expand Down
20 changes: 2 additions & 18 deletions deploy/packer/app.json
Expand Up @@ -4,8 +4,8 @@
"variables": {
"npmPackage": "",
"templateContents": "",
"hvmSourceAMI": "ami-33c77853",
"pvSourceAMI": "ami-52c67932",
"hvmSourceAMI": "ami-4879f728",
"pvSourceAMI": "ami-4977f929",
"fsType": "",
"workerRevision": ""
},
Expand Down Expand Up @@ -62,22 +62,6 @@
"Revision": "{{user `workerRevision`}}",
"Base_AMI": "{{user `hvmSourceAMI`}}"
}
},
{
"type": "amazon-ebs",
"name": "pv-builder",
"region": "us-west-2",
"ami_regions": ["us-west-1", "us-east-1"],
"source_ami": "{{user `pvSourceAMI`}}",
"instance_type": "m1.medium",
"ssh_username": "ubuntu",
"ami_name": "taskcluster-docker-worker-{{user `fsType`}}-PV-{{timestamp}}",
"tags": {
"OS_Version": "Ubuntu",
"Release": "Latest",
"Revision": "{{user `workerRevision`}}",
"Base_AMI": "{{user `pvSourceAMI`}}"
}
}
]
}
17 changes: 2 additions & 15 deletions deploy/packer/app/scripts/deploy.sh
Expand Up @@ -29,21 +29,8 @@ sudo chown -R $USER:$USER /home/ubuntu/docker_worker

sudo npm install -g babel-cli yarn

retry_count=0
max_retries=5
until [ $retry_count -gt $max_retries ]; do
yarn install --frozen-lockfile && break
retry_count=$(($retry_count + 1))
sleep 5
done

if [ $retry_count -ge $max_retries ]; then
echo ""
echo "Error installing docker-worker packages"
exit -1
fi

npm rebuild
yarn install --frozen-lockfile
yarn build

# Initialize video and sound loopback modules
sudo modprobe v4l2loopback
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -47,6 +47,7 @@
"fs-ext": "^0.5.0",
"got": "^6.5.0",
"iptables": "^0.0.4",
"json-templater": "^1.1.0",
"koa": "^0.19.1",
"koa-json": "^1.1.1",
"koa-router": "^4.3.2",
Expand All @@ -71,11 +72,10 @@
"tar-fs": "^1.7.0",
"tar-stream": "^1.2.1",
"taskcluster-azure-blobstream": "^0.3.0",
"taskcluster-lib-scopes": "^1.0.0",
"taskcluster-task-factory": "^0.6.1",
"taskcluster-base": "^6.2.0",
"taskcluster-client": "^1.6.1",
"taskcluster-lib-monitor": "^4.3.1",
"taskcluster-lib-scopes": "^1.0.0",
"taskcluster-task-factory": "^0.6.4",
"temporary": "^0.0.8",
"uuid": "^2.0.0",
Expand Down
3 changes: 0 additions & 3 deletions test/dockerworker.js
Expand Up @@ -56,9 +56,6 @@ export default class DockerWorker {
stream.pipe(devnull());
await waitForEvent(stream, 'end');

// Path to babel in the docker container...
var babel = '/worker/node_modules/.bin/babel-node';

var createConfig = {
name: this.workerId,
Image: IMAGE,
Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Expand Up @@ -2439,6 +2439,10 @@ json-stringify-safe@5, json-stringify-safe@5.0.1, json-stringify-safe@^5.0.1, js
version "5.0.1"
resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"

json-templater@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/json-templater/-/json-templater-1.1.0.tgz#355bb4bc990bd53cc157f761fae03f3f23dd14aa"

json3@3.3.2, json3@^3.3.2:
version "3.3.2"
resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.2.tgz#3c0434743df93e2f5c42aee7b19bcb483575f4e1"
Expand Down

0 comments on commit b91bf74

Please sign in to comment.