HTTPS using Caddy
HTTPS Using Caddy
Ensuring secure communication between your users and the HridaAI is paramount. HTTPS (HyperText Transfer Protocol Secure) encrypts the data transmitted, protecting it from eavesdroppers and tampering. By configuring Caddy as a reverse proxy, you can seamlessly add HTTPS to your HridaAI deployment, enhancing both security and trustworthiness.
This guide is simple walkthrough to set up a Ubuntu server with Caddy as a reverse proxy for HridaAI, enabling HTTPS with automatic certificate management.
There's a few steps we'll follow to get everything set up:
Docker
Follow the guide to set up Docker's apt repository Docker
I've included docker-compose as it's needed to run docker compose.
Here's the command I've used to install Docker on Ubuntu:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-composeHridaAI
I'd go ahead and create a directory for the HridaAI project:
mkdir -p ~/hrida-ai
cd ~/hrida-aiCreate a docker-compose.yml file in the ~/hrida-ai directory. I've left in a commented section for setting some environment varibles for Qdrant, but you can follow that for any other environment variables you might need to set.
services:
hrida-ai:
image: ghcr.io/hrida-ai/hrida-ai-studio:main
container_name: hrida-ai
ports:
- "8080:8080"
volumes:
- ./data:/app/backend/data
# environment:
# - "QDRANT_API_KEY=API_KEY_HERE"
# - "QDRANT_URI=https://example.com"
restart: unless-stoppedCaddy
Caddy is a powerful web server that automatically manages TLS certificates for you, making it an excellent choice for serving HridaAI over HTTPS.
Follow the guide to set up Caddy's on Ubuntu.
You're going to need to change the CaddyFile to use your domain.
To do that, edit the file /etc/caddy/Caddyfile.
sudo nano /etc/caddy/CaddyfileThen the configuration should have the following:
your-domain.com {
reverse_proxy localhost:8080
}
Make sure to replace your-domain.com with your actual domain name.
Testing HTTPS
Now assuming you've already set up your DNS records to point to your server's IP address, you should be able to test if HridaAI is accessible via HTTPS by running docker compose up in the ~/hrida-ai directory.
cd ~/hrida-ai
docker compose up -dhttps://your-domain.com.Caddy handles TLS certificate provisioning and renewal automatically.HridaAI Upgrade & Migration
I wanted to include a quick note on how to update HridaAI without losing your data. Since we're using a volume to store the data, you can simply pull the latest image and restart the container.
Stopping HridaAI
First we need to stop and remove the existing container:
docker rm -f hrida-aiPulling the latest image
Then you can start the container again:
docker pull ghcr.io/hrida-ai/hrida-ai-studio:mainStarting HridaAI
Now you can start the HridaAI container again:
docker compose up -d