使用 IRONSECUREDOC

immich Docker Compose(它对开发人员的作用)

发布 2025年一月14日
分享:

介绍

ImmichDocker 是 Immich 的设置,开放源代码,自托管照片和视频备份解决方案,位于Docker容器内。 Docker 是一个轻量级且被广泛采用的平台,用于在物理和虚拟化服务器上开发、分发和运行应用程序。 得益于 Docker,Immich 可以在大多数系统上轻松安装,并且无需复杂的配置和与依赖相关的麻烦即可运行。 这种容器化方法管理Immich,使用户能够更轻松地安全存储、备份和管理媒体文件。

此外,Docker 确保了不同环境的一致性,因此用户可以轻松地迁移或扩展他们的 Immich 实例,几乎不需要麻烦。 这意味着,任何希望使用 Docker 自行托管其媒体备份解决方案的人,都可以通过 Immich Docker 展示出最有效和无缝的方法。

破损图片 添加自 Pixabay,请从您的文件中选择或将图片拖放到此处。

Immich 的功能

Immich Docker 安装了几个开箱即用的功能,使得部署和管理 Immich 照片和视频备份解决方案更加容易。 这反过来使其对那些希望安全且高效地自行托管媒体文件的人非常有吸引力。 Immich Docker 的主要功能包括以下几个方面:

易于部署: Immich Docker 提供了标准的 Docker 镜像,使部署变得简单。 此外,它使用户远离依赖包和复杂的配置; 因此,用户可以立即部署 Immich。

跨平台: 每个 Docker 容器确保设备可以在大多数运行 Docker 的系统上运行,包括 Linux、macOS 和 Windows 操作系统。 这使得该项目在不同环境中具有高度的可移植性。

隔离: 此外,在 Docker 容器中运行的 Immich 服务将与主机上的其他应用程序和服务保持隔离。这将减少冲突和兼容性问题,并且会使 Immich 的操作环境更加稳定。

一般来说,可扩展性非常简单,尤其是在涉及大量媒体数据的情况下,对于使用 Immich Docker 的用户而言,部署时。 由于 Docker 本身具有可扩展性,升级或增加资源可以非常简单。

安全性: 原因是,Docker 容器在底层系统之外引入了一层沙箱,从而提供了额外的安全性。 除此之外,Immich 自托管提供了让用户完全控制其数据和数据库存储位置的可能性,从而提高了隐私和安全性。

自动化更新: 容器相对轻量、易于更新且维护友好; 因此,Docker 的用户可以轻松切换到包含最新安全补丁的新功能,而几乎不会或完全不会受到干扰。

备份和恢复: Immich Docker 在备份媒体时创建一个单一的真实来源,以便可以恢复照片和视频。 Docker确保所有部署具有相同的数据。

可定制: Immich 是自托管的,因此用户可以根据需要进行修改,以更有效地与其他服务集成和扩展选项。

社区支持: 这是一个开源项目; 因此,社区为其用户提供持续改进、错误修复和支持。

安装 Immich Docker

先决条件

  • 在您的系统上安装 Docker 和 Docker Compose。
  • 确保您的机器有足够的资源:建议使用4GB或更大的RAM。

克隆 Immich 仓库

从 Git Hub 下载 docker-compose 文件。

git clone https://github.com/immich-app/immich.git
cd immich
git clone https://github.com/immich-app/immich.git
cd immich
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'git clone https: cd immich
VB   C#

配置环境变量

若要更改,请复制示例环境文件和 docker compose.yml 文件:

cp .env.example .env
cp .env.example .env
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'cp.env.example.env
VB   C#

打开 .env 文件并设置变量(例如端口、存储位置环境文件名和数据库凭据。). 在大多数配置中,默认设置就足够了。

# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables
# The location where your uploaded files are stored
UPLOAD_LOCATION=./library
# The location where your database files are stored
DB_DATA_LOCATION=./postgres
# To set a timezone, uncomment the next line and change Etc/UTC to a TZ identifier from this list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
# TZ=Etc/UTC
# The Immich version to use. You can pin this to a specific version like "v1.71.0"
IMMICH_VERSION=release
# Connection secret for postgres. You should change it to a random password
# Please use only the characters `A-Za-z0-9`, without special characters or spaces
DB_PASSWORD=postgres
# The values below this line do not need to be changed
###################################################################################
DB_USERNAME=postgres
DB_DATABASE_NAME=postgres
# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables
# The location where your uploaded files are stored
UPLOAD_LOCATION=./library
# The location where your database files are stored
DB_DATA_LOCATION=./postgres
# To set a timezone, uncomment the next line and change Etc/UTC to a TZ identifier from this list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
# TZ=Etc/UTC
# The Immich version to use. You can pin this to a specific version like "v1.71.0"
IMMICH_VERSION=release
# Connection secret for postgres. You should change it to a random password
# Please use only the characters `A-Za-z0-9`, without special characters or spaces
DB_PASSWORD=postgres
# The values below this line do not need to be changed
###################################################################################
DB_USERNAME=postgres
DB_DATABASE_NAME=postgres
#You can find documentation for all the supported env variables at https: 'immich.app/docs/install/environment-variables
#The location where your uploaded files are stored
#The location where your database files are stored
#To set a timezone, uncomment the next line and change Etc/UTC to a TZ identifier from this list: https: 'en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
#TZ=Etc/UTC
#The Immich version to use. You can pin this to a specific version like "v1.71.0"
#Connection secret for postgres. You should change it to a random password
#Please use only the characters `A-Za-z0-9`, without special characters or spaces
#The values below this line do not need to be changed
###################################################################################
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'UPLOAD_LOCATION=./library DB_DATA_LOCATION=./postgres IMMICH_VERSION=release DB_PASSWORD=postgres DB_USERNAME=postgres DB_DATABASE_NAME=postgres
VB   C#

启动 Immich

使用 Docker Compose 启动 Immich 服务器:

docker-compose up -d
docker-compose up -d
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'docker-compose up -d
VB   C#

immich Docker Compose(开发者如何使用):图2 - 运行 Immich 服务器

此命令会拉取所有必需的镜像并启动所需的容器:

  • 后端
  • 前端
  • 数据库(PostgreSQL)
  • Redis(用于缓存)
  • 机器学习模型(用于面部识别等功能)

    immich Docker Compose(开发人员如何使用):图3 - Docker Compose命令

在浏览器上访问Immich

下载所有文件后,确保重新启动环境。 一旦容器启动,打开浏览器并输入以下链接。

http://localhost:2283
http://localhost:2283
http: 'localhost:2283
VB   C#

如果您在 .env 文件中更改了端口,请将环境端口替换为指定的端口 2283。

创建或登录Immich账户

首次使用:当您首次访问 Immich URL 时,它将显示网页用户界面。

immich Docker Compose(开发人员的工作原理):图 4 - Immich

您将被要求创建一个管理员帐户。

immich Docker Compose(开发人员指南):图5 - 管理员帐户

填写所需信息,Immich将引导您完成设置。

immich Docker Compose(开发者如何使用):图 6 - 设置

在网络界面中设置 Immich

  • 设置:通过管理仪表板进入Immich的详细设置。
  • 上传媒体:现在上传一些照片/视频进行测试。
  • 探索功能:享受其他功能,例如人脸检测、对象标记等。

    immich Docker Compose(对开发者的工作原理):图 7 - Web 界面

    一旦设置完成,您就可以直接从浏览器访问Immich,并开始管理您的照片和视频库。

什么是 IronSecureDoc?

IronSecureDoc是一款适用于文档管理和安全的高级工具,具有强大的加密功能、先进的PDF操作和数字签名功能。 它为公司和开发者提供了文件的保密性和完整性,同时确保了顺畅的访问,因此简化了PDF文档的处理过程。 在其功能允许开发者以编程方式创建、上传、操作和保护PDF文件和文档的情况下,它也可以被称为一种激进的PDF API。

immich Docker Compose(开发人员的工作原理):图 8 - IronSecureDoc:PDF 安全和合规服务器

除此之外,IronPDF 是一个 PDF API,允许从任何数据输入创建 PDF,并通过诸如文本、图像和元数据等参数添加和编辑内容。 这包括合并多个PDF以组合文件、拆分文档,甚至添加注释、突出显示或水印的功能。

它的安全功能包括密码保护、AES加密和基于证书的访问控制,能够保护所有敏感信息和数据。 除此之外,它允许进行数字签名以验证文件和不可否认性,这在金融、医疗、和法律等行业中是一个非常重要的功能。 审核跟踪功能使其能够跟踪文档上执行的所有活动,以便更好地遵从和责任追究。

安装并运行 IronSecureDoc

通过在命令提示符或打开的终端窗口中运行以下命令,从下列存储库中拉取 IronSecureDoc 的 Docker 镜像。

docker pull ironsoftwareofficial/ironsecuredoc
docker pull ironsoftwareofficial/ironsecuredoc
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'docker pull ironsoftwareofficial/ironsecuredoc
VB   C#

immich Docker Compose(适用于开发人员的工作原理):图9 - IronSecureDoc的Docker映像

我们将从Docker容器中提取一个映像,然后使用另一个命令启动IronSecureDoc,一个操作容器。

docker container run --rm -p 8080:8080 -e IronSecureDoc_LicenseKey=<IRONSECUREDOC_LICENSE_KEY> -e ENVIRONMENT=Development -e HTTP_PORTS=8080 ironsoftwareofficial/ironsecuredoc:latest
docker container run --rm -p 8080:8080 -e IronSecureDoc_LicenseKey=<IRONSECUREDOC_LICENSE_KEY> -e ENVIRONMENT=Development -e HTTP_PORTS=8080 ironsoftwareofficial/ironsecuredoc:latest
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'docker container run --rm -p 8080:8080 -e IronSecureDoc_LicenseKey=<IRONSECUREDOC_LICENSE_KEY> -e ENVIRONMENT=Development -e HTTP_PORTS=8080 ironsoftwareofficial/ironsecuredoc:latest
VB   C#

上面的 Docker run 命令将启动 IronSecureDoc 的容器实例。

从Immich下载签名并添加签名的PDF文档。

IronSecureDoc中的REST API是一个现代化的网页接口,使开发人员能够安全地与软件的文档管理和PDF处理功能进行互动。 使用RESTful原则,这 应用程序接口允许用户轻松理解并标准化将IronSecureDoc的功能集成到其自定义应用程序中的过程,而不论使用的技术栈如何。

immich Docker Compose(开发人员如何使用):图10 - REST API

从 Immich 下载图像

immich Docker Compose(开发人员如何使用):图 11 - 图像

以上是上传到Immich的样本签名文件。

using System;
using System.Net.Http;
using System.Threading.Tasks;
class ImmichIntegration
{
    private static readonly HttpClient client = new HttpClient();
    public async Task<string> GetImageFromImmich(string imageId, string immichBaseUrl, string apiKey)
    {
        client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiKey}");
        var response = await client.GetAsync($"{immichBaseUrl}/api/media/{imageId}");
        response.EnsureSuccessStatusCode();
        var responseData = await response.Content.ReadAsStringAsync();
        Console.WriteLine("Image data retrieved successfully!");
        return responseData; // Contains image metadata or downloadable URL
    }
}
using System;
using System.Net.Http;
using System.Threading.Tasks;
class ImmichIntegration
{
    private static readonly HttpClient client = new HttpClient();
    public async Task<string> GetImageFromImmich(string imageId, string immichBaseUrl, string apiKey)
    {
        client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiKey}");
        var response = await client.GetAsync($"{immichBaseUrl}/api/media/{imageId}");
        response.EnsureSuccessStatusCode();
        var responseData = await response.Content.ReadAsStringAsync();
        Console.WriteLine("Image data retrieved successfully!");
        return responseData; // Contains image metadata or downloadable URL
    }
}
Imports System
Imports System.Net.Http
Imports System.Threading.Tasks
Friend Class ImmichIntegration
	Private Shared ReadOnly client As New HttpClient()
	Public Async Function GetImageFromImmich(ByVal imageId As String, ByVal immichBaseUrl As String, ByVal apiKey As String) As Task(Of String)
		client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiKey}")
		Dim response = Await client.GetAsync($"{immichBaseUrl}/api/media/{imageId}")
		response.EnsureSuccessStatusCode()
		Dim responseData = Await response.Content.ReadAsStringAsync()
		Console.WriteLine("Image data retrieved successfully!")
		Return responseData ' Contains image metadata or downloadable URL
	End Function
End Class
VB   C#

该代码使我们能够从Immich服务器下载图像。 请确保从 Immich 服务器生成一个 API 密钥。

上传图像到IronSecureDoc

using System.IO;
class IronSecureDocIntegration
{
    private static readonly HttpClient client = new HttpClient();
    public async Task UploadImageToIronSecureDoc(string imagePath)
    {
    var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost:8080/v1/document-services/pdfs/sign?sign_specific_page=0&signature_image_x=100&signature_image_y=150&signature_image_w=300&signature_image_h=400&certificate_password=Ibrahim%4021&certificate_permissions=1");
    request.Headers.Add("sec-ch-ua-platform", "\"Windows\"");
    request.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36");
    request.Headers.Add("accept", "*/*");
    request.Headers.Add("sec-ch-ua", "\"Google Chrome\";v=\"131\", \"Chromium\";v=\"131\", \"Not_A Brand\";v=\"24\"");
    request.Headers.Add("sec-ch-ua-mobile", "?0");
    request.Headers.Add("Sec-Fetch-Site", "same-origin");
    request.Headers.Add("Sec-Fetch-Mode", "cors");
    request.Headers.Add("Sec-Fetch-Dest", "empty");
    request.Headers.Add("host", "localhost");
    var content = new MultipartFormDataContent();
    content.Add(new StreamContent(File.OpenRead(imagePath)), "signature_image_file", imagePath);
    content.Add(new StreamContent(File.OpenRead("IronsecureDoc.pfx")), "certificate_file", "IronsecureDoc.pfx");
    content.Add(new StreamContent(File.OpenRead("Input.pdf")), "pdf_file", "Input.pdf");
    request.Content = content;
    var response = await client.SendAsync(request);
    response.EnsureSuccessStatusCode();
    //save the file as required
    Console.WriteLine(await response.Content.ReadAsStringAsync());
    }
}
using System.IO;
class IronSecureDocIntegration
{
    private static readonly HttpClient client = new HttpClient();
    public async Task UploadImageToIronSecureDoc(string imagePath)
    {
    var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost:8080/v1/document-services/pdfs/sign?sign_specific_page=0&signature_image_x=100&signature_image_y=150&signature_image_w=300&signature_image_h=400&certificate_password=Ibrahim%4021&certificate_permissions=1");
    request.Headers.Add("sec-ch-ua-platform", "\"Windows\"");
    request.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36");
    request.Headers.Add("accept", "*/*");
    request.Headers.Add("sec-ch-ua", "\"Google Chrome\";v=\"131\", \"Chromium\";v=\"131\", \"Not_A Brand\";v=\"24\"");
    request.Headers.Add("sec-ch-ua-mobile", "?0");
    request.Headers.Add("Sec-Fetch-Site", "same-origin");
    request.Headers.Add("Sec-Fetch-Mode", "cors");
    request.Headers.Add("Sec-Fetch-Dest", "empty");
    request.Headers.Add("host", "localhost");
    var content = new MultipartFormDataContent();
    content.Add(new StreamContent(File.OpenRead(imagePath)), "signature_image_file", imagePath);
    content.Add(new StreamContent(File.OpenRead("IronsecureDoc.pfx")), "certificate_file", "IronsecureDoc.pfx");
    content.Add(new StreamContent(File.OpenRead("Input.pdf")), "pdf_file", "Input.pdf");
    request.Content = content;
    var response = await client.SendAsync(request);
    response.EnsureSuccessStatusCode();
    //save the file as required
    Console.WriteLine(await response.Content.ReadAsStringAsync());
    }
}
Imports System.IO
Friend Class IronSecureDocIntegration
	Private Shared ReadOnly client As New HttpClient()
	Public Async Function UploadImageToIronSecureDoc(ByVal imagePath As String) As Task
	Dim request = New HttpRequestMessage(HttpMethod.Post, "http://localhost:8080/v1/document-services/pdfs/sign?sign_specific_page=0&signature_image_x=100&signature_image_y=150&signature_image_w=300&signature_image_h=400&certificate_password=Ibrahim%4021&certificate_permissions=1")
	request.Headers.Add("sec-ch-ua-platform", """Windows""")
	request.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36")
	request.Headers.Add("accept", "*/*")
	request.Headers.Add("sec-ch-ua", """Google Chrome"";v=""131"", ""Chromium"";v=""131"", ""Not_A Brand"";v=""24""")
	request.Headers.Add("sec-ch-ua-mobile", "?0")
	request.Headers.Add("Sec-Fetch-Site", "same-origin")
	request.Headers.Add("Sec-Fetch-Mode", "cors")
	request.Headers.Add("Sec-Fetch-Dest", "empty")
	request.Headers.Add("host", "localhost")
	Dim content = New MultipartFormDataContent()
	content.Add(New StreamContent(File.OpenRead(imagePath)), "signature_image_file", imagePath)
	content.Add(New StreamContent(File.OpenRead("IronsecureDoc.pfx")), "certificate_file", "IronsecureDoc.pfx")
	content.Add(New StreamContent(File.OpenRead("Input.pdf")), "pdf_file", "Input.pdf")
	request.Content = content
	Dim response = Await client.SendAsync(request)
	response.EnsureSuccessStatusCode()
	'save the file as required
	Console.WriteLine(Await response.Content.ReadAsStringAsync())
	End Function
End Class
VB   C#

调用Immich和IronSecureDoc

下面的代码将帮助我们进行集成。

class Integration
{
    public async Task IntegrateImmichWithIronSecureDoc(string immichImageId, string immichBaseUrl, string immichApiKey,string imagePath)
    {
        var immich = new ImmichIntegration();
        var ironSecureDoc = new IronSecureDocIntegration();
        // Step 1: Fetch image metadata or download from Immich
        string imageData = await immich.GetImageFromImmich(immichImageId, immichBaseUrl, immichApiKey);
        // Step 2: Optionally download the image locally using imageData URL (not shown here)
        // Assume imagePath is the downloaded image file path
        // Step 3: Upload the image to IronSecureDoc
        await ironSecureDoc.UploadImageToIronSecureDoc(imagePath);
    }
}
class Integration
{
    public async Task IntegrateImmichWithIronSecureDoc(string immichImageId, string immichBaseUrl, string immichApiKey,string imagePath)
    {
        var immich = new ImmichIntegration();
        var ironSecureDoc = new IronSecureDocIntegration();
        // Step 1: Fetch image metadata or download from Immich
        string imageData = await immich.GetImageFromImmich(immichImageId, immichBaseUrl, immichApiKey);
        // Step 2: Optionally download the image locally using imageData URL (not shown here)
        // Assume imagePath is the downloaded image file path
        // Step 3: Upload the image to IronSecureDoc
        await ironSecureDoc.UploadImageToIronSecureDoc(imagePath);
    }
}
Friend Class Integration
	Public Async Function IntegrateImmichWithIronSecureDoc(ByVal immichImageId As String, ByVal immichBaseUrl As String, ByVal immichApiKey As String, ByVal imagePath As String) As Task
		Dim immich = New ImmichIntegration()
		Dim ironSecureDoc = New IronSecureDocIntegration()
		' Step 1: Fetch image metadata or download from Immich
		Dim imageData As String = Await immich.GetImageFromImmich(immichImageId, immichBaseUrl, immichApiKey)
		' Step 2: Optionally download the image locally using imageData URL (not shown here)
		' Assume imagePath is the downloaded image file path
		' Step 3: Upload the image to IronSecureDoc
		Await ironSecureDoc.UploadImageToIronSecureDoc(imagePath)
	End Function
End Class
VB   C#

使用 IronSecureDoc 的 API 附加照片并应用数字签名。 在 IronSecureDocIntegration 类中添加必要的 API 调用以完成文档。 下面是使用IronSecureDoc添加签名后生成的PDF示例。

immich Docker Compose(开发人员如何工作):图 12 - PDF 输出

结论

虽然Immich和IronSecureDoc都在响应特定需求方面表现出色,但它们更适合不同的使用场景。Immich在自托管的、功能丰富的照片和视频管理方面表现出色,例如人脸识别、物体检测和多媒体文件的精简组织。 这将是个人或小规模媒体存储位置管理的理想选择,特别适合那些需要定制化解决方案的用户。

IronSecureDoc 是一个面向整个组织的安全文档和签署解决方案,它将高级加密的极大优势与集成工作流的简单性相结合,实现了安全性、可扩展性和专业级文档处理的融合。

可靠且合规:由于提供了完整的审计功能和强大的安全性,因此它是可靠且合规的。 使用IronSecureDoc REST API,网页、移动和企业系统的开发人员现在可以轻松地在其应用程序中集成安全打印和高效的PDF格式处理。 要了解有关IronSecureDoc许可的更多信息,请查看许可页面. 要了解有关 Iron Software 产品的更多信息,请访问IronSuite 页面.

下一步 >
Haproxy Docker Compose(如何为开发人员工作)

准备开始了吗? 版本: 2024.10 刚刚发布

免费下载查看许可证 >