Firefly LXC/KVM/Baremetal Install
Self-hosted financial manager.
Requirement |
Recommended |
---|---|
Memory |
512MB |
Ports
Firefly Ports
Port
Protocol
Type
Purpose
80
TCP
PUBLIC
Firefly web UI
443
TCP
PRIVATE
Firefly web UI (https)
Updated: None
Files
Firefly Files
Location
Purpose
/var/www/firefly-iii/storage/export
Exported data location
/var/www/firefly-iii/storage/upload
Uploaded docs location
Updated: None
Install
Assumes Ubuntu installed with a local user account, with backup data
mounted on /data/storage
.
Dependencies
apt install nginx curl php7.4 php7.4-cli php7.4-zip php7.4-gd php7.4-fpm php7.4-json php7.4-common php7.4-pgsql php7.4-zip php7.4-mbstring php7.4-curl php7.4-xml php7.4-bcmath php7.4-imap php7.4-ldap php7.4-intl
Set 512MB php limit.
memory_limit = 512MB
wget https://getcomposer.org/installer
chmod +x installer
./installer -- --install-dir=/usr/local/bin --filename=composer
rm /var/www/html/index.nginx-debian.html
rm /etc/nginx/sites-enabled/default
Install Versioned
Installing to a versioned directory enables easy migration to new versions.
https://api.github.com/repos/firefly-iii/firefly-iii/releases/latest
cd /var/www/html/
tar xvf firefly-iii.tar.gz
Note
Latest version: https://api.github.com/repos/firefly-iii/firefly-iii/releases/latest
This should extract to firefly-iii-{VERSION}
composer create-project grumpydictator/firefly-iii --no-dev --prefer-dist firefly-iii --no-interaction {VERSION}
sudo chown -R www-data:www-data firefly-iii
sudo chmod -R 775 firefly-iii/storage
ln -sf /var/www/html/firefly-iii-{VERSION} /var/www/html/firefly-iii
rm /var/www/html/firefly-iii-{VERSION}/storage/{export,upload}
ln -sf /var/www/html/firefly-iii-{VERSION}/storage/export /var/www/html/firefly-iii/storage/export
ln -sf /var/www/html/firefly-iii-{VERSION}/storage/upload /var/www/html/firefly-iii/storage/upload
chown -R www-data:www-data /var/www/html/firefly-iii-{VERSION}/storage/{export,upload}
chmod -R 0775 /var/www/html/firefly-iii-{VERSION}/storage
Set logrotation.
/opt/firefly-iii/storage/logs/*.log
{
weekly
missingok
rotate 2
compress
notifempty
sharedscripts
maxage 60
}
Set the NGINX configuration to server firefly.
server {
listen 80 default_server;
server_name firefly.example.com firefly;
root /var/www/html/firefly-iii/public;
index index.html index.htm index.php;
location / {
try_files $uri /index.php$is_args$args;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
fastcgi_read_timeout 240;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_split_path_info ^(.+.php)(/.+)$;
}
}
APP_KEY={KEY}
TRUSTED_PROXIES=**
DB_CONNECTION=pgsql
DB_HOST=192.168.1.10
DB_PORT=5432
DB_DATABASE=firefly
DB_USERNAME=firefly
DB_PASSWORD={PASS}
APP_URL=http://localhost
Note
APP_KEY
is alphanumeric string of 32 characters. Use
php artisan key:generate
to create it.
Set TRUSTED_PROXIES=**
to enable proxy usage.
APP_URL
this should remain localhost it does not effect proxied or
non-proxied connections. Existing documentation on the web is wrong.
Proceed to Database Config.
Database Config
Majority of cases should use the DB migration instead of initalization; only use initalization if new DB or wiping existing DB contents are ok.
rm -rf /var/www/html/firefly-iii-{VERSION}/bootstrap/cache/*
php artisan cache:clear
php artisan migrate --seed
php artisan firefly-iii:upgrade-database
php artisan passport:install
php artisan cache:clear
php artisan migrate:refresh --seed
php artisan firefly-iii:upgrade-database
php artisan passport:install
systemctl restart nginx php7.4-fpm
Updating Firefly
Install new version using the Install Versioned steps and Migrate the database.. Previous versions can be deleted.