Sep 9, 2024 3 min read

Firefly III: A Complete Checklist for Self-Hosting Success

Firefly III: A Complete Checklist for Self-Hosting Success
Table of Contents

Firefly III is a self-hosted personal finance manager designed to help users gain full control over their financial data. With features like robust budgeting tools, account tracking, and flexible reporting, it empowers individuals and teams to manage their finances securely and privately. This guide will walk you through deploying Firefly III, configuring it with a reverse proxy, enabling logging, setting up automated backups, and leveraging its unique features.

Installing Firefly III

📦 Docker/Docker Compose Setup

Docker is the most straightforward way to deploy Firefly III. Below is a docker-compose.yml file that includes all necessary configurations for Firefly III, such as database setup and persistent volumes:


version: '3.7'

services:

firefly:

image: fireflyiii/firefly-iii:latest

container_name: firefly

ports:

- "8080:8080"

environment:

- APP_KEY=base64:GENERATE_YOUR_OWN_KEY

- DB_HOST=firefly_db

- DB_PORT=3306

- DB_DATABASE=firefly

- DB_USERNAME=firefly_user

- DB_PASSWORD=firefly_password

depends_on:

- firefly_db

volumes:

- firefly_data:/var/www/html/storage

restart: always

firefly_db:

image: mariadb:10.6

container_name: firefly_db

environment:

- MYSQL_ROOT_PASSWORD=root_password

- MYSQL_DATABASE=firefly

- MYSQL_USER=firefly_user

- MYSQL_PASSWORD=firefly_password

volumes:

- db_data:/var/lib/mysql

restart: always

volumes:

firefly_data:

db_data:

Run the following commands to set up and deploy Firefly III:


mkdir firefly-iii && cd firefly-iii

nano docker-compose.yml   # Paste the above content

docker-compose up -d

🚀 Manual Installation

To install Firefly III without Docker, follow these steps for a Linux-based server:

  1. Install PHP and Composer:

sudo apt update && sudo apt install -y php-cli php-fpm php-mysql unzip curl composer

  1. Clone the Firefly III Repository:

git clone https://github.com/firefly-iii/firefly-iii.git

cd firefly-iii

composer install --no-dev

  1. Configure Environment:

cp .env.example .env

nano .env

Configure database settings and generate the APP_KEY:


php artisan key:generate

  1. Set Up Permissions:

chmod -R 775 storage bootstrap/cache

chown -R www-data:www-data storage bootstrap/cache

  1. Serve Firefly III:

php artisan serve --host=0.0.0.0 --port=8080

Configuring Nginx as a Reverse Proxy

🌐 Nginx Configuration

To serve Firefly III over HTTP(S), use the following Nginx configuration file:


server {

listen 80;

server_name your-domain.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;

proxy_set_header X-Forwarded-Proto $scheme;

}

}

Save this configuration to /etc/nginx/sites-available/firefly and enable it:


ln -s /etc/nginx/sites-available/firefly /etc/nginx/sites-enabled/

nginx -t && systemctl reload nginx

🔒 SSL/TLS Setup

Secure your site with Let's Encrypt:


sudo apt install certbot python3-certbot-nginx

sudo certbot --nginx -d your-domain.com

Automate certificate renewals by adding this to your crontab:


0 3 * * * certbot renew --quiet

Logging and Debugging Firefly III

🗃️ Enabling Debug Logs

To enable debug logs, update the .env file:


APP_DEBUG=true

LOG_LEVEL=debug

Then restart the application:


docker restart firefly

📄 Viewing Logs

For Docker-based installations, view logs with:


docker logs -f firefly

For manual installations:


tail -f storage/logs/laravel.log

🛠️ Troubleshooting Common Issues

If Firefly III fails to start, check database connectivity or missing environment variables. Look for errors like Database connection refused in the logs and validate your .env configuration.

📤 Exporting Logs

To integrate with an ELK stack, forward logs via Filebeat:


sudo apt install filebeat

sudo nano /etc/filebeat/filebeat.yml

Configure filebeat.yml to monitor storage/logs/laravel.log and restart Filebeat.

Backup and Restore

🗂️ File-Based Backups

To back up Firefly III files:


tar -czvf firefly-backup.tar.gz /path/to/firefly-iii/storage

🔄 Database Backups

For Docker setups:


docker exec firefly_db mysqldump -u firefly_user -pfirefly_password firefly > firefly_db.sql

For manual installations:


mysqldump -u firefly_user -p firefly > firefly_db.sql

📅 Automated Backup Scripts

Create a scheduled backup using cron:


crontab -e

Add the following:


0 2 * * * docker exec firefly_db mysqldump -u firefly_user -pfirefly_password firefly > /backups/firefly_$(date +\%F).sql

Updating and Upgrading Firefly III

⬆️ Updating Docker Images

Pull the latest image and redeploy:


docker-compose pull

docker-compose down

docker-compose up -d

🛠️ Manual Updates

For manual installations, pull the latest code:


git pull origin main

composer install --no-dev

php artisan migrate --force

🔍 Checking for Updates

Regularly check the Firefly III repository for new releases:


git fetch

git log HEAD..origin/main

Leveraging Firefly III’s Unique Features

🔧 Enabling APIs

Enable API access in the .env file:


API_ENABLED=true

Use the Firefly III API with curl:


curl -H "Authorization: Bearer YOUR_API_TOKEN" https://your-domain.com/api/v1/accounts

🌟 Advanced Configurations

Integrate with third-party tools, such as exporting data to external platforms. For example, to enable CSV exports, ensure your storage directory is writable:


chmod -R 775 storage/export

Wrapping Up

Firefly III is a powerful and flexible tool for managing personal finances with full control over your data. By following this guide, you’ve learned how to deploy, secure, and maintain Firefly III, as well as how to leverage its advanced features. Start taking full advantage of your self-hosted setup today!

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.