Skip to content

Instantly share code, notes, and snippets.

@wyattjoh
Last active November 4, 2016 23:19
Show Gist options
  • Save wyattjoh/315d353421e03ec58232583a9efe91fc to your computer and use it in GitHub Desktop.
Save wyattjoh/315d353421e03ec58232583a9efe91fc to your computer and use it in GitHub Desktop.
Talk Deployment Script
#!/bin/bash
#
# Deploys an instance of talk using docker.
#
# Usage:
#
# bash deploy.sh 1.0.0
#
# This deploys a version 1.0.0.
#
# bash deploy.sh latest
#
# This deploys the latest build of talk.
#
set -e
version=$1
if [ -z "$(echo $version | grep -E '.*\..*\..*')" ] && [ "$version" != "latest" ]
then
echo "bash deploy.sh (<major.minor.patch>|latest)" 1>&2
exit 1
fi
echo "==> generating docker-compose.yml"
cat > docker-compose.yml <<EOF
version: '2'
services:
talk:
image: coralproject/talk:${version}
restart: always
ports:
- "5000:5000"
environment:
- "TALK_PORT=5000"
- "TALK_MONGO_URL=mongodb://mongo"
depends_on:
- mongo
mongo:
image: mongo:3.2
restart: always
volumes:
- mongo:/data/db
volumes:
mongo:
external: false
EOF
echo "==> pulling image"
docker-compose pull
echo "==> starting services"
docker-compose up -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment