Cloud Computing for Software Engineers Final Project

Alfaisal University – College of EngineeringSoftware Engineering Department
Subject: SE 443 – Cloud Computing for Software Engineers
Final Project (Fall 2022)
Instructor
Dr. George Violettas
Date
Dec 23 2022 (2 days before the final Time 11:59 PM
exam)
Online
Room
Grade Percentage 15%
Student Name:
_____________________________________________________________
Student Number:
_____________________________________________________________
Student Signature:
_____________________________________________________________
Information and Instructions
➢ This is an open book, open notes project. The University’s code of ethics applies.
➢ Allocate your time wisely.
➢ Answer each of the exam questions to the best of your knowledge.
➢ Clearly state any assumptions made that might be needed to understand your solution.
➢ Show your work – any sign of serious effort will be considered.
Ques
tion
Mark
Full
Quest
Course Learning Outcomes (CLO)
ions
1
5
1.a
5
1.b
5
2.a
5
2.b
5
2.b.i
5
2.b.ii
5
Total
35
An ability to identify, formulate, and solve complex
S01 engineering problems by applying principles of
engineering, science, and mathematics.
1-2
An ability to apply engineering design to produce solutions
that meet specified needs with consideration of public
S02
health, safety, and welfare, as well as global, cultural,
social, environmental, and economic factors
1-2
An ability to communicate effectively with a range of
audiences
N/A
An ability to recognize ethical and professional
responsibilities in engineering situations and make
S04 informed judgments, which must consider the impact of
engineering solutions in global, economic, environmental,
and societal contexts
N/A
An ability to function effectively on a team whose
members together provide leadership, create a collaborative
S05
and inclusive environment, establish goals, plan tasks, and
meet objectives
N/A
An ability to develop and conduct appropriate
S06 experimentation, analyze and interpret data, and use
engineering judgment to draw conclusions.
2
S03
S07
An ability to acquire and apply new knowledge as needed,
using appropriate learning strategies
2
N/A
Project Delivery
For all the following, you have to upload ONE SINGLE FILE (pdf) with all the links for the code created
(GitHub), plus as many screenshots as you consider necessary. Please, keep it minimum). You have to deliver
the file TWO DAYS before the ORIGINAL final exam date (December 22).
Please write as may scripts as necessary in Python 3 to do the following. You are allowed
to use any 3rd libraries and/or frameworks. The easiest Python library to use for such purpose is here.
1. The first part is an mqtt broker running locally into your computer (localhost) by using the image
eclipse-mosquitto. Then do the following:
a. Initialize a single-node Docker Swarm. Try to name the swarm. Is it possible?
b. Print out the ID, name, and creation date of the Swarm.
c. Creates a network named “se443_test_net”, using the “overlay”
driver, “global” scope, and with an IP CIDR range of 10.10.10.0/24.
d. Print out the ID, name, and creation date of the network.
e.
Deploys a service named “broker” with three (3) replicas of the docker image.
i. You will also have to configure the service to automatically restart (always).
2. The second part has a subscriber and a publisher again running from your local computer with the
docker image efrecon/mqtt-client. By using as many as necessary Python scripts you have to
publish/subscribe to the above mqtt broker. The topic has to be “alfaisal_uni” and the messages have
to be where XX will be an increasing counter. Send and receive as many
messages as you need to exhibit the above implementation.
a. Deploy a service named “subscriber” with three (3) replicas of the efrecon/mqtt-client docker
image
b. Deploy a service named “publisher” with three (3) replicas of the efrecon/mqtt-client docker
image
c. You will also have to configure the services to automatically restart (always)
d. Your code should print out the names, IDs, and number of running replicas of both server and
client services.
e. Start publishing messages to the broker, so your code can show how multiple subscriber
replicas subscribe to the same topic of multiple broker replicas and multiple publisher
replicas send multiple messages. Do craft your messages as you wish (e.g., 1.1.1) to exhibit
the above random behaviours.
3. Make all your code run for a set amount of time (e.g., 5 minutes), sends a number of messages, and
then shut down cleanly, cleaning up after itself to bring down services, remove the overlay network,
and finally tear down the Docker Swarm(s).
Notes regarding Docker and mqtt (All the following work on windows)
Steps to run the eclipse-mosquitto broker:
Create a directory mosquitto/conf/ and create the file mosquitto.conf in it, which has the two lines
listener 1883
allow_anonymous true
Be careful to mount the directory mosquitto/conf/mosquitto.conf of the docker image!
To run the eclipse-mosquitto commands can be like the two following:
3
docker run -it -p 1883:1883 –volume
//c/mosquitto/config/mosquitto.conf:/mosquitto/config/mosquitto.conf eclipsemosquitto
docker run -it -p 1883:1883 –volume
c:\mosquitto\config\mosquitto.conf:/mosquitto/config/mosquitto.conf eclipsemosquitto
To run the client efrecon/mqtt-client you have to make sure you use the “host.docker.internal” or the
IP address 172.17.0.1 for the -h option. BE CAREFUL: localhost and 127.0.0.1 do not seem to work (You get a
bonus if you find out how to make them work!)
Example commands of suscribe/publish follow:
docker run -it –rm efrecon/mqtt-client sub -h host.docker.internal:1888 -t
“george” -v
docker run -it –rm efrecon/mqtt-client pub -h 172.17.0.1 -p 1883 -t “topic”
“message”
-m
To run docker in Python, a fully functional minimal code for running the Ubuntu docker follows (Notice that
there is also error handling which is highly suggested for easy debugging):
import docker
from docker.errors import DockerException
try:
client = docker.from_env()
client.containers.run(“ubuntu:latest”, “sleep infinity”, detach=False)
print(“All containers: “,client.containers.list())
print(“container id: “,container.id)
except (DockerException) as e:
print(str(e))
Resources:
• Python 3.10 standard library: https://docs.python.org/3/
• Docker: https://docs.docker.com/
• Docker Swarm: https://docs.docker.com/engine/swarm/
• Libraries for interacting with Docker from Python:
– docker-py: https://docker-py.readthedocs.io
– python-on-whales: https://gabrieldemarmiesse.github.io/python-on-whales/
Good luck…
4

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper
Still stressed from student homework?
Get quality assistance from academic writers!

Order your essay today and save 25% with the discount code LAVENDER