COMP7940 Cloud Computing
bash代做 | Cloud Computing | shell | Python | lab作业 – 这是一个关于Cloud 计算的题目, 主要考察了关于云计算的内容,是一个比较经典的题目, 涉及了bash/app/shell/Python等代写方面, 这个项目是lab代写的代写题目
COMP7940 Cloud Computing
2022/23 S2 lab 7 Dockerize
Objective:
Throughout this lab you will be able to:
Create a Docker container for your app.
Deploy the container to Heroku.
Introduction:
Some steps in this lab will not contain detailed instructions. You are supposed to work out those
details on your own. Meanwhile, we will show you the steps in details about how it is going to deploy the container to Heroku.
You are advised to refer to the lecture notes 6 and 7 to get familiar with docker commands. Of course, make sure you got Docker installed properly. Make sure you have also signed up in
hub.docker.com.
Part 1: Building a container
A) Using docker run
- Stop the chatbot service on Heroku through the dashboard. Verify the service is stopped by looking at the log and talking to the chatbot.
- Run a container from the image Python in detached mode.
- Name this container mycontainer using docker rename if you forget to do it in step 2.
- Copy your lab6 chatbot.py, requirements.txt to the container, under the root directory /. This can be done via:
- Execute the following line inside the container
docker cp chatbot.py mycontainer:/
docker cp requirements.txt mycontainer:/
You can do it by either launching a new interactive shell 代做 script代写"> bash shell in the container or execute
these commands using docker exec directly.
- Commit your image to the name 7940image.
- Run the docker container from the image 7940image by the following command
Make sure you know how to fill in the values of those ACCESS_TOKEN, HOST, PASSWORD
REDISPORT.
8. Check the logs of the container lab7partA and test it on telegram again. It should work.
9. Stop and remove the containers mycontainer and lab7partA.
B) Using Dockerfile
1. Create a dockerfile under the same directory. The dockerfile should repeat the steps
stated in part A, i.e.
Use the image python
Copy the files chatbot.py and requirements.txt to the container
Install the dependency using the two pip install statements.
Set the environment variables ACCESS_TOKEN, HOST, PASSWORD REDISPORT
Set the ENTRYPOINT and/or CMD correctly so that it will execute python chatbot.py
2. Build the image using docker build -t 7940image.
3. Run the image using docker run –name lab7partB -d 7940image2.
4. Check the log of this container and test it with telegram again.
Part 2: Deploy to Heroku as a container
Assume that your container developed in Part 1B is ready, we can push it to heroku via the follow-
ing commands (replace comp7940chatbot with your heroku app)
Make sure you have stopped any running chatbot and have enabled your chatbot.
Notice that the environment variable should have defined in your Heroku app already (see lab5).
Therefore, it is not necessary for you to define your environment variable in Dockerfile any more.
Writeup
pip install pip update
pip install -r requirements.txt
docker run --name lab7partA -d --env ACCESS_TOKEN=163... --env HOST="redis-
11363.c1..." --env PASSWORD="1nOA..." --env REDISPORT=12345 7940image python
chatbot.py
####### heroku container:login
####### heroku container:push worker -a comp7940chatbot
####### heroku container:release worker -a comp7940chatbot
Please write down all commands that you have entered for Part 1 and the content of the
dockerfile that you have created for Part 1B. You will need to submit those together with the next
lab.