Skip to content

Setup Guide

This guide will walk you through the process of setting up the Loryth CMS service for development and testing.

Prerequisites

Before you begin, ensure you have the following installed: - Python 3.13 - Docker and Docker Compose - Make

Setup Steps

1. Setup Virtual Environment

To set up the development environment, run:

make setup

This command will: - Create a Python virtual environment in .venv - Install all required dependencies

Syncing Dependencies

To update your dependencies to the latest compatible versions:

make sync

Cleaning the Environment

To remove the virtual environment and start fresh:

make clean

2. Code Quality Tools

Running All Linters

make lint

This runs both Ruff and Mypy checks.

Specific Linting Tools

  • Ruff linting:
    make ruff-lint
    
  • Mypy type checking:
    make mypy-lint
    

Auto-formatting

To format your code:

make format

To automatically fix common issues:

make fix

3. Testing

Run the test suite with:

make test

This will: - Clear the pytest cache - Run all tests in the tests directory - Show test duration information

4. Running the Service

Development Server

To start the development server:

make dev

This will launch the FastAPI development server with the IAM API application.

6. Docker Environment

Starting Docker Services

make docker-up

This command will: - Start all required Docker containers - Wait for services to be ready - Run database migrations

Stopping Docker Services

make docker-down

This will stop all containers and remove volumes.

Database Access

To access the PostgreSQL database:

make docker-db

This opens a PostgreSQL interactive terminal connected to the IAM database.

Project Structure

The service is organized with the following directory structure: - - Source code src/ - tests/ - Test files - .venv/ - Python virtual environment (created during setup)

Common Issues and Troubleshooting

  1. If make setup fails:

    • Ensure Python 3.13 is installed and accessible
    • Check if you have sufficient permissions to create virtual environments
  2. If Docker services fail to start:

    • Verify Docker and Docker Compose are running
    • Check if required ports are available
    • Review Docker logs for specific error messages
  3. If database migrations fail:

    • Ensure the PostgreSQL container is running
    • Check database connection settings
    • Verify migration files are present

Next Steps

After completing the setup: 1. Review the API documentation 2. Explore the source code in the src directory 3. Start writing tests in the tests directory 4. Set up your IDE with the virtual environment

For more detailed information about specific components, refer to the respective documentation sections.