Setup

I’ve been a big fan of Firefly III for some time now. I was a pain to setup the first time, so here is my ‘easy’ way to set it up.

My docker compose file is about the same as the previous ones.

version: "3"                                                               

services:                                                                  
  firefly_iii_app:                                                         
    container_name: firefly_iii_app                                        
    image: jc5x/firefly-iii:latest                                         
    environment:                                                           
      - FF_DB_HOST=firefly_iii_db:3306                                     
      - FF_DB_NAME=firefly_db                                              
      - FF_DB_USER=firefly_db                                              
      - FF_DB_PASSWORD=<dbpassword>                                        
      - FF_APP_KEY=<32char key>                        
      - FF_APP_ENV=local                                                   
      - APP_URL=https://firefly.domain.com                            
      - TRUSTED_PROXIES=**                                                 
      - MAIL_DRIVER=smtp                                                   
      - MAIL_HOST=<email server>                                             
      - MAIL_PORT=587                                                      
      - MAIL_FROM=firefly@domain.com                                       
      - MAIL_USERNAME=firefly@domain.com                                   
      - MAIL_PASSWORD=<password>                                 
      - MAIL_ENCRYPTION=tls                                                
    links:                                                                 
      - firefly_iii_db                                                     
    volumes:                                                               
      - ${PWD}/export:/var/www/firefly-iii/storage/export                  
      - ${PWD}/upload:/var/www/firefly-iii/storage/upload                  
    labels:                                                                
      - "traefik.enable=true"                                              
      - "traefik.frontend.rule=Host:firefly.domain.com"               
      - "traefik.port=80"                                                  
  firefly_iii_db:                                                          
    container_name: firefly_iii_db                                         
    image: mysql:latest                                                    
    ports:                                                                 
      - 3310:3306                                                          
    environment:                                                           
      - MYSQL_DATABASE=firefly_db                                          
      - MYSQL_USER=firefly_db                                              
      - MYSQL_PASSWORD=<dbpassword>                                        
      - MYSQL_RANDOM_ROOT_PASSWORD=yes                                     
    volumes:                                                               
      - ${PWD}/mysql:/var/lib/mysql                                        
    labels:                                                                
      - "traefik.enable=false"                                             

networks:                                                                  
  default:                                                                 
    external:                                                              
      name: webproxy 

Nothing here should be new. We use a new mysql port, so we wont create conflicts when all our sql containers use port 3306. I don’t really want the sql container to be available from any subdomain, so we don’t need it to be traefik enabled.

There is a bug in Firefly currently, where we can’t send emails without a small fix. Access the container using Portainer or docker exec -it firefly_iii_app /bin/bash`and write

php -r 'print_r(openssl_get_cert_locations());' | grep '\[default_cert_file\]' | awk '{print $3}'

This should print /usr/local/ssl/cert.pem but if we check that file, it does not exist. So we need to download the file and move it there.

cd /usr/local/ssl
wget http://curl.haxx.se/ca/cacert.pem
mv cacert.pem cert.pem
exit

Now we can restart our container docker-compose restart and we can send emails from the website.