-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMicroservice Python.txt
More file actions
88 lines (51 loc) · 3.52 KB
/
Microservice Python.txt
File metadata and controls
88 lines (51 loc) · 3.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
File structure for Software enginerring project :
> Make File
> requirement.txt
> source code
> test
> docker
[](https://github.com/gafar8281/Microservices-Python-Project/actions/workflows/devops.yml)
[
SWE Project :
> created a virtual ven "virtualenv ~/.venv"
> create file requirement.txt, make file, docker file, python file . using "touch" command.
> Makefile is to automate the commands. It is used in SWE projets.
17/03
> packages installed = wikipedia, pytest, pytest-cov(give result how many codes we are covered),pylint, black (code formating tool), fire.
> install all package through make file 'make install'. Specifying each package with version number( to make sure project run after 2 years also) 'pip freeze | less'
> created a Automatic work flow using Github actions. When a commit happen in this file CI with automatically trigger. Created a status badge and pasted on readme file.
18/03
> format code before pushing to production. To avoid formatting error.
> lint is used to find bad code, that tipically throw error in future development. So, using lint can be helpfull.
> If there is any error, eg: error in lint . CI will throw error during build.
> created test cases for script file.
21/03
> Build cli using python fire library. It make easier to run and manage scripts, pass arguments, and execute functions directly from the terminal. Giving permission "chmod +x cli-fire.py" .
> "./cli-fire.py --help" , "./cli-fire.py --name Barack_Obama"
> "./cli-fire.py" run command
> ipython library used to run pyhton code in command line. Use to test function & handy tool.
> Created a new function to search in wikipedia by name.
> Created a webservice using Fastapi and created api endpoints. Written test cases for FastAPI endpoints.
> Created a new NLP function in script. To find the phrases
24/03
> Created test cases for fast API web app.
> Created a docker image for Fast api and run the docker image.
> Docker file :
Python slim is small image.
> Docker commands :
"docker build . " - build image or "docker build -t deploy-fastapi ." - build image with title.
"docker run -p 127.0.0.1:8080:8080 c1a36ab4da9d" - run image
"docker image ls" - list images
"docker ps -a" - list conatiners
> "make build" to build image & make run
28/03
> Deploying application on aws. Using Code build, ECR, App runner.
> Created a repository inside AWS ECR and copy the auth code and paste inside make deploy.
code contain authenticate, build, tag image and push.
> Code build - same as github action for CI.
created a buildspec.yml to manage commands same as github actions. Execute start build
> If Code build succed image will automatically updated inside ECR. Now we got container inside ECR Continous Deliver (CD).
>Now we can diploy Containers in various methods : EC2, App runner etc.
> Here we use App runner (PaaS). Any new changes come in ECR , App runner will automatically detect and deploy the application.
> Continous Integration (CI) / Continous Deployment (CD)
🎉🎉🎉 Python - Microservice - CI/CD - Project Completed 🎉🎉🎉🎉