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└── .dockerignoreCreating the Dockerfile
Create a Dockerfile in the root of your repository:
FROM jbtronics/part-db1:latest
# Set environment variablesENV APP_ENV=prodENV DATABASE_URL=${DATABASE_URL}ENV APP_SECRET=${APP_SECRET}
# Create directories for uploads and mediaRUN mkdir -p /var/www/html/uploads /var/www/html/public/media
# Expose the web interface portEXPOSE 80
# Use the default entrypoint from the base imageCreating the .dockerignore File
Create a .dockerignore file:
.git.github*.mdLICENSE.gitignore*.log.DS_Store.env.env.localEnvironment Variables Reference
| Variable | Required | Default | Description |
|---|---|---|---|
DATABASE_URL | Yes | - | Database connection string (mysql://user:pass@host/db) |
APP_SECRET | Yes | - | Secret key for session and CSRF protection |
APP_ENV | No | prod | Application environment (prod, dev) |
TRUSTED_PROXIES | No | - | Trusted proxy IP addresses |
DEFAULT_LANG | No | en | Default language |
DEFAULT_TIMEZONE | No | UTC | Default timezone |
BASE_CURRENCY | No | EUR | Base currency for pricing |
Deploying Part-DB on Klutch.sh
- Select HTTP as the traffic type
- Set the internal port to 80
- Detect your Dockerfile automatically
- Build the container image
- Attach the persistent volumes
- Start the Part-DB container
- Provision an HTTPS certificate
- Username:
admin - Password:
admin
Generate an App Secret
Generate a secure secret key for your deployment:
openssl rand -hex 32Set 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:
Set Environment Variables
Add the following environment variables:
| Variable | Value |
|---|---|
DATABASE_URL | mysql://user:password@host:3306/partdb |
APP_SECRET | Your generated secret key |
DEFAULT_LANG | en (or your preferred language) |
DEFAULT_TIMEZONE | Your timezone (e.g., America/New_York) |
BASE_CURRENCY | USD (or your preferred currency) |
Attach Persistent Volumes
Add the following volumes:
| Mount Path | Recommended Size | Purpose |
|---|---|---|
/var/www/html/uploads | 10 GB | User uploads and attachments |
/var/www/html/public/media | 5 GB | Generated media files |
Deploy Your Application
Click Deploy to start the build process. Klutch.sh will:
Access Part-DB
Once deployment completes, access your Part-DB instance at https://your-app-name.klutch.sh. The default credentials are:
Change the default password immediately after first login.
Initial Setup
First-Time Configuration
- Log in with the default admin credentials
- Change your password immediately
- Configure system settings in the admin panel
- Set up your storage location hierarchy
- Define part categories
Creating Storage Locations
Organize your physical storage:
- Navigate to Edit > Storage Locations
- Create a hierarchical structure (Room > Shelf > Drawer > Bin)
- Add descriptions and images for each location
Defining Categories
Set up part categories:
- Navigate to Edit > Categories
- Create categories like Resistors, Capacitors, ICs, Connectors
- Use subcategories for more granular organization
Using Part-DB
Adding Parts
- Click New Part in the navigation
- Fill in part details (name, description, category)
- Set storage location and stock quantity
- Add manufacturer and supplier information
- Upload datasheets and images
- 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:
- Select parts you want to label
- Choose Generate Labels
- Select label format and barcode type
- 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:
- Use your database provider’s backup feature
- Export data through Part-DB’s export function
- 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
- Part-DB GitHub Repository
- Part-DB Documentation
- Part-DB Demo Instance
- Klutch.sh Persistent Volumes
- Klutch.sh Deployments
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.