Local AI Automation Server on Pi 5
Deploy Ollama and n8n on a Raspberry Pi 5 to run a local AI server.
Introduction
30 Second Summary
What if you had a tiny computer sitting on your desk that could run AI models, automate tasks, and respond to commands from your phone, all without ever touching the cloud?
In this project, you will turn a Raspberry Pi 5 into a local AI automation server by deploying Ollama and n8n as Docker containers, wiring them together into an AI-powered workflow you can trigger from your iPhone.
What You'll Build
A Raspberry Pi 5 running Ubuntu Desktop with Docker containers for n8n (a visual workflow automation platform) and Ollama (a local LLM inference engine), connected together and controlled remotely from your Mac and iPhone.
By the end of this project, you'll have:
- A Raspberry Pi 5 running Ubuntu Desktop 24.04 LTS with Docker, Ollama, and n8n deployed as containerized services.
- A working n8n webhook workflow that uses a local Ollama LLM to act as an "AI Workflow Architect," generating automation plans from natural language descriptions.
- Remote access to the Pi's desktop from your Mac via VNC, plus iOS Shortcuts that trigger webhooks and run SSH commands on the Pi from your phone.
- A complete Pi management shortcut suite for your iPhone to check system stats, restart containers, and pull new AI models.
Are there any prerequisites?
You will need a Raspberry Pi 5 (8GB recommended) with a power supply, a microSD card (32GB or larger), a Mac with internet access, and an iPhone with the Shortcuts app. Basic familiarity with the Linux terminal and Docker concepts is helpful but not required.
Flash Ubuntu Desktop and Boot the Pi
Before you can deploy AI services on your Raspberry Pi 5, it needs an operating system.
In this step, you'll flash Ubuntu Desktop 24.04 LTS onto a microSD card using Raspberry Pi Imager, boot the Pi, and apply a critical performance fix that prevents the CPU from being throttled.
In This Step, Get Ready To:
- Flash Ubuntu Desktop 24.04 LTS onto your microSD card.
- Boot the Pi and complete the Ubuntu first-boot setup.
- Apply the EEPROM performance fix to unlock full CPU speed.
Install Raspberry Pi Imager and Flash Ubuntu Desktop
Raspberry Pi Imager is a free tool from the Raspberry Pi Foundation that downloads and writes operating system images to microSD cards. It also lets you pre-configure settings like Wi-Fi and SSH so you don't have to set them up manually after booting.
- Download and install Raspberry Pi Imager on your Mac from raspberrypi.com/software.
- Open Raspberry Pi Imager.
- Click Choose Device and select Raspberry Pi 5.
- Click Choose OS, then select Other general-purpose OS.
- Select Ubuntu, then choose Ubuntu Desktop 24.04 LTS (64-bit).
- Insert your microSD card into your Mac.
- Click Choose Storage and select your microSD card.
- Click Next. When prompted to apply OS customization settings, click Edit Settings.
The settings panel lets you pre-configure your Pi before it even boots for the first time.
- Set a hostname, username, and password for your Pi.
- Configure your Wi-Fi network name and password if you are not using Ethernet.
- Set your locale and timezone.
- Switch to the Services tab and enable SSH with password authentication.
- Click Save, then click Yes to apply the settings and begin flashing.
Why enable SSH now?
SSH lets you control the Pi remotely from your Mac's terminal. Enabling it here saves you from needing to configure it later on the Pi itself. You will use SSH heavily in later steps for remote access and iOS Shortcuts.
The flashing process takes a few minutes. The Imager will write the image and then verify it.
Boot the Pi and Complete Ubuntu Setup
With the OS flashed, it is time to boot the Pi for the first time. You will need a monitor, keyboard, and mouse connected directly to the Pi for this initial setup.
- Eject the microSD card from your Mac and insert it into the Pi 5. The card slot is on the bottom of the board, with the copper contacts facing up.
- Connect a monitor to the Pi via micro-HDMI.
- Connect a USB keyboard and mouse.
- Plug in the official Raspberry Pi 27W USB-C power supply to power on the Pi.
Ubuntu runs a first-boot setup wizard. This takes a minute or two to appear.
- Follow the on-screen prompts to select your language, timezone, and create your user account.
Once you reach the Ubuntu Desktop, the first thing to do is update all system packages. This ensures you have the latest security patches and drivers.
- Open a terminal with Ctrl+Alt+T.
- Run the following command to update and upgrade all packages:
sudo apt update && sudo apt full-upgrade -y
What does this command do?
This is actually two commands chained together. sudo apt update refreshes the list of available packages. sudo apt full-upgrade -y installs all available updates, including ones that require installing or removing other packages. The -y flag automatically confirms the installation.
This upgrade may take several minutes. Let it finish completely before moving on.
Apply the EEPROM Performance Fix
Ubuntu 24.04 has a known bug on the Raspberry Pi 5 where it incorrectly detects the power supply and throttles the CPU. This means your Pi runs significantly slower than it should. Since you will be running an LLM on this device, every bit of CPU performance matters.
The fix involves editing the Pi's EEPROM configuration to tell the system that a full 5A power supply is connected.
- In the terminal, run the following command to open the EEPROM config editor:
sudo rpi-eeprom-config --edit
- Add the following line to the bottom of the file:
PSU_MAX_CURRENT=5000
- Save and exit the editor by pressing Ctrl+X, then Y, then Enter.
- Reboot the Pi to apply the change:
sudo reboot
What is EEPROM?
EEPROM stands for Electrically Erasable Programmable Read-Only Memory. It is a small chip on the Pi that stores low-level configuration that runs before the operating system even loads. By setting PSU_MAX_CURRENT=5000, you are telling the Pi that a 5A power supply is connected, which prevents the incorrect throttling.
Be careful with EEPROM edits
Only add the PSU_MAX_CURRENT=5000 line. Do not modify or delete any other lines in the EEPROM config. Incorrect EEPROM changes can prevent the Pi from booting, requiring a recovery image to fix.
After the reboot, the Pi should feel noticeably snappier. The CPU is no longer being artificially held back.
Your Pi is now running Ubuntu Desktop at full speed. Next up, you'll install Docker and set up remote access so you can control the Pi from your Mac without needing a monitor plugged in.
Install Docker and Enable Remote Access
Your Pi is running Ubuntu Desktop and ready for action. Now you need two things: Docker to run your AI services as containers, and remote access so you can control the Pi from your Mac without needing a monitor plugged in. By the end of this step, you'll be able to close the lid on your Pi setup and manage everything wirelessly.
In This Step, Get Ready To:
- Install Docker and Docker Compose on your Raspberry Pi.
- Enable SSH and VNC for remote access to the Pi.
- Connect to the Pi's desktop from your Mac using TigerVNC Viewer.
Install Docker and Docker Compose
Docker lets you run applications inside isolated containers. Instead of installing Ollama and n8n directly on your Pi (where they could conflict with each other or with system packages), each service gets its own clean environment. Docker Compose takes this further by letting you define and start multiple containers with a single file.
- Open a terminal on your Pi with Ctrl+Alt+T.
- Run the official Docker convenience script to install Docker.
curl -sSL https://get.docker.com | sh
What does this command do?
This downloads and runs Docker's official installation script. It detects your operating system and architecture (ARM64 in this case), adds Docker's package repository, and installs the Docker engine. It is the recommended way to install Docker on Linux.
By default, Docker commands require sudo. Adding your user to the docker group lets you run Docker without typing sudo every time.
- Add your user to the docker group.
sudo usermod -aG docker $USER
- Install the Docker Compose plugin.
sudo apt install -y docker-compose-plugin
- Log out and log back in for the group change to take effect. Alternatively, run newgrp docker to apply it in your current terminal session.
- Verify both Docker and Docker Compose are installed.
docker --version
docker compose version
What should I see?
You should see version numbers for both Docker and Docker Compose. If you get a "permission denied" error for the first command, make sure you logged out and back in after adding your user to the docker group.
Getting a permission denied error?
The most common cause is not logging out after running the usermod command. Try closing your terminal completely, logging out of Ubuntu, and logging back in. Then open a fresh terminal and try again. Help me troubleshoot Docker permissions.
Enable SSH and VNC for Remote Access
Right now you need a monitor, keyboard, and mouse plugged into your Pi. SSH gives you terminal access from your Mac. VNC goes further by streaming the entire Ubuntu Desktop to your Mac so you can interact with the graphical interface remotely.
- Verify that SSH is already running. You enabled it during the Raspberry Pi Imager setup in Step 1.
sudo systemctl status ssh
I see "active (running)"
SSH is running and ready. Move on to the next instruction.
I see it's not running
Enable and start SSH with this command.
sudo systemctl enable --now ssh
- Find your Pi's IP address. Write this down because you will need it for VNC, SSH, and iOS Shortcuts throughout the rest of the project.
hostname -I
Pro tip: note your IP
The first address shown (something like 192.168.1.100) is the one you need. Write it down or copy it somewhere accessible from your Mac and iPhone.
Now set up VNC so you can see the Pi's full desktop on your Mac. You will use x11vnc, a lightweight VNC server that shares the existing desktop session.
- Install x11vnc on the Pi.
sudo apt install -y x11vnc
- Set a VNC password. You will be prompted to enter and confirm a password.
x11vnc -storepasswd
- Start the VNC server. The -forever flag keeps it running after a client disconnects, and the & runs it in the background.
x11vnc -usepw -forever -display :0 &
Using Wayland? You May Need to Switch to X11
Ubuntu 24.04 may default to a Wayland session, which x11vnc does not support. If you see an error about not being able to open the display, log out of Ubuntu, click your username on the login screen, then click the gear icon in the bottom right and select Ubuntu on Xorg before logging back in. Then try starting x11vnc again.
Pro tip: auto-start VNC
To make x11vnc start automatically on boot, you can create a systemd service or add it to your Ubuntu startup applications. For now, you will just start it manually when needed.
Connect From Your Mac
With SSH and VNC running on the Pi, you can now connect from your Mac. TigerVNC Viewer is a free, lightweight VNC client that works well with x11vnc.
- On your Mac, open a terminal and install TigerVNC Viewer using Homebrew.
brew install --cask tigervnc
What does this command do?
Homebrew's --cask flag installs graphical applications (as opposed to command-line tools). This installs TigerVNC Viewer into your Applications folder.
- Open TigerVNC Viewer from your Applications folder.
- Enter your Pi's IP address in the connection field and click Connect.
- Enter the VNC password you set on the Pi.
You should now see the full Ubuntu Desktop streaming to your Mac. You can interact with it just like you would with a monitor plugged in.
- Verify SSH also works from your Mac terminal.
ssh [[PIUSER="your-username"]]@[[PIIP="your-pi-ip-address"]]
What should I see?
You should be prompted to accept the host key (type yes), then enter your Pi's password. After that, you will see a terminal prompt from the Pi. Type exit to disconnect when you are done testing.
Can't connect via VNC or SSH?
Make sure your Mac and Pi are on the same Wi-Fi network. Double-check the IP address by running hostname -I on the Pi again. If VNC connects but shows a black screen, you may need to switch Ubuntu to the X11 session as described in the callout above. Help me troubleshoot my remote connection.
You can now unplug the monitor, keyboard, and mouse from your Pi. Everything from here on out happens remotely. Next up, you will deploy Ollama and n8n as Docker containers and wire them together.
Deploy Ollama and n8n with Docker Compose
Your Pi is running Docker and you can access it remotely from your Mac. Now it's time to deploy the two core services that power your AI automation server: Ollama for local LLM inference and n8n for visual workflow automation. Docker Compose lets you define both services in a single file and launch them together with one command.
In This Step, Get Ready To:
- Create a docker-compose.yml file that defines Ollama and n8n as linked containers.
- Pull and test a local LLM model (Qwen2.5 1.5B) inside Ollama.
- Access the n8n web interface and connect it to Ollama.
Create the Project Directory and Docker Compose File
A docker-compose.yml file describes all the services your project needs, their configuration, and how they connect to each other. Instead of running separate docker run commands for each container, you define everything in one place and launch it all together.
- On the Pi (via SSH or VNC terminal), create a project directory and navigate into it:
mkdir -p ~/ai-server && cd ~/ai-server
- Create the Docker Compose file:
nano docker-compose.yml
- Add the following content to the file:
services:
ollama:
image: ollama/ollama:latest
container_name: ollama
restart: unless-stopped
ports:
- "11434:11434"
volumes:
- ollama_data:/root/.ollama
n8n:
image: docker.n8n.io/n8nio/n8n
container_name: n8n
restart: unless-stopped
ports:
- "5678:5678"
environment:
- N8N_HOST=0.0.0.0
- N8N_PORT=5678
- N8N_PROTOCOL=http
- N8N_SECURE_COOKIE=false
- WEBHOOK_URL=http://[[PI_IP="your Pi's IP address, e.g. 192.168.1.100"]]:5678/
- GENERIC_TIMEZONE=[[TIMEZONE="your timezone, e.g. America/New_York"]]
volumes:
- n8n_data:/home/node/.n8n
volumes:
ollama_data:
n8n_data:
What does this file do?
This file defines two services that will run as separate Docker containers:
- ollama runs the Ollama LLM engine on port 11434. Its model data is stored in a persistent volume so models survive container restarts.
- n8n runs the workflow automation platform on port 5678. The N8N_SECURE_COOKIE=false setting is required for plain HTTP access without SSL.
Because both services are defined in the same Compose file, Docker automatically places them on a shared network. This means n8n can reach Ollama using the container name ollama as a hostname.
- Save and exit the file by pressing Ctrl+X, then Y, then Enter.
Start the Services and Pull an LLM Model
With your Compose file ready, you can launch both containers with a single command. After they're running, you'll pull a language model into Ollama so it can respond to prompts.
- Make sure you're in the project directory:
cd ~/ai-server
- Start both containers in detached mode:
docker compose up -d
What does this command do?
The -d flag runs the containers in the background (detached mode). Without it, the containers would take over your terminal and stop when you close it.
Docker will download the Ollama and n8n images. This may take several minutes on the Pi, especially on the first run.
- Verify both containers are running:
docker compose ps
I see both containers running
You should see both ollama and n8n listed with a status of "Up". You're ready to pull a model.
I see an error
If a container shows as "Exited" or isn't listed, check its logs for details:
docker compose logs ollama
docker compose logs n8n
Common issues include port conflicts (another service using port 5678 or 11434) or typos in the Compose file. Double-check your docker-compose.yml for correct indentation and syntax.
If you need more help, ask about your specific error message.
Now you need to download a language model into Ollama. Qwen2.5 1.5B offers the best quality-to-speed balance on Pi 5, running at around 9-12 tokens per second while using approximately 1.8GB of RAM.
- Pull the Qwen2.5 1.5B model into the Ollama container:
docker exec -it ollama ollama pull qwen2.5:1.5b
What does this command do?
The docker exec -it ollama part runs a command inside the running Ollama container. The ollama pull qwen2.5:1.5b part downloads the Qwen2.5 model with 1.5 billion parameters. This model is small enough to run smoothly on the Pi's CPU.
- Test that Ollama can generate a response:
docker exec -it ollama ollama run qwen2.5:1.5b "Say hello in one sentence"
What should I see?
You should see Ollama generate a short greeting. It may take a few seconds for the first response as the model loads into memory. Subsequent responses will be faster.
Access n8n and Create the Ollama Credential
Both containers are running, but n8n doesn't know how to talk to Ollama yet. You need to create a credential in n8n that tells it where to find the Ollama API.
- Open a browser on your Mac and go to:
http://[[PI_IP="your Pi's IP address, e.g. 192.168.1.100"]]:5678
- Complete the n8n setup wizard by creating an owner account with your email and password.
- After setup, click the menu icon in the left sidebar.
- Click Credentials.
- Click Add Credential and search for "Ollama".
- Set the Base URL to:
http://ollama:11434
Why 'ollama' Instead of an IP Address?
Both containers are on the same Docker Compose network. Docker's built-in DNS lets containers find each other by name. So n8n can reach Ollama using ollama as the hostname instead of needing a specific IP address.
- Click Save.
You should see a "Connection tested successfully" message. This confirms that n8n can communicate with Ollama through the shared Docker network.
Connection failed?
If the connection test fails, make sure the Ollama container is still running by checking docker compose ps on the Pi. Also verify you entered the URL exactly as http://ollama:11434 with no trailing slash. If you're still stuck, get help troubleshooting your n8n-to-Ollama connection.
Your AI server's foundation is in place. Ollama is running a local LLM and n8n is connected to it. Next up, you'll build the actual workflow that turns this into an AI-powered automation assistant.
Build the AI Workflow Architect
Your Pi is now running two containerized services that can talk to each other. Ollama can generate text, and n8n knows how to reach it. Time to wire them together into something useful.
In this step, you'll build an n8n workflow that accepts a natural language description of an automation, sends it to your local LLM, and returns a structured plan listing the exact n8n nodes and connections needed to build it.
In This Step, Get Ready To:
- Create a new n8n workflow with a Webhook trigger.
- Connect an AI Agent node to your local Ollama model with a custom system prompt.
- Test the full workflow by sending a prompt and receiving a structured automation plan.
Create a New Workflow With a Webhook Trigger
A webhook is an HTTP endpoint that listens for incoming requests. When something sends data to the webhook URL, it kicks off the workflow. This is how your iPhone will communicate with n8n later.
- Open n8n in your Mac's browser at http://your-pi-ip:5678.
- Click Add workflow to create a new workflow.
- Name it AI Workflow Architect.
- Click the + button on the canvas to add your first node.
- Search for Webhook and select it.
- Set the HTTP Method to POST.
- Under Respond, select Last Node so the workflow returns the AI response to whoever called it.
- Note the webhook URL shown in the node. It will look like: http://your-pi-ip:5678/webhook/some-uuid.
Production vs Test Webhook URLs
n8n gives each Webhook node two URLs: a Test URL and a Production URL. The test URL only works when you're actively listening in the editor. The production URL works whenever the workflow is toggled active. You'll use the production URL for your iOS Shortcut.
Add the AI Agent and Ollama Chat Model Nodes
The Webhook node catches incoming requests. Now you need a node that takes the user's prompt and sends it to Ollama for processing. n8n's AI Agent node handles this by connecting to a chat model and applying a system prompt that shapes the AI's behavior.
- Click the + button after the Webhook node to add a new node.
- Search for AI Agent and select it.
- The AI Agent node needs a chat model attached to it. Click the Chat Model connector at the bottom of the AI Agent node.
- Search for Ollama Chat Model and select it.
- In the Ollama Chat Model node settings, select the Ollama credential you created in the previous step.
- For the Model field, select qwen2.5:1.5b.
Now configure the AI Agent node itself with a system prompt and user message.
- Click on the AI Agent node to open its settings.
- In the System Message field, paste the following prompt:
You are an n8n workflow architect. When a user describes an automation they want, respond with a structured plan that includes:
1. A list of the exact n8n nodes needed (e.g., Webhook, HTTP Request, Gmail, IF, etc.)
2. How each node should be configured
3. How the nodes connect to each other (the flow)
4. Any credentials or external services required
Keep your response concise and actionable.
What does this system prompt do?
The system prompt defines the AI's persona and output format. Without it, Ollama would give generic answers. This prompt constrains the model to respond specifically with n8n node names, configurations, and connection flows. The more specific your system prompt, the more useful the output.
- In the Prompt field (or User Message field), click the Expression toggle and enter the following expression:
{{ $json.body.prompt }}
What does this expression do?
This expression pulls the prompt field from the JSON body of the incoming webhook request. When your iPhone sends a POST request with {"prompt": "your description"}, this expression extracts that description and passes it to Ollama as the user's message.
Test the Workflow
Your workflow is wired up. The Webhook catches requests, the AI Agent processes them through Ollama, and the response flows back to the caller. Time to activate it and send a real request.
- Toggle the Active switch in the top right corner of the n8n editor.
- Copy the Production webhook URL from the Webhook node.
- Open a terminal on your Mac and run the following curl command:
curl -X POST http://[[PI_IP="your Pi's IP address"]]:5678/webhook/[[WEBHOOK_PATH="your webhook path from n8n"]] \
-H "Content-Type: application/json" \
-d '{"prompt": "When I receive a new email with a PDF attachment, save the PDF to Google Drive and send me a Slack notification with the file name"}'
What does this command do?
This sends an HTTP POST request to your n8n webhook with a JSON body containing a prompt field. n8n receives the request, extracts the prompt, sends it to Ollama, and returns the AI-generated workflow plan as the HTTP response.
The response will take 15-30 seconds on Pi 5 since the model runs entirely on CPU. You should receive a structured response describing the n8n nodes, their configuration, and how they connect together.
I see a structured workflow plan
Your AI Workflow Architect is working. The response should list specific n8n node names like Webhook, Gmail Trigger, Google Drive, and Slack, along with configuration details and connection flow.
I see an error or empty response
Having trouble?
Here are a few things to check:
- Make sure the workflow is toggled Active (green toggle in the top right).
- Verify you're using the Production URL, not the Test URL.
- Check that both containers are running with docker compose ps on the Pi.
- Verify the Ollama credential in n8n shows "Connection tested successfully".
- Make sure the model is pulled by running docker exec -it ollama ollama list and confirming qwen2.5:1.5b appears.
Still stuck? Describe the error you're seeing and I'll help you debug it.
Your AI Workflow Architect is live and responding to requests from your Mac's terminal. Next up, you'll create iOS Shortcuts so you can trigger this workflow and manage your Pi directly from your iPhone.
Create iOS Shortcuts for Remote Control
Your AI Workflow Architect is live and responding to requests from the terminal. Now it is time to cut the cord and control everything from your phone. In this step, you will build iOS Shortcuts that trigger your n8n webhook and run SSH commands on the Pi, turning your iPhone into a remote control for your automation server.
In This Step, Get Ready To:
- Build an iOS Shortcut that sends workflow descriptions to your AI Workflow Architect and displays the response.
- Build an SSH-based Shortcut that checks your Pi's system status and Docker containers.
- Test both Shortcuts from your iPhone on the same local network.
Create the AI Workflow Architect Shortcut
The Shortcuts app on iPhone has a built-in action called Get Contents of URL that can send HTTP POST requests to any URL. You will use this to send a prompt to your n8n webhook and display the AI-generated workflow plan right on your phone.
- On your iPhone, open the Shortcuts app.
- Tap the + button in the top right to create a new shortcut.
- Add an Ask for Input action. Set the prompt to "Describe the workflow you want to build".
- Add a Get Contents of URL action.
- Set the URL to your webhook URL from Step 4. It looks like: http://your-pi-ip:5678/webhook/your-webhook-path.
- Tap Show More and set Method to POST.
- Set Headers with Key = Content-Type and Value = application/json.
- Set Request Body to JSON. Add a key called prompt and set its value to the Provided Input variable from the Ask for Input action.
- Add a Show Result action to display the AI response.
- Tap the shortcut name at the top and rename it to "AI Workflow Architect".
How does this Shortcut work?
When you run this Shortcut, it asks you to describe an automation in plain English. It packages your description as a JSON payload and sends it as an HTTP POST request to your n8n webhook. The n8n workflow forwards the prompt to Ollama, which generates a structured workflow plan. The response travels back through n8n to your phone and appears on screen.
Pro tip: Siri activation
Once you name the shortcut, you can trigger it hands-free by saying "Hey Siri, AI Workflow Architect." Siri will prompt you for the workflow description and read back the result.
Create an SSH System Status Shortcut
iOS Shortcuts also has a built-in Run Script Over SSH action that can execute commands directly on your Pi. This lets you check system health, monitor Docker containers, and manage your server without opening a terminal.
- Create a new shortcut in the Shortcuts app.
- Search for and add a Run Script Over SSH action.
- Configure the connection settings: set Host to your Pi's IP address, Port to 22, User to your Pi username, and Authentication to Password.
- Enter your Pi password when prompted.
- In the Script field, paste the following command.
echo "=== System Status ===" && echo "Uptime: $(uptime -p)" && echo "CPU Temp: $(cat /sys/class/thermal/thermal_zone0/temp | awk '{print $1/1000}')°C" && echo "Memory: $(free -h | grep Mem | awk '{print $3 "/" $2}')" && echo "Disk: $(df -h / | tail -1 | awk '{print $3 "/" $2 " (" $5 " used)"}')" && echo "=== Docker ===" && docker ps --format "table {{.Names}}\t{{.Status}}"
What does this script do?
This single command chain prints five pieces of system information. It shows how long the Pi has been running, the CPU temperature, memory usage, disk usage, and a table of all running Docker containers with their status. The && operators chain each command so they all run in sequence.
- Add a Show Result action after the SSH action to display the output.
- Name this shortcut "Pi Status".
Test Both Shortcuts
Both Shortcuts communicate with your Pi over the local network. Your iPhone must be on the same Wi-Fi network as the Pi for these to work.
- Confirm your iPhone is connected to the same Wi-Fi network as your Pi.
- Run the Pi Status shortcut first.
You should see your Pi's uptime, CPU temperature, memory usage, disk usage, and a table showing both the ollama and n8n containers with an "Up" status.
- Run the AI Workflow Architect shortcut.
- When prompted, enter a description like "Send me a daily weather summary at 8am via email".
Wait 15-30 seconds for Ollama to process the prompt on the Pi's CPU. You should see a structured workflow plan appear on your phone, listing the n8n nodes, configuration details, and connections needed to build that automation.
Getting an "Unknown Host" or connection error?
Make sure you are using the Pi's numeric IP address (e.g., 192.168.1.100) instead of a hostname. Also double-check that your iPhone is on the same Wi-Fi network as the Pi. You can verify the Pi's IP by running hostname -I in a terminal on the Pi.
If the AI Workflow Architect shortcut times out, the Ollama model may still be loading. Try running the shortcut again after a minute. Help me troubleshoot my iOS Shortcut connection to the Pi.
You now have a fully phone-controlled AI automation server. Your Pi is running Ollama and n8n as Docker containers, responding to webhook requests and SSH commands from your iPhone. In the next section, you will have a chance to expand your shortcut collection even further.
Secret mission
Build a Pi Management Shortcut Suite
You have one Shortcut that talks to your AI server and one that checks system status. But what about restarting containers, pulling new models, or shutting down the Pi entirely? Build a complete management suite that puts full control of your Pi in your pocket.
Before you go
Clean Up Your Resources
Decide whether to keep your resources running, pause them to come back later, or delete them entirely. This project runs entirely on your local Raspberry Pi with free and open-source software, so there are no ongoing cloud costs.
Resources you used:
- Raspberry Pi 5 running Ubuntu Desktop 24.04 LTS.
- Docker containers: ollama and n8n (defined in docker-compose.yml).
- Docker volumes: ollama_data and n8n_data.
- Ollama model: qwen2.5:1.5b (stored inside the ollama_data volume).
- x11vnc VNC server running on the Pi.
- TigerVNC Viewer installed on your Mac.
- iOS Shortcuts: AI Workflow Architect, Pi Status, and any Secret Mission shortcuts.
- n8n workflow: AI Workflow Architect (with webhook and Ollama credential).
Keep everything running
No action needed. Choose this if you are still actively building automations or plan to use your Pi as an always-on server.
- Your Docker containers are configured with restart: unless-stopped, so they will automatically restart after a reboot.
- The Pi will continue running Ollama, n8n, and VNC as long as it has power.
- Your iOS Shortcuts will continue to work whenever your phone is on the same Wi-Fi network as the Pi.
Pause - I'll come back to this later
Stop the running containers to free up memory and CPU on your Pi. Your data and workflows are preserved in Docker volumes.
- SSH into your Pi and navigate to your project directory: cd ~/ai-server.
- Stop the containers without removing them: docker compose stop.
- To resume later, run: docker compose start.
- You can also safely shut down the Pi entirely with sudo shutdown -h now. Your containers will restart when you power the Pi back on.
- Your iOS Shortcuts do not need any changes. They will work again once the containers are running.
Delete - I don't want to use this again
Remove all project resources from your Pi and Mac. This deletes your n8n workflows, Ollama models, and Docker volumes permanently.
- SSH into your Pi and navigate to the project directory: cd ~/ai-server.
- Stop and remove the containers and their volumes: docker compose down -v.
- Remove the project directory: rm -rf ~/ai-server.
- Remove the downloaded Docker images: docker image rm ollama/ollama:latest docker.n8n.io/n8nio/n8n.
- Stop and disable the x11vnc service if you set it up to start on boot.
- On your Mac, uninstall TigerVNC Viewer: brew uninstall --cask tigervnc.
- On your iPhone, open the Shortcuts app and delete the shortcuts you created (AI Workflow Architect, Pi Status, and any Secret Mission shortcuts).
- If you want to completely wipe the Pi, you can re-flash the microSD card using Raspberry Pi Imager.
Mission accomplished
That's a Wrap!
Nice work! You just built a fully functional local AI automation server on a Raspberry Pi 5. Your Pi is now running containerized AI services that you can control from your phone and your Mac, with zero cloud dependency.
Here's what you learned:
- Deployed Ollama and n8n as linked Docker containers on ARM64 Linux using a single docker-compose.yml, and ran a local LLM (Qwen2.5 1.5B) entirely on-device.
- Built an AI Workflow Architect in n8n that receives natural language descriptions via webhook and returns structured automation plans powered by Ollama.
- Set up VNC remote desktop access from your Mac and created iOS Shortcuts that trigger n8n webhooks and run SSH commands on the Pi from your phone.
- Built a complete Pi management shortcut suite with SSH-based controls for restarting containers, pulling new Ollama models, checking system stats, and more.
Ready to quiz yourself?