🔧 Introduction

FOSSBilling is an open-source billing and client management platform perfect for freelancers, hosting providers, and SaaS projects. In this guide, we’ll walk through deploying FOSSBilling using Coolify v4, Docker Compose, and Traefik for automatic SSL and subdomain routing.


🚀 Deployment Overview

✅ Prerequisites

  • A VPS (e.g., any cloud provider)
  • Docker + Coolify v4 installed
  • Traefik enabled in Coolify
  • A domain (e.g., billing.example.com) with DNS A record pointing to your VPS (DNS Only in Cloudflare)

📄 Docker Compose Configuration

In Coolify, go to your project and select “Docker Compose Empty”.

Use the following configuration:

version: '3.8'

services:
  fossbilling:
    image: fossbilling/fossbilling:latest
    container_name: fossbilling
    restart: always
    depends_on:
      - db
    environment:
      - DB_HOST=db
      - DB_PORT=3306
      - DB_NAME=fossbilling
      - DB_USER=fossuser
      - DB_PASSWORD=strongpassword
    volumes:
      - fossbilling-data:/var/www/html
    labels:
      - traefik.enable=true
      - traefik.http.routers.fossbilling.rule=Host(`billing.example.com`)
      - traefik.http.routers.fossbilling.entrypoints=websecure
      - traefik.http.routers.fossbilling.tls=true
      - traefik.http.services.fossbilling.loadbalancer.server.port=80

  db:
    image: mariadb:10.5
    container_name: fossbilling-db
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: rootpassword
      MYSQL_DATABASE: fossbilling
      MYSQL_USER: fossuser
      MYSQL_PASSWORD: strongpassword
    volumes:
      - fossbilling-db:/var/lib/mysql

volumes:
  fossbilling-data:
  fossbilling-db:

🌐 DNS Setup

In your DNS provider (e.g., Cloudflare):

TypeNameValueProxy
AbillingVPS IP addressDNS Only ⚪

🧰 Post-Installation Tasks

Once deployed, open:

https://billing.example.com/install/install.php

Use These Database Details:

  • Host: db
  • Port: 3306
  • DB Name: fossbilling
  • User: fossuser
  • Password: strongpassword

✅ After Installation – Important!

Run these commands inside the FOSSBilling container:

docker exec -it fossbilling bash
rm -rf /var/www/html/install
chmod 644 /var/www/html/config.php

Then set up a cron job:

apt update && apt install cron -y
echo "*/5 * * * * php /var/www/html/cron.php" >> /etc/crontab
service cron start
exit

⚠️ Troubleshooting Login

If you get a 401 error after install, make sure you’re logging in at the staff/admin dashboard, not the client portal:

  • Admin login: https://billing.example.com/admin
  • Client portal: https://billing.example.com/

🎉 Conclusion

You now have a fully functional, secure, Dockerized instance of FOSSBilling with automatic SSL and domain routing, all managed through Coolify. Ready to handle clients, invoices, and subscriptions from a beautiful open-source UI.


EngineerHow.com Recommended

Deployed by: EngineerHow.com – Learn how to host your own tools & take full control of your infrastructure!

© 2024 EngineerHow – Self-Hosting | Automation | DevOps