Automate Immich Container Management with n8n
detail.loadingPreview
Streamline your Immich Docker deployment and management using this n8n workflow. Automate container startup, shutdown, disk mounting, and unmounting with simple API commands. Ensure robust operations and efficient resource utilization for your Immich instance.
About This Workflow
This n8n workflow provides a powerful and flexible way to manage your Immich Docker containers. It listens for incoming API requests via a webhook, allowing you to trigger various actions based on simple commands. The workflow validates the incoming server domain against a predefined value, ensuring only authorized requests are processed. It then routes requests to perform actions like starting, stopping, mounting, or unmounting Docker containers. Each action is executed via SSH commands, providing direct control over your Immich environment. The workflow also includes error handling and response mechanisms to inform the caller of the operation's success or failure, making it ideal for integration into broader automation pipelines.
Key Features
- Remote Container Control: Start, stop, mount, and unmount Immich Docker containers via API calls.
- Secure Access: Uses SSH with password authentication for secure command execution.
- Domain Validation: Ensures requests originate from the expected server domain for added security.
- Flexible Command Handling: Supports multiple commands for diverse container management needs.
- Clear Status Feedback: Provides structured JSON responses indicating success or error status with relevant messages.
How To Use
- Set up the n8n Webhook: Configure the 'API' node with your desired path (e.g.,
docker-immich) and authentication method. Ensure the webhook is activated. - Define Parameters: Use the 'Parametrs' node to set your
server_domain,clients_dir,mount_dir, and screen escape characters. - Configure Domain Validation: In the 'If' node, set the
leftValueto={{ $json.server_domain }}and therightValueto={{ $('API').item.json.body.server_domain }}to validate incoming requests. - Set Up Container Actions: In the 'Container Actions' (Switch) node, define rules for
container_start,container_stop,container_mount_disk, andcontainer_unmount_disk, mapping them to the correspondingcommandreceived from the API. - Define SSH Commands: For each action in the 'Container Actions' node, configure the 'SSH' node to execute the appropriate Docker command (e.g.,
docker start immichforcontainer_start). Ensure thecommandparameter correctly references the output from the Switch node. - Configure SSH Credentials: Set up your SSH credentials in the 'SSH' node to connect to your Immich server.
- Handle Responses: Connect the 'SSH' node's output to the 'Code1' node for parsing the command's output and determining the success or failure status. Connect the 'Code1' node to the 'Respond to Webhook' node to send the final JSON response to the API caller.
Apps Used
Workflow JSON
{
"id": "5faa5fd6-9567-44b3-aaea-1c210c4dff05",
"name": "Automate Immich Container Management with n8n",
"nodes": 8,
"category": "DevOps",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: 5faa5fd6-9567...
About the Author
DevOps_Master_X
Infrastructure Expert
Specializing in CI/CD pipelines, Docker, and Kubernetes automations.
Statistics
Related Workflows
Discover more workflows you might like
Effortless Bug Reporting: Slack Slash Command to Linear Issue
Streamline your bug reporting process by instantly creating Linear issues directly from Slack using a simple slash command. This workflow enhances team collaboration by providing immediate feedback and a structured approach to logging defects, saving valuable time for development and QA teams.
Automated PR Merged QA Notifications
Streamline your QA process with this automated workflow that notifies your team upon successful Pull Request merges. Leverage AI and vector stores to enrich notifications and ensure seamless integration into your development pipeline.
Visualize Your n8n Workflows: Interactive Dashboard with Mermaid.js
Gain unparalleled visibility into your n8n automation landscape. This workflow transforms your n8n instance into a dynamic, interactive dashboard, leveraging Mermaid.js to visualize all your workflows in one accessible place.