Skip to content

Deploying Part-DB

Introduction

Part-DB is a self-hosted web application for managing your electronic parts inventory. Designed for hobbyists, makerspaces, and small businesses, Part-DB helps you track components, manage stock levels, and organize your electronic parts library with professional-grade features.

Built with PHP and Symfony, Part-DB provides a modern, responsive interface that works across all devices. Whether you’re managing a small collection of components or a large inventory, Part-DB scales to meet your needs.

Key highlights of Part-DB:

  • Parts Management: Track electronic components with detailed specifications, datasheets, and images
  • Storage Locations: Organize parts by physical storage locations (bins, drawers, shelves)
  • Categories: Hierarchical category system for logical organization
  • Stock Tracking: Monitor inventory levels with minimum stock alerts
  • Manufacturers and Suppliers: Link parts to manufacturers and suppliers with ordering information
  • Attachments: Store datasheets, images, and documentation with parts
  • Barcodes and Labels: Generate and print labels with barcodes or QR codes
  • Multi-User Support: Role-based access control for team collaboration
  • Data Import/Export: CSV import/export and migration from other systems
  • Multi-Language: Available in multiple languages
  • Open Source: Licensed under AGPL-3.0

This guide walks through deploying Part-DB on Klutch.sh using Docker, configuring persistent storage, and setting up the application for production use.

Why Deploy Part-DB on Klutch.sh

Deploying Part-DB on Klutch.sh provides several advantages for inventory management:

Simplified Deployment: Klutch.sh automatically detects your Dockerfile and builds Part-DB without complex orchestration. Push to GitHub, and your inventory system deploys automatically.

Persistent Storage: Attach persistent volumes for your database and file uploads. Your inventory data survives container restarts and redeployments.

HTTPS by Default: Klutch.sh provides automatic SSL certificates, ensuring secure access to your inventory data.

Always Available: Access your parts inventory from anywhere, whether you’re at home, in the workshop, or ordering components.

Environment Variable Management: Securely store database credentials and application secrets through Klutch.sh’s environment variable system.

Custom Domains: Assign a memorable domain to your Part-DB instance.

Prerequisites

Before deploying Part-DB on Klutch.sh, ensure you have:

  • A Klutch.sh account
  • A GitHub account with a repository for your Part-DB configuration
  • Basic familiarity with Docker and containerization concepts
  • A MySQL or MariaDB database (can be deployed on Klutch.sh)

Preparing Your Repository

Create a GitHub repository containing your Dockerfile for Part-DB deployment.

Repository Structure

partdb-deploy/
├── Dockerfile
└── .dockerignore

Creating the Dockerfile

Create a Dockerfile in the root of your repository:

FROM jbtronics/part-db1:latest
# Set environment variables
ENV APP_ENV=prod
ENV DATABASE_URL=${DATABASE_URL}
ENV APP_SECRET=${APP_SECRET}
# Create directories for uploads and media
RUN mkdir -p /var/www/html/uploads /var/www/html/public/media
# Expose the web interface port
EXPOSE 80
# Use the default entrypoint from the base image

Creating the .dockerignore File

Create a .dockerignore file:

.git
.github
*.md
LICENSE
.gitignore
*.log
.DS_Store
.env
.env.local

Environment Variables Reference

VariableRequiredDefaultDescription
DATABASE_URLYes-Database connection string (mysql://user:pass@host/db)
APP_SECRETYes-Secret key for session and CSRF protection
APP_ENVNoprodApplication environment (prod, dev)
TRUSTED_PROXIESNo-Trusted proxy IP addresses
DEFAULT_LANGNoenDefault language
DEFAULT_TIMEZONENoUTCDefault timezone
BASE_CURRENCYNoEURBase currency for pricing

Deploying Part-DB on Klutch.sh

    Generate an App Secret

    Generate a secure secret key for your deployment:

    Terminal window
    openssl rand -hex 32

    Set Up MySQL/MariaDB Database

    Deploy a MySQL or MariaDB database on Klutch.sh or use an external database service. Create a database and note the connection URL.

    Push Your Repository to GitHub

    Initialize your repository and push to GitHub with your Dockerfile.

    Create a New Project on Klutch.sh

    Navigate to the Klutch.sh dashboard and create a new project. Give it a descriptive name like “partdb” or “parts-inventory”.

    Create a New App

    Within your project, create a new app. Connect your GitHub account if you haven’t already, then select the repository containing your Part-DB Dockerfile.

    Configure HTTP Traffic

    In the deployment settings:

    • Select HTTP as the traffic type
    • Set the internal port to 80

    Set Environment Variables

    Add the following environment variables:

    VariableValue
    DATABASE_URLmysql://user:password@host:3306/partdb
    APP_SECRETYour generated secret key
    DEFAULT_LANGen (or your preferred language)
    DEFAULT_TIMEZONEYour timezone (e.g., America/New_York)
    BASE_CURRENCYUSD (or your preferred currency)

    Attach Persistent Volumes

    Add the following volumes:

    Mount PathRecommended SizePurpose
    /var/www/html/uploads10 GBUser uploads and attachments
    /var/www/html/public/media5 GBGenerated media files

    Deploy Your Application

    Click Deploy to start the build process. Klutch.sh will:

    • Detect your Dockerfile automatically
    • Build the container image
    • Attach the persistent volumes
    • Start the Part-DB container
    • Provision an HTTPS certificate

    Access Part-DB

    Once deployment completes, access your Part-DB instance at https://your-app-name.klutch.sh. The default credentials are:

    • Username: admin
    • Password: admin

    Change the default password immediately after first login.

Initial Setup

First-Time Configuration

  1. Log in with the default admin credentials
  2. Change your password immediately
  3. Configure system settings in the admin panel
  4. Set up your storage location hierarchy
  5. Define part categories

Creating Storage Locations

Organize your physical storage:

  1. Navigate to Edit > Storage Locations
  2. Create a hierarchical structure (Room > Shelf > Drawer > Bin)
  3. Add descriptions and images for each location

Defining Categories

Set up part categories:

  1. Navigate to Edit > Categories
  2. Create categories like Resistors, Capacitors, ICs, Connectors
  3. Use subcategories for more granular organization

Using Part-DB

Adding Parts

  1. Click New Part in the navigation
  2. Fill in part details (name, description, category)
  3. Set storage location and stock quantity
  4. Add manufacturer and supplier information
  5. Upload datasheets and images
  6. Save the part

Managing Stock

  • Update quantities when parts are used or received
  • Set minimum stock levels for alerts
  • View parts below minimum stock in reports

Generating Labels

Part-DB can generate barcode labels:

  1. Select parts you want to label
  2. Choose Generate Labels
  3. Select label format and barcode type
  4. Print labels for your storage system

Searching Parts

  • Use the search bar for quick lookups
  • Filter by category, storage location, or manufacturer
  • Search by part parameters and specifications

Backup and Restore

Database Backup

Regularly backup your MySQL database:

  1. Use your database provider’s backup feature
  2. Export data through Part-DB’s export function
  3. Store backups securely off-site

File Backup

Backup your persistent volumes:

  • /var/www/html/uploads - User attachments
  • /var/www/html/public/media - Generated files

Additional Resources

Conclusion

Deploying Part-DB on Klutch.sh gives you a professional-grade electronic parts inventory system accessible from anywhere. The combination of Part-DB’s comprehensive features and Klutch.sh’s deployment simplicity means you can focus on your projects rather than inventory management infrastructure.

Whether you’re a hobbyist with a growing component collection or a makerspace managing shared inventory, Part-DB provides the tools you need to stay organized and never run out of essential components.