Part-DB

electronics
database
server
Docker
Hosting your own electronic parts data base in your homelab!
Author

ProtossGP32

Published

August 5, 2024

Introduction

According to Part-DB docs:

Part-DB is an Open-Source inventory management system for your electronic components. It is installed on a web server and so can be accessed with any browser without the need to install additional software.

Installation

Docker compose

Follow the instructions in this link to deploy the required services for part-db to run. By default, Part-DB will use an internal SQLite database, but this can be changed to MariaDB, MongoDB or PostgreSQL.

Docker compose
version: '3.3'
services:
  partdb:
    container_name: partdb
    # By default Part-DB will be running under Port 8080, you can change it here
    ports:
      - '8080:80'
    volumes:
      # By default
      - ./uploads:/var/www/html/uploads
      - ./public_media:/var/www/html/public/media
      - ./db:/var/www/html/var/db
    restart: unless-stopped
    image: jbtronics/part-db1:latest
    environment:
      # Put SQLite database in our mapped folder. You can configure some other kind of database here too.
      - DATABASE_URL=sqlite:///%kernel.project_dir%/var/db/app.db
      # In docker env logs will be redirected to stderr
      - APP_ENV=docker

      # You can configure Part-DB using environment variables
      # Below you can find the most essential ones predefined
      # However you can add any other environment configuration you want here
      # See .env file for all available options or https://docs.part-db.de/configuration.html
      # !!! Do not use quotes around the values, as they will be interpreted as part of the value and this will lead to errors !!!

      # The language to use serverwide as default (en, de, ru, etc.)
      - DEFAULT_LANG=en
      # The default timezone to use serverwide (e.g. Europe/Berlin)
      - DEFAULT_TIMEZONE=Europe/Berlin
      # The currency that is used inside the DB (and is assumed when no currency is set). This can not be changed later, so be sure to set it the currency used in your country
      - BASE_CURRENCY=EUR
      # The name of this installation. This will be shown as title in the browser and in the header of the website
      - INSTANCE_NAME=Part-DB

      # Allow users to download attachments to the server by providing an URL
      # This could be a potential security issue, as the user can retrieve any file the server has access to (via internet)
      - ALLOW_ATTACHMENT_DOWNLOADS=0
      # Use gravatars for user avatars, when user has no own avatar defined
      - USE_GRAVATAR=0

      # Override value if you want to show a given text on homepage.
      # When this is empty the content of config/banner.md is used as banner
      #- BANNER=This is a test banner<br>with a line break
    
      # If you use a reverse proxy in front of Part-DB, you must configure the trusted proxies IP addresses here (see reverse proxy documentation for more information):
      # - TRUSTED_PROXIES=127.0.0.0/8,::1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16

      # Part information providers
      ## LCSC: Unofficial API
      - PROVIDER_LCSC_ENABLED=1
      ## MOUSER: Request a Search API token here: https://www.mouser.es/MyMouser/MouserSearchApplication.aspx
      - PROVIDER_MOUSER_KEY=<your-search-api-token>
TODO

Create a Docker compose that uses PostgreSQL instead. Use the docker-compose.yaml example for MySQL database as a starting point.

Management

TODO

Document how to manage parts, users, suppliers, etc…

Enabling Information Providers

In order to use component information from providers, these must first be enabled through environment variables in your Docker Compose file.

LCSC

  • PROVIDER_LCSC_ENABLED=1: this allows Part-DB to use an unofficial API for searching components

MOUSER

  • PROVIDER_MOUSER_KEY=<your-search-api-token>: don’t mistake this API token with the Purchase/Order API token available from your Mouser’s User panel. In order to get the right token you must access this page:

    Mouser - User Panel: API search link

    Or you can directly go to the Search API register page:

    Mouser - API search register page

    Mouser will request you to fill a form and then it will send you a verification code; with this you’ll receive an API token.

    Once configured the environment variable and the container is recreated (docker compose up -d), you should be able to search for Mouser’s parts through keywords:

    Part-DB - Mouser API search example