==========================
Introduction
Cloudflare Tunnels provide a secure and reliable way to expose your local Ollama instance, enabling 24/7 free drip without worrying about IP exposure or port forwarding. This page outlines the steps to set up a stable Cloudflare Tunnel for your Apiary platform.
Prerequisites
- A registered Cloudflare account
- An active Ollama instance on your local machine
- Basic understanding of Linux/Unix shell commands
Step 1: Create a Cloudflare Tunnel
- Log in to your Cloudflare account and navigate to the Tunnels section.
- Click on Create Tunnel and select Local Environment as the tunnel type.
- Choose the Ollama instance you want to expose (e.g.,
ollama-dev). - Set a unique name for your tunnel (e.g.,
apiary-tunnel) and click Create.
Step 2: Configure Cloudflare Tunnel
- Go back to the Tunnels section and click on the three dots next to your newly created tunnel.
- Select Edit Tunnel and scroll down to the Configuration tab.
- Set the Service Name to
ollama(or any other name you prefer). - Under Path, enter
/apiary/*to expose all subdirectories ofapiary. - Click Save Changes.
Step 3: Generate Cloudflare Tunnel Credentials
- Go back to the Tunnels section and click on the three dots next to your tunnel.
- Select Get Credentials and copy the generated credentials (i.e.,
TUNNEL_IDandTUNNEL_SECRET). - Store these credentials securely, as you will need them later.
Step 4: Configure Ollama for Cloudflare Tunnel
- Navigate to your Ollama instance's configuration file (
ollama.confor equivalent). - Add the following lines under the
[cloudflare]section:
tunnel_id = YOUR_TUNNEL_ID
tunnel_secret = YOUR_TUNNEL_SECRET
- Replace
YOUR_TUNNEL_IDandYOUR_TUNNEL_SECRETwith the actual credentials you generated earlier.
Step 5: Verify Cloudflare Tunnel Setup
- Restart your Ollama instance to apply the configuration changes.
- Use a tool like
curlor a web browser to test the exposed API endpoint:
curl http://apiary-tunnel.yourdomain.com/apiary/your-endpoint
This should return the expected response from your Ollama instance.
Conclusion
Congratulations! You have successfully set up a Cloudflare Tunnel for your Apiary platform. This will enable 24/7 free drip and secure exposure of your local Ollama instance without IP exposure or port forwarding concerns.
Sources
Related Pages
- apiary-platform-setup: Setting up the Apiary platform for bee conservation and self-governing AI agents.
- ollama-installation: Installing Ollama on your local machine.