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
# Flag to run Django app in debug mode | |
curl -X PUT -d 'True' consul_server:8500/v1/kv/web/debug | |
# Dynamic entries into Django app configuration | |
# to denote allowed set of hosts | |
curl -X PUT -d 'localhost, 33.10.0.100' consul_server:8500/v1/kv/web/allowed_hosts | |
# Dynamic entries into Django app configuration | |
# to denote installed apps | |
curl -X PUT -d 'tweetapp' consul_server:8500/v1/kv/web/installed_apps |
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
$ pipenv shell | |
Launching subshell in virtual environment… | |
. /home/pranav/.local/share/virtualenvs/tweeter-PYSn2zRU/bin/activate | |
$ . /home/pranav/.local/share/virtualenvs/tweeter-PYSn2zRU/bin/activate | |
(tweeter) $ pipenv install python-consul | |
Installing python-consul… | |
Adding python-consul to Pipfile's [packages]… | |
✔ Installation Succeeded |
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
root@82857c424b15:/web/tweeter# dig @127.0.0.1 mongo-primary.service.consul | |
; <<>> DiG 9.10.3-P4-Debian <<>> @127.0.0.1 mongo-primary.service.consul | |
; (1 server found) | |
;; global options: +cmd | |
;; Got answer: | |
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 8369 | |
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 2 | |
;; WARNING: recursion requested but not available |
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
version: "3.6" | |
services: | |
consul_server: | |
build: | |
context: consul_server | |
dockerfile: Dockerfile | |
image: consul_server | |
ports: |
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
FROM ubuntu:18.04 | |
RUN apt-get update && \ | |
apt-get install -y \ | |
bash curl nano net-tools zip unzip \ | |
jq dnsutils iputils-ping | |
ADD https://releases.hashicorp.com/consul/1.4.4/consul_1.4.4_linux_amd64.zip /tmp/consul.zip | |
RUN cd /bin && unzip /tmp/consul.zip && chmod +x /bin/consul && rm /tmp/consul.zip |
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
FROM python:3.7 | |
RUN apt-get update && \ | |
apt-get install -y \ | |
bash curl nano net-tools zip unzip \ | |
jq dnsutils iputils-ping | |
# Python Environment Setup | |
ENV PYTHONDONTWRITEBYTECODE 1 | |
ENV PYTHONUNBUFFERED 1 |
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
# Django | |
django: /web/tweeter.sh | |
# Consul Client Agent | |
consul: /opt/consul.sh |
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
FROM ubuntu:18.04 | |
RUN apt-get update && \ | |
apt-get install -y \ | |
bash curl nano net-tools zip unzip \ | |
jq dnsutils iputils-ping | |
# Install MongoDB | |
RUN apt-get install -y mongodb |
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
# Mongo | |
mongo: /opt/mongo.sh | |
# Consul Client Agent | |
consul: /opt/consul.sh | |
# Consul Client Health Checks | |
consul_check: while true; do /opt/checks_toggler.sh && sleep 10; done |
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 -server \ | |
-bind 33.10.0.2 \ | |
-advertise 33.10.0.2 \ | |
-node consul_server \ | |
-client 0.0.0.0 \ | |
-dns-port 53 \ | |
-data-dir /data \ | |
-ui -bootstrap |