GithubHelp home page GithubHelp logo

e6156-microservice-1's Introduction

E6156 - Topics in SW Engineering: Cloud Computing
First Example Microservice

Author: Abhinav Gupta

Local Project Execution

Setup

  • The first step for local project execution is to create a virtual environment. This is a best practice for developing, testing and running multiple Python applications on a single system. There are many explanatiosn online for the benefits of virtual environments.

  • There are several approaches to creating a venv. I recommend setting up the environment using PyCharm's built in wizard/tools.

  • Activate the virtual environment. You can do this in PyCharm by opening a terminal window inside PyCharm. There should be a terminal tab at the bottom of the PyCharm window.

  • In the terminal, type pip install -r requirements.txt This will install the necessary Python packages.

  • You can now execute the application by using the run feature in PyCharm or directly from the terminal prompt line by typing python main.py

  • You will see an initialization (logging) messages followed by the message

 Uvicorn running on http://0.0.0.0:8012 (Press CTRL+C to quit)

Execution

  • Click on http://0.0.0.0:8012 link to open in the browser. You can also copy and past the link. You will see something of the form
Simple Execution
  • Accessing the URL http://0.0.0.0:8012/docs will navigate to the OpenAPI page/documentation for the application.

Modification

  1. Create a new GitHub project and clone the project.

  2. Change the name of the author in README.md

  3. Copy the code from this example into the directory for the project.

  4. Follow the steps for:
    1. Creating a virtual environment for your version of the project.
    2. pip installing requirements.txt
    3. Executing and accessing the application.
  5. In main.py, modify the line return {"message": f"Hello {name}"} to return a message of the form return {"message": f"Awesome cloud developer dff9 says Hello {name}"} Replace my uni with yours.
  6. Rerun the application to test.

Publish


Note:

  • The default behavior for virtual environment creation is to create the venv in the current folder/project.
  • You can create the venv anywhere on the file system.
  • You do not want to venv pushed to GitHub. So, if the venv is inside the project, remove the directory from the set of files that will be pushed. The easiest way is to add to a .gitignore file.


  • Commit and push your application to the GitHub repository.

  • You have completed the first part of the initial assignment.

e6156-microservice-1's People

Contributors

abhinavg97 avatar donald-f-ferguson avatar donff2j avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.