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
consul agent -bind 33.10.0.10 \ | |
-advertise 33.10.0.10 \ | |
-join consul_server \ | |
-node web_1 \ | |
-dns-port 53 \ | |
-data-dir /data \ | |
-config-dir /etc/consul.d \ | |
-enable-local-script-checks |
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
{ | |
"service": { | |
"name": "web", | |
"port": 8000, | |
"tags": [ | |
"web", | |
"application", | |
"urlprefix-/web" | |
], | |
"check": { |
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
consul agent -bind 33.10.0.3 \ | |
-advertise 33.10.0.3 \ | |
-join consul_server \ | |
-node mongo_1 \ | |
-dns-port 53 \ | |
-data-dir /data \ | |
-config-dir /etc/consul.d \ | |
-enable-local-script-checks |
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 | |
mongo_secondary=$(mongo --quiet --eval 'JSON.stringify(db.isMaster())' | jq -r .secondary 2> /dev/null) | |
if [[ $mongo_secondary == false ]]; then | |
exit 1 | |
fi | |
echo "Mongo secondary healthy and reachable" |
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 | |
mongo_primary=$(mongo --quiet --eval 'JSON.stringify(db.isMaster())' | jq -r .ismaster 2> /dev/null) | |
if [[ $mongo_primary == false ]]; then | |
exit 1 | |
fi | |
echo "Mongo primary healthy and reachable" |
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
{ | |
"service": { | |
"name": "mongo-secondary", | |
"port": 27017, | |
"tags": [ | |
"nosql", | |
"database" | |
], | |
"check": { | |
"id": "mongo_secondary_status", |
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
{ | |
"service": { | |
"name": "mongo-primary", | |
"port": 27017, | |
"tags": [ | |
"nosql", | |
"database" | |
], | |
"check": { | |
"id": "mongo_primary_status", |
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 | |
# Wait until Mongo starts | |
while [[ $(ps aux | grep [m]ongod | wc -l) -ne 1 ]]; do | |
sleep 5 | |
done | |
REGISTER_MASTER=0 | |
REGISTER_SECONDARY=0 |
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
{ | |
"service": { | |
"name": "web", | |
"port": 8000, | |
"tags": [ | |
"web", | |
"application", | |
"urlprefix-/web" | |
], | |
"check": { |
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
gunicorn --bind 0.0.0.0:8000 --access-logfile - tweeter.wsgi:application |