docker run -d --hostname rabbit --name rabbit-management -p 5672:5672 -p 15672:15672 rabbitmq:3-management
Check that Rabbit MQ is running http://localhost:15672/#/
docker ps
Getting into RabbitMQ to config and go mad.
docker exec --interactive --tty rabbit-management bash
rabbitmqctl list_queues
pip install pika
pip install time
#!/usr/bin/env python
import os
import time
import pika
connection = pika.BlockingConnection(pika.ConnectionParameters(localhost))
channel = connection.channel()
channel.exchange_declare(exchange='data',exchange_type='topic')
channel.queue_declare(queue='demo')
channel.queue_bind(queue='demo',exchange='data',routing_key='hello')
while (True):
channel.basic_publish(exchange='data',
routing_key='hello',
body='Hello World!')
print(" [x] Sent 'Hello World!'")
time.sleep(1)
connection.close()
RABBITMQ_SERVER=localhost
chmod a+x publisher.py
/publisher.py
#!/usr/bin/env python
import os
import pika
connection = pika.BlockingConnection(pika.ConnectionParameters(localhost))
channel = connection.channel()
channel.queue_declare(queue='demo')
def callback(ch, method, properties, body):
print(" [x] Received %r" % body)
channel.basic_consume('demo',
callback,
auto_ack=True)
print(' [*] Waiting for messages. To exit press CTRL+C')
channel.start_consuming()
RABBITMQ_SERVER=localhost
chmod a+x subscriber.py
./subscriber.py
FROM python:3
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install pika
COPY . .
CMD [ "python", "./publisher.py" ]
FROM python:3
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install pika
COPY . .
CMD [ "python", "./subscriber.py" ]
docker build --file Dockerfile-publisher --tag py-publisher .
docker build --file Dockerfile-subscriber --tag py-subscriber .
docker run -it --rm --name py-publisher py-publisher
docker run -it --rm --name py-subscriber py-subscriber
export DOCKER_ID_USER="username"
docker login
docker tag py-publisher $DOCKER_ID_USER/py-publisher
docker push $DOCKER_ID_USER/py-publisher
docker tag py-subscriber $DOCKER_ID_USER/py-subscriber
docker push $DOCKER_ID_USER/py-subscriber
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
az login
az account list --subscription
az aks install-cli
Kubectl will be used to control your production and minikube clusters.
sudo apt update
sudo apt install -y apt-transport-https
sudo su
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF
exit
sudo apt update
sudo apt install -y kubectl
az group create -l westeurope -n aks-resource-group
az aks create --resource-group=aks-resource-group \
--name=aks-cluster \
--node-vm-size=Standard_DS1_v2 \
--node-count=5 \
--generate-ssh-keys
az aks install-cli
az aks get-credentials --resource-group netstar-k8s-rg --name netstar-k8s-cluster
kubectl get nodes
kubectl create clusterrolebinding kubernetes-dashboard --clusterrole=cluster-admin --serviceaccount=kube-system:kubernetes-dashboard
az aks browse --resource-group netstar-k8s-rg --name netstar-k8s-cluster
curl -LO https://git.io/get_helm.sh
chmod 700 get_helm.sh
./get_helm.sh
helm init
helm install stable/rabbitmq
https://github.com/helm/charts/tree/master/stable/rabbitmq