Release script also takes care of index file (if the S3 bucket is WS-enabled)

This commit is contained in:
Jérôme Petazzoni 2013-08-14 18:35:17 -07:00
parent 5b630d436d
commit 0469e47674
3 changed files with 32 additions and 16 deletions

View File

@ -35,10 +35,10 @@ else
fi
fi
echo "Downloading docker binary and uncompressing into /usr/local/bin..."
curl -s https://get.docker.io/builds/$(uname -s)/$(uname -m)/docker-latest.tgz |
tar -C /usr/local/bin --strip-components=1 -zxf- \
docker-latest/docker
echo "Downloading docker binary to /usr/local/bin..."
curl -s https://get.docker.io/builds/$(uname -s)/$(uname -m)/docker-latest \
> /usr/local/bin/docker
chmod +x /usr/local/bin/docker
if [ -f /etc/init/dockerd.conf ]
then
@ -50,7 +50,7 @@ description "Docker daemon"
start on filesystem or runlevel [2345]
stop on runlevel [!2345]
respawn
exec env LANG="en_US.UTF-8" /usr/local/bin/docker -d
exec /usr/local/bin/docker -d
EOF
fi

21
make.sh
View File

@ -51,6 +51,16 @@ Docker is a great building block for automating distributed systems:
large-scale web deployments, database clusters, continuous deployment systems,
private PaaS, service-oriented architectures, etc."
UPSTART_SCRIPT='description "Docker daemon"
start on filesystem or runlevel [2345]
stop on runlevel [!2345]
respawn
exec docker -d
'
# Each "bundle" is a different type of build artefact: static binary, Ubuntu
# package, etc.
@ -86,16 +96,7 @@ bundle_ubuntu() {
# Generate an upstart config file (ubuntu-specific)
mkdir -p $DIR/etc/init
cat > $DIR/etc/init/docker.conf <<EOF
description "Run docker"
start on filesystem or runlevel [2345]
stop on runlevel [!2345]
respawn
exec docker -d
EOF
echo "$UPSTART_SCRIPT" > $DIR/etc/init/docker.conf
# Copy the binary
mkdir -p $DIR/usr/bin

View File

@ -48,12 +48,14 @@ BUCKET=$AWS_S3_BUCKET
setup_s3() {
# Try creating the bucket. Ignore errors (it might already exist).
s3cmd --acl-public mb s3://$BUCKET 2>/dev/null || true
s3cmd mb s3://$BUCKET 2>/dev/null || true
# Check access to the bucket.
# s3cmd has no useful exit status, so we cannot check that.
# Instead, we check if it outputs anything on standard output.
# (When there are problems, it uses standard error instead.)
s3cmd info s3://$BUCKET | grep -q .
# Make the bucket accessible through website endpoints.
s3cmd ws-create --ws-index index --ws-error error s3://$BUCKET
}
# write_to_s3 uploads the contents of standard input to the specified S3 url.
@ -152,10 +154,23 @@ EOF
fi
}
# Upload the index script
release_index() {
(
if [ "$BUCKET" != "get.docker.io" ]
then
sed s,https://get.docker.io/,http://$BUCKET.s3.amazonaws.com/, contrib/install.sh
else
cat contrib/install.sh
fi
) | write_to_s3 s3://$BUCKET/index
}
main() {
setup_s3
release_binary
release_ubuntu
release_index
}
main