This guide provides detailed installation instructions for setting up Forge on various platforms.
Before installing Forge, ensure you have the following:
- Python 3.8+ installed
- pip (Python package manager)
- git for cloning the repository
- Docker (optional, for containerized installation)
The quickest way to get started with Forge is to use the provided setup script:
-
Clone the repository:
git clone https://github.com/yourusername/forge.git cd forge -
Run the setup script:
chmod +x setup.sh ./setup.sh
-
Start the server:
python run.py
The setup script performs the following actions:
- Creates a Python virtual environment
- Installs all required dependencies
- Creates a
.envfile from.env.example - Generates secure random keys for encryption and JWT
- Runs database migrations
- Sets up the initial database structure
If you prefer more control over the installation process, follow these steps:
-
Clone the repository:
git clone https://github.com/yourusername/forge.git cd forge -
Create a virtual environment:
python -m venv venv
-
Activate the virtual environment:
- On Linux/macOS:
source venv/bin/activate - On Windows:
venv\Scripts\activate
- On Linux/macOS:
-
Install dependencies:
pip install -r requirements.txt
-
Create a
.envfile:cp .env.example .env
-
Generate secure keys:
python -c "import os; from base64 import b64encode; print(f'API_KEY_ENCRYPTION_KEY={b64encode(os.urandom(32)).decode()}')" python -c "import os; from base64 import b64encode; print(f'JWT_SECRET_KEY={b64encode(os.urandom(32)).decode()}')"
-
Add the generated keys to your
.envfile. -
Run database migrations:
alembic upgrade head
-
Start the server:
python run.py
or
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
For a containerized deployment:
-
Clone the repository:
git clone https://github.com/yourusername/forge.git cd forge -
Build and start with Docker Compose:
docker-compose up -d
-
To view logs:
docker-compose logs -f
-
To stop the service:
docker-compose down
For Debian/Ubuntu-based distributions:
-
Install system dependencies:
sudo apt update sudo apt install -y python3 python3-pip python3-venv git
-
Follow the Manual Installation or Quick Setup Script instructions.
-
Install Homebrew if not already installed:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" -
Install Python and Git:
brew install python git
-
Follow the Manual Installation or Quick Setup Script instructions.
-
Install Python from the official website.
-
Install Git from the official website.
-
Open Command Prompt or PowerShell and follow the Manual Installation steps, with these Windows-specific adjustments:
-
Clone the repository:
git clone https://github.com/yourusername/forge.git cd forge -
Create and activate a virtual environment:
python -m venv venv venv\Scripts\activate -
Continue with the rest of the manual installation steps.
-
To verify that Forge is installed and running correctly:
-
Open a web browser and navigate to:
http://localhost:8000/docsYou should see the Swagger UI API documentation.
-
Test with the CLI tool:
./forge-cli.py interactive
You should see the interactive menu prompting you for actions.
Problem: ModuleNotFoundError when running the application.
Solution: Ensure the virtual environment is activated and all dependencies are installed:
source venv/bin/activate # On Linux/macOS
venv\Scripts\activate # On Windows
pip install -r requirements.txtProblem: Database migration errors.
Solution: Try resetting the migrations and starting from scratch:
rm -rf migrations # Be cautious with this command!
alembic init migrations
alembic revision --autogenerate -m "Initial migration"
alembic upgrade headProblem: Permission errors when running the setup script.
Solution: Ensure the script is executable:
chmod +x setup.shProblem: API key encryption errors.
Solution: Check that your .env file contains valid base64-encoded encryption keys:
python -c "import os; from base64 import b64encode; print(f'API_KEY_ENCRYPTION_KEY={b64encode(os.urandom(32)).decode()}')"
python -c "import os; from base64 import b64encode; print(f'JWT_SECRET_KEY={b64encode(os.urandom(32)).decode()}')"If you encounter issues not covered by this guide:
- Check the GitHub Issues to see if others have faced the same problem.
- Search for similar problems in the project discussions.
- Open a new issue if your problem hasn't been addressed yet.
After installation, refer to:
- User Guide for instructions on using Forge
- Contributing Guide if you want to contribute to the project
- API Documentation for API details