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 n8n.example.com to the server and allow inbound TCP traffic on ports 80 and 443 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 llama3.2:1b model 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 → General → 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.
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:
Under Configuration → Environment Variables, set N8N_PUBLIC_URL to your full HTTPS address, such as https://n8n.example.com/. Set N8N_ENCRYPTION_KEY 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 n8n component and set the target container port to 5678. 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.
ollama pull llama3.2:1b
In n8n, create an Ollama credential with http://ollama:11434 as its base URL. Leave the API key blank. Docker resolves ollama to the service of that name on the shared network. If you enter localhost here, n8n will try to connect to itself.
Build and verify the summary workflow
Connect a Manual Trigger to a Basic LLM Chain. Attach an Ollama Chat Model to the chain’s model input, choose the Ollama credential and select llama3.2:1b. Set the chain’s prompt mode to Define below and paste this prompt.
Summarize this support ticket in one sentence. I was charged twice after I retried checkout.
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 ollama ls 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 and map the incoming ticket text into the prompt. Publish the workflow before calling its production HTTPS webhook URL.

