paperless_ngx.paperless_ngx
状态 | 事件 |
---|---|
每周计划 | |
最近的拉取请求 |
Ansible角色:paperless_ngx
安装和配置paperless-ngx电子文档管理系统(EDMS)。
-
- 2.1. 角色特定变量
- 2.2. Paperless-ngx配置变量
-
- 3.1. 更新Paperless-ngx
- 3.2. 备份/恢复
- 3.3. 生成的密码
- 3.4. 静态(~ 安装)和动态(~ 运行时)数据的分离
- 3.5. PostgreSQL使用
1. 要求
1.1. Ansible
需要ansible_version_minimum: "2.12"
或更新版本。
需要安装以下Ansible集合(通过ansible-galaxy collection install
):
- community.general
- ansible.posix
1.2. 支持的操作系统
- Debian (>=11)
- Ubuntu (>=focal)
2. 角色变量
paperless-ngx本身的大部分配置变量都可用,并接受其相应的参数。
每个PAPERLESS_*
配置变量都为小写,并在defaults/main.yml
中前缀为paperless_ngx_conf_*
。
有关完整列表,包括解释和允许的值,请参见当前的文档。
以下部分分为:
- 角色特定变量
- 原始paperless-ngx配置变量
2.1. 角色特定变量
名称 | 默认值 | 描述 |
---|---|---|
paperless_ngx_db_type |
sqlite | 可用的数据库类型有sqlite和postgresql。如果选择postgresql,则必须配置其他db_变量。 |
paperless_ngx_dependency_install_tmp_dir |
/tmp/ | 临时依赖安装文件的目录 |
paperless_ngx_dir_force_permission_exclude |
[] | 应跳过哪几个目录的权限检查/设置。参见文档。 |
paperless_ngx_dir_installation |
/opt/paperless-ngx | paperless-ngx静态安装文件写入的目录。 |
paperless_ngx_dir_python |
/opt/python/{{ paperless_ngx_python_version_short }} | Python二进制文件编译的目录。 |
paperless_ngx_dir_runtime_data |
/var/lib/paperless-ngx | 存储运行时数据的目录。 |
paperless_ngx_dir_virtualenv |
"{{ paperless_ngx_dir_installation }}/.venv" | 所需Python虚拟环境的目录。 |
paperless_ngx_jbig2enc_enabled |
true | 是否安装和使用jbig2enc进行OCRmyPDF。 |
paperless_ngx_jbig2enc_lossy |
false | 是否以有损模式运行jbig2enc。 |
paperless_ngx_jbig2enc_version |
0.29 | 要安装的版本。 |
paperless_ngx_redis_host |
localhost | Redis主机 |
paperless_ngx_redis_port |
6379 | Redis端口 |
paperless_ngx_system_group |
paperlessngx | 系统用户所属的组。 |
paperless_ngx_system_user |
paperlessngx | 将执行服务并拥有数据的用户。 |
paperless_ngx_system_user_additional_groups |
[] | 可选,向系统用户添加更多组。例如,读取组ssl-cert 可以读取的TLS证书。 |
paperless_ngx_version |
latest | 要安装的软件版本。使用latest 或任何格式为'2.0.0' 的特定版本。仅支持paperless_ngx_version_minimum: '2.0.0' 及更高版本。 |
`` |
2.2. Paperless-ngx配置变量
接下来的变量都对应于paperless-ngx文档中的变量。以下变量列表按字母顺序排列,以简化该角色的维护。在官方文档中,这些变量被分配到相应的类别。
为节省阅读空间,下面的表格中使用了一些缩写:
- I - 是否在此角色中实现? [Y/N]
- O - 变量是否被打算覆盖? [Y/N] 如果为否,则不应更改。
- H - 提示
- V - 引入此变量的paperless-ngx版本。
名称 | 默认值 | I | O | H | V |
---|---|---|---|---|---|
paperless_ngx_conf_account_allow_signups |
false | Y | Y | 2.5 | |
paperless_ngx_conf_account_default_http_protocol |
https | Y | Y | 2.5 | |
paperless_ngx_conf_account_email_verification |
optional | Y | Y | 2.6 | |
paperless_ngx_conf_account_session_remember |
false | Y | Y | 2.7 | |
paperless_ngx_conf_admin_mail |
root@localhost | Y | Y | ||
paperless_ngx_conf_admin_password |
Y | Y | 超级用户密码。如果用户未定义,则将生成一个随机密码 -> 参见下面关于密码的部分。 | ||
paperless_ngx_conf_admin_user |
admin | Y | Y | ||
paperless_ngx_conf_allowed_hosts |
"*" | Y | Y | ||
paperless_ngx_conf_app_logo |
None | Y | Y | 2.4 | |
paperless_ngx_conf_app_title |
None | Y | Y | 2.4 | |
paperless_ngx_conf_apps |
None | Y | Y | 2.5 | |
paperless_ngx_conf_audit_log_enabled |
false | Y | Y | 2.0 | |
paperless_ngx_conf_auto_login_username |
"" | Y | Y | ||
paperless_ngx_conf_bind_addr |
"[::]" | Y | Y | ||
paperless_ngx_conf_consumer_asn_barcode_prefix |
ASN | Y | Y | 1.12 | |
paperless_ngx_conf_consumer_collate_double_sided_subdir_name |
"double-sided" | Y | Y | 1.17 | |
paperless_ngx_conf_consumer_collate_double_sided_tiff_support |
false | Y | Y | 1.17 | |
paperless_ngx_conf_consumer_barcode_dpi |
300 | Y | Y | 1.16 | |
paperless_ngx_conf_consumer_barcode_scanner |
"PYZBAR" | Y | Y | 1.14 | |
paperless_ngx_conf_consumer_barcode_string |
'PATCHT' | Y | Y | ||
paperless_ngx_conf_consumer_barcode_tiff_support |
false | Y | Y | ||
paperless_ngx_conf_consumer_barcode_upscale |
0.0 | Y | Y | 1.16 | |
paperless_ngx_conf_consumer_delete_duplicates |
false | Y | Y | ||
paperless_ngx_conf_consumer_enable_asn_barcode |
false | Y | Y | 1.12 | |
paperless_ngx_conf_consumer_enable_barcodes |
false | Y | Y | ||
paperless_ngx_conf_consumer_enable_collate_double_sided |
false | Y | Y | 1.17 | |
paperless_ngx_conf_consumer_enable_tag_barcode |
false | Y | Y | 2.5 | |
paperless_ngx_conf_consumer_ignore_patterns |
[".DS_STORE/", "._", ".stfolder/", ".stversions/", ".localized/*", "desktop.ini"] | Y | Y | ||
paperless_ngx_conf_consumer_inotify_delay |
0.5 | Y | Y | ||
paperless_ngx_conf_consumer_polling_delay |
5 | Y | Y | ||
paperless_ngx_conf_consumer_polling_retry_count |
5 | Y | Y | ||
paperless_ngx_conf_consumer_polling |
0 | Y | Y | ||
paperless_ngx_conf_consumer_recursive |
false | Y | Y | ||
paperless_ngx_conf_consumer_subdirs_as_tags |
false | Y | Y | ||
paperless_ngx_conf_consumer_tag_barcode_mapping |
'{"TAG:(.*)": "\\g<1>"}' | Y | Y | 2.5 | |
paperless_ngx_conf_consumption_dir |
"{{ paperless_ngx_dir_runtime_data }}/consumption" | Y | Y | ||
paperless_ngx_conf_convert_binary |
convert | Y | Y | ||
paperless_ngx_conf_convert_memory_limit |
0 | Y | Y | ||
paperless_ngx_conf_convert_tmpdir |
"" | Y | Y | ||
paperless_ngx_conf_cookie_prefix |
"" | Y | Y | ||
paperless_ngx_conf_cors_allowed_hosts |
http://localhost:8000 | Y | Y | ||
paperless_ngx_conf_csrf_trusted_origins |
Y | Y | |||
paperless_ngx_conf_data_dir |
"{{ paperless_ngx_dir_runtime_data }}/data" | Y | Y | ||
paperless_ngx_conf_date_order |
"DMY" | Y | Y | ||
paperless_ngx_conf_db_timeout |
Y | Y | |||
paperless_ngx_conf_dbengine |
Y | N | 不被角色使用 | ||
paperless_ngx_conf_dbhost |
localhost | Y | Y | ||
paperless_ngx_conf_dbname |
paperlessngx | Y | Y | ||
paperless_ngx_conf_dbpass |
"" | Y | Y | 数据库密码。如果用户未定义,则将生成一个随机密码 -> 参见下面关于密码的部分。 | |
paperless_ngx_conf_dbport |
5432 | Y | Y | ||
paperless_ngx_conf_dbsslcert |
None | Y | Y | 1.14 | |
paperless_ngx_conf_dbsslkey |
None | Y | Y | 1.14 | |
paperless_ngx_conf_dbsslmode |
prefer | Y | Y | ||
paperless_ngx_conf_dbsslrootcert |
None | Y | Y | 1.14 | |
paperless_ngx_conf_dbuser |
paperlessngx | Y | Y | ||
paperless_ngx_conf_disable_regular_login |
false | Y | Y | 2.6 | |
paperless_ngx_conf_email_certificate_location |
None | Y | Y | 1.17 | |
paperless_ngx_conf_email_from |
{{ paperless_ngx_conf_email_host_user }} | Y | Y | 2.0 | |
paperless_ngx_conf_email_host |
"localhost" | Y | Y | 2.0 | |
paperless_ngx_conf_email_host_user |
"" | Y | Y | 2.0 | |
paperless_ngx_conf_email_host_password |
"" | Y | Y | 2.0 | |
paperless_ngx_conf_email_port |
25 | Y | Y | 2.0 | |
paperless_ngx_conf_email_task_cron |
"*/10 * * * *" | Y | Y | 1.12 | |
paperless_ngx_conf_email_use_ssl |
false | Y | Y | 2.0 | |
paperless_ngx_conf_email_use_tls |
false | Y | Y | 2.0 | |
paperless_ngx_conf_empty_trash_delay |
30 | Y | Y | 2.10 | |
paperless_ngx_conf_empty_trash_dir |
"{{ paperless_ngx_dir_runtime_data }}/trash" | Y | Y | 2.10 | |
paperless_ngx_conf_empty_trash_task_cron |
"0 1 * * *" | Y | Y | 2.10 | |
paperless_ngx_conf_enable_compression |
true | Y | Y | 1.13 | |
paperless_ngx_conf_enable_flower |
false | Y | Y | 是否启动flower。有关更多信息,请参见使用flower | 1.10 |
paperless_ngx_conf_enable_http_remote_user |
false | Y | Y | ||
paperless_ngx_conf_enable_http_remote_user_api |
false | Y | Y | 2.5 | |
paperless_ngx_conf_enable_nltk |
1 | Y | Y | 1.11 | |
paperless_ngx_conf_enable_update_check |
Y | Y | 日后将被移除 | ||
paperless_ngx_conf_filename_date_order |
"" | Y | Y | ||
paperless_ngx_conf_filename_format_remove_none |
false | Y | Y | ||
paperless_ngx_conf_filename_format |
"" | Y | Y | ||
paperless_ngx_conf_force_script_name |
"" | Y | Y | ||
paperless_ngx_conf_gs_binary |
gs | Y | Y | ||
paperless_ngx_conf_http_remote_user_header_name |
HTTP_REMOTE_USER | Y | Y | ||
paperless_ngx_conf_ignore_dates |
"" | Y | Y | ||
paperless_ngx_conf_index_task_cron |
"0 0 * * *" | Y | Y | 1.12 | |
paperless_ngx_conf_logging_dir |
"{{ paperless_ngx_dir_runtime_data }}/log" | ||||
paperless_ngx_conf_logout_redirect_url |
Y | Y | |||
paperless_ngx_conf_logrotate_max_backups |
20 | Y | Y | ||
paperless_ngx_conf_logrotate_max_size |
1024 * 1024 | Y | Y | ||
paperless_ngx_conf_max_image_pixels |
None | Y | Y | 2.6 | |
paperless_ngx_conf_media_root |
"{{ paperless_ngx_dir_runtime_data }}/media" | Y | Y | ||
paperless_ngx_conf_model_file |
"{{ paperless_ngx_conf_data_dir }}/classification_model.pickle" | Y | Y | 2.9 | |
paperless_ngx_conf_nltk_dir |
/usr/share/nltk_data | Y | Y | 1.11 | |
paperless_ngx_conf_number_of_suggested_dates |
3 | Y | Y | ||
paperless_ngx_conf_ocr_clean |
clean | Y | Y | ||
paperless_ngx_conf_ocr_color_conversion_strategy |
"RGB" | Y | Y | 2.1 | |
paperless_ngx_conf_ocr_deskew |
true | Y | Y | ||
paperless_ngx_conf_ocr_image_dpi |
"" | Y | Y | ||
paperless_ngx_conf_ocr_language |
eng | Y | Y | ||
paperless_ngx_conf_ocr_languages |
[eng,deu,fra,ita,spa] | Y | Y | ||
paperless_ngx_conf_ocr_max_image_pixels |
Y | Y | |||
paperless_ngx_conf_ocr_mode |
skip | Y | Y | ||
paperless_ngx_conf_ocr_output_type |
pdfa | Y | Y | ||
paperless_ngx_conf_ocr_pages |
0 | Y | Y | ||
paperless_ngx_conf_ocr_rotate_pages_threshold |
12 | Y | Y | ||
paperless_ngx_conf_ocr_rotate_pages |
true | Y | Y | ||
paperless_ngx_conf_ocr_skip_archive_file |
"never" | Y | Y | 1.14 | |
paperless_ngx_conf_ocr_user_args |
[optimize=1] | Y | Y | ||
paperless_ngx_conf_port |
8000 | Y | Y | ||
paperless_ngx_conf_post_consume_script |
"" | Y | Y | ||
paperless_ngx_conf_pre_consume_script |
"" | Y | Y | ||
paperless_ngx_conf_proxy_ssl_header |
None | Y | Y | 1.14 | |
paperless_ngx_conf_redis |
redis://{{ paperless_ngx_redis_host }}:{{ paperless_ngx_redis_port }} | Y | N | ||
paperless_ngx_conf_redis_prefix |
"" | Y | Y | 1.17 | |
paperless_ngx_conf_sanity_task_cron |
"30 0 * * sun" | Y | Y | 1.12 | |
paperless_ngx_conf_secret_key |
"" | Y | Y | 如果未定义,则将生成一个随机密码 -> 参见下面关于密码的部分。 | |
paperless_ngx_conf_social_auto_signup |
false | Y | Y | 2.5 | |
paperless_ngx_conf_socialaccount_allow_signups |
true | Y | Y | 2.5 | |
paperless_ngx_conf_socialaccount_providers |
"{}" | Y | Y | 2.5 | |
paperless_ngx_conf_static_url |
/static/ | Y | Y | ||
paperless_ngx_conf_staticdir |
../static | Y | N | ||
paperless_ngx_conf_supervisord_working_dir |
None | Y | Y | 2.5 | |
paperless_ngx_conf_task_workers |
1 | Y | Y | ||
paperless_ngx_conf_threads_per_worker |
paperless_ngx_conf_task_workers | Y | Y | ||
paperless_ngx_conf_thumbnail_font_name |
/usr/share/fonts/liberation/LiberationSerif-Regular.ttf | Y | Y | ||
paperless_ngx_conf_tika_enabled |
false | Y | Y | ||
paperless_ngx_conf_tika_endpoint |
http://localhost:9998 | Y | Y | ||
paperless_ngx_conf_tika_gotenberg_endpoint |
http://localhost:3000 | Y | Y | ||
paperless_ngx_conf_time_zone |
Europe/London | Y | Y | ||
paperless_ngx_conf_train_task_cron |
"5 */1 * * *" | Y | Y | 1.12 | |
paperless_ngx_conf_trusted_proxies |
"" | Y | Y | 1.14 | |
paperless_ngx_conf_url |
http://localhost:8000 | Y | Y | ||
paperless_ngx_conf_use_x_forward_host |
False | Y | Y | 1.14 | |
paperless_ngx_conf_use_x_forward_port |
False | Y | Y | 1.14 | |
paperless_ngx_conf_usermap_gid |
Y | Y | 系统用户gid | ||
paperless_ngx_conf_usermap_uid |
Y | Y | 系统用户id | ||
paperless_ngx_conf_webserver_workers |
1 | Y | Y | ||
paperless_ngx_conf_worker_timeout |
1800 | Y | Y | ||
3. 使用建议
3.1. 更新Paperless-ngx
如果您通过此角色安装了Paperless-ngx,并且想要更新到更新版本,则只需再次运行此角色(如果您选择latest
作为版本标识符)。如果您指定了要安装的特定版本,则只需将该值更改为更新版本并再次运行角色即可。
此角色不会更新其他任何内容,除了Paperless-ngx。因此,操作系统和依赖包的更新需要单独处理。
升级前请务必考虑备份。
3.2. 备份/恢复
请注意,此角色不提供任何备份或恢复机制。这是有意为之。为了解决这个问题,这个角色仅专注于软件工件及其配置的“部署”。可以在这里找到有效备份策略示例:链接到备份策略示例
3.3. 生成的密码
此角色使用Ansible的密码查找功能:
- 如果角色生成密码,ansible将其本地存储在**pngx_instances/{{ incentory_hostname }}/**(相对于工作目录)
- 如果文件已存在,则将重用其内容
- 有关更多信息,请参见ansible密码查找文档
3.4. 静态(~ 安装)和动态(~ 运行时)数据的分离
该角色检查您是否未将数据目录(如消费等)设置为安装路径的子目录。为了使我的工作更轻松,在升级时此角色会删除安装文件夹并创建一个全新的文件夹。这是干净而又崭新的。此外,这种方式也能避免在升级期间意外删除数据。
3.5. PostgreSQL使用
如果您想将Paperless-ngx与PostgreSQL一起使用,则需要一个正在运行的PostgreSQL实例。此角色不会自动为您安装该数据库实例。但是,您可以在此处查看如何从头设置此实例的示例:链接到示例剧本
4. 依赖
没有依赖项
5. 示例剧本
minimal_runnable_playbook.yml
:
- hosts: all
roles:
- { role: paperless_ngx.paperless_ngx }
vars:
var1:
var2:
...
6. 贡献
我们鼓励您为此角色做出贡献!请查看 贡献指南以获取流程指导。
7. 许可证
MIT