Last active
February 11, 2016 17:46
-
-
Save jpopesculian/cb038f764c6f9dffd541 to your computer and use it in GitHub Desktop.
Setting up a production environment for rocket chat
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
| # CONFIG PORTS | |
| METEOR_PRIMARY_PORT=3001 | |
| METEOR_SECONDARY_PORT=3002 | |
| MONGO_PRIMARY_PORT=28001 | |
| MONGO_SECONDARY_PORT=28002 | |
| MONGO_ARB_PORT=28003 | |
| # DOCKER CONTAINER NAMES | |
| MONGO_PRIMARY_NAME="mongo-primary" | |
| MONGO_SECONDARY_NAME="mongo-secondary" | |
| MONGO_ARB_NAME="mongo-arb" | |
| METEOR_PRIMARY_NAME="primary" | |
| METEOR_SECONDARY_NAME="secondary" | |
| # STOP AND REMOVE ALL CONTAINERS | |
| echo "removing previous containers" | |
| docker stop $MONGO_SECONDARY_NAME > /dev/null 2>&1 | |
| docker rm $MONGO_SECONDARY_NAME > /dev/null 2>&1 | |
| docker stop $MONGO_ARB_NAME > /dev/null 2>&1 | |
| docker rm $MONGO_ARB_NAME > /dev/null 2>&1 | |
| docker stop $MONGO_PRIMARY_NAME > /dev/null 2>&1 | |
| docker rm $MONGO_PRIMARY_NAME > /dev/null 2>&1 | |
| docker stop $METEOR_PRIMARY_NAME > /dev/null 2>&1 | |
| docker rm $METEOR_PRIMARY_NAME > /dev/null 2>&1 | |
| docker stop $METEOR_SECONDARY_NAME > /dev/null 2>&1 | |
| docker rm $METEOR_SECONDARY_NAME > /dev/null 2>&1 | |
| # exit | |
| # SETTING UP MONGO | |
| echo "starting $MONGO_SECONDARY_NAME on port $MONGO_SECONDARY_PORT" | |
| docker run -p $MONGO_SECONDARY_PORT:27017 --name $MONGO_SECONDARY_NAME \ | |
| -d mongo --replSet rs | |
| echo "starting $MONGO_ARB_NAME on port $MONGO_ARB_PORT" | |
| docker run -p $MONGO_ARB_PORT:27017 --name $MONGO_ARB_NAME \ | |
| -d mongo --replSet rs | |
| echo "starting $MONGO_PRIMARY_NAME on port $MONGO_PRIMARY_PORT" | |
| docker run -p $MONGO_PRIMARY_PORT:27017 --name $MONGO_PRIMARY_NAME \ | |
| --link $MONGO_SECONDARY_NAME:secondary --link $MONGO_ARB_NAME:arb \ | |
| -d mongo --replSet rs | |
| mongo setupReplSet.js | |
| # SET UP METEOR | |
| MONGO_URL="mongodb://db:27017/chat" | |
| echo "starting $METEOR_PRIMARY_NAME on port $METEOR_PRIMARY_PORT" | |
| docker run --name $METEOR_PRIMARY_NAME -d \ | |
| --link $MONGO_PRIMARY_NAME:db \ | |
| -e MONGO_URL=$MONGO_URL \ | |
| -e ROOT_URL="http://localhost:$METEOR_PRIMARY_PORT" \ | |
| -p $METEOR_PRIMARY_PORT:80 \ | |
| rocketchat | |
| echo "starting $METEOR_SECONDARY_NAME on port $METEOR_SECONDARY_PORT" | |
| docker run --name $METEOR_SECONDARY_NAME -d \ | |
| --link $MONGO_SECONDARY_NAME:db \ | |
| -e MONGO_URL=$MONGO_URL \ | |
| -e ROOT_URL="http://localhost:$METEOR_SECONDARY_PORT" \ | |
| -p $METEOR_SECONDARY_PORT:80 \ | |
| rocketchat | |
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
| while(true) { | |
| try { | |
| conn = new Mongo("localhost:28004") | |
| break; | |
| } catch (e) { | |
| continue; | |
| } | |
| } | |
| rs.initiate() | |
| rs.conf() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment