Last active
November 4, 2016 23:19
-
-
Save wyattjoh/315d353421e03ec58232583a9efe91fc to your computer and use it in GitHub Desktop.
Talk Deployment Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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