# How to Deploy a Self-Hosted AI Workflow with Docker & Coolify

> Markdown version of an Informer Tech article. Canonical HTML page: https://www.informertech.com/post/self-hosted-ai-workflow-docker-coolify
> Source: Informer Tech, https://www.informertech.com/

- **Canonical URL:** https://www.informertech.com/post/self-hosted-ai-workflow-docker-coolify
- **Publisher:** Informer Tech (https://www.informertech.com/)
- **Category:** Installation Guides
- **Author:** Carlos Dusan
- **Published:** 2026-11-16
- **Description:** Deploy a self-hosted AI workflow with Docker Compose and Coolify. Connect n8n to Ollama over a private network and test it with a sample support ticket.

---

A support ticket about a duplicate charge makes a useful first test for a local language model. Here’s how to deploy a self-hosted AI workflow with Docker & Coolify and use it to summarize that ticket. You’ll open the n8n editor over HTTPS, connect it to Ollama on the same server and inspect the result. You can then repeat the test after a redeploy to check that your setup still works.

## What you need to self-host an AI workflow

Start with a Linux server running Coolify with its built-in proxy. Point a subdomain such as <code>n8n.example.com</code> to the server and allow inbound TCP traffic on ports <code>80</code> and <code>443</code> for web traffic and certificate issuance.

n8n runs the workflow and uses its built-in SQLite database to store workflows and credentials. Ollama loads the language model and generates the summary. Docker Compose defines how the containers run together and Coolify deploys them.

Allow disk space for both container images and the model. The <code>[llama3.2:1b](https://ollama.com/library/llama3.2?utm_source=chatgpt.com)</code>[ model](https://ollama.com/library/llama3.2?utm_source=chatgpt.com) is a 1.3 GB download. Leave memory for both services. Ollama needs more memory as the amount of text it can consider at once increases.

## How to deploy a self-hosted AI workflow with Docker & Coolify

Put n8n and Ollama in one Coolify Service so n8n can reach Ollama by its Compose service name.

### Define the two services and their storage

In your Coolify project, create a **Docker Compose Empty** resource. Open **Configuration &rarr; General &rarr; Edit Compose File**, paste the YAML below and select **Validate**, then **Save**. The image tags pin specific releases. The named volumes preserve n8n data and downloaded models when Coolify replaces a container.

<pre class="ql-syntax" spellcheck="false">services:
  n8n:
    image: docker.n8n.io/n8nio/n8n:2.47.7
    environment:
      N8N_ENCRYPTION_KEY: ${N8N_ENCRYPTION_KEY:?}
      N8N_EDITOR_BASE_URL: ${N8N_PUBLIC_URL:?}
      N8N_WEBHOOK_URL: ${N8N_PUBLIC_URL:?}
      N8N_PROXY_HOPS: "1"
    volumes:
      - n8n_data:/home/node/.n8n

  ollama:
    image: ollama/ollama:0.40.16
    environment:
      OLLAMA_HOST: 0.0.0.0:11434
    volumes:
      - ollama_data:/root/.ollama

volumes:
  n8n_data:
  ollama_data:
</pre>
Under **Configuration &rarr; Environment Variables**, set <code>N8N_PUBLIC_URL</code> to your full HTTPS address, such as <code>https://n8n.example.com/</code>. Set <code>N8N_ENCRYPTION_KEY</code> to a long random string before the first launch. n8n uses that key to encrypt saved credentials. The proxy setting assumes Coolify is the only reverse proxy in front of n8n.

### Route HTTPS to n8n and deploy the stack

In **Domains**, add your hostname with HTTPS, select the <code>n8n</code> component and set the target container port to <code>5678</code>. Keep Ollama on the stack network without a public domain or published port because its local API requires no authentication.

Select **Deploy** and check the logs for both containers. Once they’re running, open the n8n HTTPS address in your browser and create the initial owner account.

## Run your first self-hosted AI workflow

A manual run checks that n8n can reach the model and return a summary before you connect a source of real tickets.

### Download the model and connect n8n to Ollama

Open the Service’s **Terminal** tab and select the Ollama container. Run the following command and wait for the download to finish.

<pre class="ql-syntax" spellcheck="false">ollama pull llama3.2:1b
</pre>
In n8n, create an [Ollama credential](https://docs.n8n.io/integrations/builtin/credentials/ollama/?utm_source=chatgpt.com) with <code>http://ollama:11434</code> as its base URL. Leave the API key blank. Docker resolves <code>ollama</code> to the service of that name on the shared network. If you enter <code>localhost</code> here, n8n will try to connect to itself.

### Build and verify the summary workflow

Connect a **Manual Trigger** to a [Basic LLM Chain](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.chainllm/?utm_source=chatgpt.com). Attach an **Ollama Chat Model** to the chain’s model input, choose the Ollama credential and select <code>llama3.2:1b</code>. Set the chain’s prompt mode to **Define below** and paste this prompt.

<blockquote>Summarize this support ticket in one sentence. I was charged twice after I retried checkout.</blockquote>
Select **Execute Workflow** and open the chain’s output. Check that the summary mentions the duplicate charge after the checkout retry.

## Troubleshoot and maintain the deployment

Check the failing part of the stack before changing the Compose file. If the editor won’t load, verify DNS and the proxy’s target port. If n8n reports a connection error, check the Ollama logs and the credential’s base URL. If the model is missing, run <code>ollama ls</code> inside the Ollama container to confirm the exact tag.

Before changing an image tag, back up the n8n volume and encryption key to a secure location off the server. Test the restore and rerun the sample workflow after upgrading.

## Conclusion

The final step in learning how to deploy a self-hosted AI workflow with Docker & Coolify is testing it after a redeploy. Open the saved workflow and run the same ticket again. A successful response confirms that the workflow and downloaded model are still available.

## Frequently asked questions

### Do I need a GPU to run Ollama on Coolify?

Ollama can run on a CPU. Test the small model with a typical prompt and see whether the response time works for your workflow.

### Do I need PostgreSQL or a vector database?

SQLite is enough for this low-volume example. Consider PostgreSQL as usage grows. A vector database such as Qdrant is useful if your workflow needs to retrieve relevant text from stored documents.

### Can another app trigger the workflow?

Replace **Manual Trigger** with an authenticated [Webhook node](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.webhook/?utm_source=chatgpt.com) and map the incoming ticket text into the prompt. Publish the workflow before calling its production HTTPS webhook URL.
