NotePublic/Software/Applications/Part-DB/Part-DB_安装及使用.md

123 lines
5.0 KiB
Markdown
Raw Normal View History

# Part-DB 安装及使用
Part-DB 是比较实用的元器件进销存 Web 系统,支持实用电脑摄像头扫码(条码和二维码)。
## 1. 安装
大部分按照 [官方安装指导](https://docs.part-db.de/installation/installation_docker.html) 来安装即可。
1. Install docker and docker-compose
2. Create a folder where the Part-DB data should live
```bash
mkdir Part-DB
cd Part-DB
mkdir db public_media uploads
touch docker-compose.yaml
```
3. 编辑 docker-compose.yaml 内容如下(对官网参考进行了定制):
```yaml
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:1.11
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=zh
# The default timezone to use serverwide (e.g. Europe/Berlin)
- DEFAULT_TIMEZONE=Asia/Shanghai
# 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=1
# 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
```
4. 实用 docker 命令进行构建:
```bash
docker-compose up -d
```
5. 初始化数据库:
```bash
# 进入容器
docker exec -it --user=www-data partdb /bin/bash
# 在容器内执行
php bin/console doctrine:migrations:migrate
```
6. 等待输出密码后退出容器,之后实用浏览器访问 http://localhost:8080 即可:
```bash
[warning] The initial password for the "admin" user is: xxxxxxxxxx
```
### 1.1. 特殊说明
DEFAULT_LANG 可选en、zh、de、it、fr、ru、ja、cs、da
[DEFAULT_TIMEZONE 参考](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#SHANGHAI)
BASE_CURRENCY 不要修改,保持 EUR因为其他币种需要在服务启动后通过 WebUI 创建,若此时进行了修改则导致服务无法正确执行。
初始化数据库时不要在容器外执行,要进入到容器中,因为会有警告提示及 Yes/No 选择,如果在容器外执行则默认选择 No导致执行中断。
许多功能依赖于安全的网络传输,比如摄像头扫码功能,因此需要通过反向代理或 REDIRECT_TO_HTTPS 激活 HTTPS 协议。
## 2. Part-DB 使用说明
扫码支持 IPN条码 和 供应商条形码(配置于部件批次) 等的识别,识别后将自动跳转到对应的元件。
IPN条码 在 元件->高级->内部零件号(IPN) 中设置。
供应商条形码 在 元件->库存->展开高级选项->供应商条形码 中设置。
元件增加了仓库和库存后才可以按批次入库出库。
Part-DB 还可以与 KiCAD 等 EDA 结合使用,[官方说明在此](https://docs.part-db.de/usage/eda_integration.html)。
## 外部参考资料
1. [Part-DB Github](https://github.com/Part-DB)
2. [Part-DB Doc](https://docs.part-db.de/)
3. [Part-DB Demo](https://part-db.herokuapp.com/en/)
4. [Part-DB Docker](https://hub.docker.com/r/jbtronics/part-db1)