Oct 19, 2024 3 min read

Teedy: Self-Hosting Made Simple

Teedy: Self-Hosting Made Simple
Table of Contents

Teedy is a lightweight, open-source document management system designed for simplicity, efficiency, and complete self-hosting control. It empowers users to organize, search, and manage documents effortlessly while maintaining full data ownership. In this guide, we’ll walk you through installing Teedy, configuring it with a reverse proxy, enabling logging, setting up backups, updating the app, and leveraging its unique features to maximize its potential.

Installing Teedy

πŸ“¦ Docker/Docker Compose Setup

Using Docker Compose is the easiest way to deploy Teedy with minimal effort. Here’s the process:

  1. Create the docker-compose.yml file:

version: '3.7'

services:

teedy:

image: sismics/docs:latest

container_name: teedy

ports:

- "8080:8080" # Expose port 8080 for external access

volumes:

- teedy-data:/var/lib/teedy # Persistent data storage

environment:

- DOCS_TIMEZONE=UTC # Set the timezone (adjust as needed)

volumes:

teedy-data:

  1. Deploy Teedy:

mkdir teedy && cd teedy

nano docker-compose.yml  # Paste the content above

docker-compose up -d

This will start Teedy on port 8080. You can access it via http://<your-server-ip>:8080.

πŸš€ Manual Installation

If you prefer a manual setup on a Linux server, follow these steps:

  1. Install Java (Teedy requires Java 8+):

sudo apt update

sudo apt install openjdk-11-jre -y

  1. Download Teedy:

wget https://github.com/sismics/docs/releases/latest/download/teedy.jar -O teedy.jar

  1. Run Teedy:

java -jar teedy.jar

By default, Teedy will run on port 8080. You can customize options like port and database in the configuration file.

Configuring Nginx as a Reverse Proxy

🌐 Nginx Configuration

Set up Nginx to route traffic from a domain to Teedy:

  1. Create an Nginx server block:

sudo nano /etc/nginx/sites-available/teedy

  1. Add this configuration:

server {

listen 80;

server_name yourdomain.com;

location / {

proxy_pass http://localhost:8080;

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

}

}

  1. Enable the configuration:

sudo ln -s /etc/nginx/sites-available/teedy /etc/nginx/sites-enabled/

sudo nginx -t

sudo systemctl reload nginx

πŸ”’ SSL/TLS Setup

Secure your Teedy installation with HTTPS:

  1. Install Certbot for Let’s Encrypt:

sudo apt install certbot python3-certbot-nginx -y

  1. Obtain and configure an SSL certificate:

sudo certbot --nginx -d yourdomain.com

  1. Set up automatic renewal:

sudo systemctl enable certbot.timer

Logging and Debugging Teedy

πŸ—ƒοΈ Enabling Debug Logs

To enable debug logging in Teedy, edit its configuration:

  1. Create or edit the configuration file:

nano config.properties

  1. Add debug logging:

log.level=DEBUG

  1. Restart Teedy:

docker restart teedy

## If running manually

java -jar teedy.jar

πŸ“„ Viewing Logs

Access logs to monitor Teedy’s behavior:

  1. With Docker:

docker logs teedy

  1. With manual setup:

tail -f logs/teedy.log

πŸ› οΈ Troubleshooting Common Issues

  • Port conflicts: Check if another service is using port 8080.

sudo lsof -i :8080

  • Database connection errors: Ensure the database service is running and accessible.

πŸ“€ Exporting Logs

To export logs for external analysis:


docker logs teedy > teedy_logs.txt

Backup and Restore

πŸ—‚οΈ File-Based Backups

Backup Teedy’s configuration and data files:


tar -czvf teedy-backup.tar.gz /var/lib/docker/volumes/teedy-data/

πŸ”„ Database Backups

If using a database (e.g., PostgreSQL), back it up:


docker exec -it postgres pg_dump -U username teedydb > teedy-db-backup.sql

To restore:


docker exec -i postgres psql -U username teedydb < teedy-db-backup.sql

πŸ“… Automated Backup Scripts

Set up a cron job for periodic backups:


sudo crontab -e

Add:


0 2 * * * tar -czvf /backups/teedy-$(date +\%F).tar.gz /var/lib/docker/volumes/teedy-data/

Updating and Upgrading Teedy

⬆️ Updating Docker Images

  1. Pull the latest Teedy image:

docker-compose pull

  1. Recreate the container:

docker-compose down

docker-compose up -d

πŸ› οΈ Manual Updates

  1. Download the latest JAR:

wget https://github.com/sismics/docs/releases/latest/download/teedy.jar -O teedy.jar

  1. Restart the application:

java -jar teedy.jar

πŸ” Checking for Updates

Monitor the GitHub repository for releases:


https://github.com/sismics/docs/releases

Leveraging Teedy’s Unique Features

πŸ”§ Enabling APIs

Teedy provides an API for integrations and automation:

  1. Enable the API:

api.enabled=true

  1. Test the API:

curl -X GET http://localhost:8080/api

  1. Use with scripts:

import requests

response = requests.get("http://localhost:8080/api")

print(response.json())

🌟 Advanced Configurations

  • Custom storage paths: Change the default storage directory in config.properties.

storage.path=/custom/path

  • Database integration: Configure Teedy to use PostgreSQL or MySQL for scalability.

Wrapping Up

In this guide, we’ve covered installing, configuring, and managing Teedy, a powerful self-hosted document management system. With its lightweight design and robust features, Teedy is ideal for users who value simplicity and control. Start implementing these steps today to create a fully functional and secure document management environment tailored to your needs. Happy hosting!

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to Selfhosted Ninja.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.