Update: Quickstart Slowstart
Here’s a concise punchlist to set up a new macOS machine with Ollama running DeepSeek on port 8080, exposed via ngrok, with the port change made permanent:
Punchlist for New Machine Setup
- Install Ollama bash
curl -fsSL https://ollama.com/install.sh | sh
- Pull DeepSeek Model bash
ollama pull deepseek-r1
- Set OLLAMA_HOST Temporarily (Test) bash
export OLLAMA_HOST="0.0.0.0:8080"
- Start Ollama on Port 8080 bash
ollama serve
- Test Ollama Locally bash
curl http://localhost:8080
- Make OLLAMA_HOST Permanent (zsh) bash
echo 'export OLLAMA_HOST="0.0.0.0:8080"' >> ~/.zshrc source ~/.zshrc
OR for bash (if applicable): bashecho 'export OLLAMA_HOST="0.0.0.0:8080"' >> ~/.bash_profile source ~/.bash_profile
- Verify Persistence bash
echo $OLLAMA_HOST
- Install Ngrok (if not installed) bash
brew install ngrok/ngrok/ngrok
- Set Ngrok Authtoken (replace YOUR_TOKEN) bash
ngrok config add-authtoken YOUR_TOKEN
- Start Ngrok Tunnel to 8080 bash
ngrok http 8080
- Test Ngrok Tunnel (replace with your ngrok URL) bash
curl https://your-ngrok-url
- Test DeepSeek via Ngrok (replace with your ngrok URL) bash
curl https://your-ngrok-url/api/generate -d '{"model": "deepseek-r1", "prompt": "Test from ngrok"}'
Notes
- Replace YOUR_TOKEN with your ngrok authtoken.
- Replace your-ngrok-url with the forwarding URL from ngrok (e.g., https://abc123.ngrok.app).
- Use zsh commands unless echo $SHELL shows /bin/bash, then use bash alternatives.
- Run commands in order; skip installation steps if tools are already present.
At this point you can talk to Deepseek through Terminal. To create an app interface, you need to basically build a local HTML-engine app (Electron) because using a browser creates too many headaches with local security.
So you can do this. I would just copy and paste the below into your AI of choice and you’ll get all the spelled out how-to steps in better detail.
Steps to Create an Electron App for Ollama/Deepseek
- Install Prerequisites:
- Install Node.js and npm if not already installed.
- Create Project Directory:bashCopyEdit
mkdir deepseek-chat cd deepseek-chat
- Initialize Node.js Project:bashCopyEdit
npm init -y
- Install Electron:bashCopyEdit
npm install electron --save-dev
- Create Main Application File:
- Create
main.js
:
const { app, BrowserWindow } = require('electron'); function createWindow() { const win = new BrowserWindow({ width: 800, height: 600, webPreferences: { nodeIntegration: true, contextIsolation: false, }, }); win.loadFile('index.html'); } app.whenReady().then(createWindow);
- Create
- Create HTML File:
- Create
index.html
with a chat interface that interacts with the Deepseek API:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Deepseek Chat</title> <style> /* Add styles here */ </style> </head> <body> <div id="chat"></div> <input type="text" id="input" placeholder="Type your message here..." /> <button id="sendButton">Send</button> <div id="response"></div> <script> /* Add JavaScript for API calls and formatting */ </script> </body> </html>
- Create
- Set Up API Call:
- In the
<script>
section, implement thesendQuery
function to send requests to your Ollama/Deepseek server via ngrok:
const apiUrl = "https://0eaf-96-239-72-6.ngrok-free.app/api/generate"; async function sendQuery() { // Handle sending input to the API and displaying the response }
- In the
- Update
package.json
:- Ensure the entry point is set to
main.js
:
"main": "main.js",
- Ensure the entry point is set to
- Add Start Script:
- Modify the scripts section in
package.json
to include:
"scripts": { "start": "electron ." }
- Modify the scripts section in
- Run Your App:bashCopyEdit
npm start
- Format Output:
- Improve the readability of responses by adding HTML formatting, CSS classes, and replacing newline characters with
<br>
tags.
- Improve the readability of responses by adding HTML formatting, CSS classes, and replacing newline characters with
- Test and Debug:
- Use the developer tools in Electron to debug and ensure the application works as expected. Monitor the Ollama server logs for incoming requests.
Final Notes
- Make sure your Ollama server is running and accessible via the ngrok URL.
- Adjust the API call in your Electron app to match the expected structure and endpoint of your Deepseek server.