Skip to content

Getting Started Inventory

dana-jpg edited this page May 3, 2024 · 1 revision

Setting up the Inventory Service involves several steps that ensure the service is ready for development and deployment.

Prerequisites

Ensure you have the following tools installed before you begin:

  1. Visual Studio Code (VSCode) - Preferred editor for managing and editing the code.
  2. Docker - Essential for creating and managing containers.
  3. Docker Compose - Used for defining and running multi-container Docker applications.
  4. Docker and Dev Containers Extensions for VSCode - Enhances the ability to work with Docker from within VSCode.

Installation

Follow these steps to set up the Inventory Service:

1. Clone the Repository

Start by cloning the repository to your local machine:

git clone https://github.com/SoftwareEngineering-E-Complish/inventory.git

2. Open the Project

Open the project folder in VSCode. If you are using the Dev Containers extension, VSCode may prompt you to reopen the project in a container, which you should accept.

3. Build and Run the Docker Container

In the terminal within VSCode, run the following command to build and start the Docker container. This command also detaches the container, allowing it to run in the background:

docker-compose up --build -d

4. Attach to the Running Container

Once the container is running, use the Attach to Running Container feature of VSCode to connect your editor to the Docker container. This step allows you to develop directly within the container environment.

Running the Service

With the Docker container up and running, the service is accessible via local development endpoints. The Inventory Service's API can be interacted with through:

Stopping the Service

To stop the Docker container and clean up the service, use the following command:

docker-compose down

Additional Setup

Initializing the DynamoDB Table

The service's database (DynamoDB) is initialized automatically via the start.sh script included in the Docker setup. This script runs every time the Docker container is started.

Installing Additional Extensions in VSCode

While attached to the container, you may install additional VSCode extensions that enhance the development experience, such as the Python extension pack.

Testing

To ensure that the Inventory Service functions correctly:

Run automated tests using:

pytest

Generate a code coverage report to assess test coverage:

coverage run -m pytest
coverage report -m

Following these steps will help you set up and begin working with the Inventory Service efficiently.

Clone this wiki locally