153 lines
6.6 KiB
Plaintext
153 lines
6.6 KiB
Plaintext
Create user and group
|
|
---------------------
|
|
Credentials -> Local Users -> Add
|
|
Full Name: fireflyiii
|
|
Username: firefly3
|
|
Disable Password: <select>
|
|
Email: stuurmcp@telkomsa.net
|
|
UID: (note)
|
|
Create New Primary Group: <unselect>
|
|
Primary Group: media
|
|
Create Home Directory: <uncheck>
|
|
Samba Authentication: <uncheck>
|
|
Save
|
|
|
|
firefly3 UID: 3035
|
|
firefly3 GID: 3034
|
|
|
|
Create datasets
|
|
---------------
|
|
# In Truenas shell:
|
|
# list datasets
|
|
zfs list | grep -i "docker.*fireflyiii"
|
|
# create following dataset if not present
|
|
zfs create SSD1/docker/data/fireflyiii
|
|
zfs create SSD1/docker/data/fireflyiii/config
|
|
zfs create SSD1/docker/data/fireflyiii/appdata
|
|
zfs create SSD1/docker/data/fireflyiii/pgdata
|
|
zfs create SSD1/docker/data/fireflyiii/pgbackups
|
|
# chown -R firefly3:firefly3 /mnt/SSD1/docker/data/fireflyiii
|
|
chown -R 33:33 /mnt/SSD1/docker/data/fireflyiii # seems like fireflyiii lately fails if not using www-data uid and gid
|
|
chown -R postgres:postgres /mnt/SSD1/docker/data/fireflyiii/pgdata
|
|
chown -R postgres:postgres /mnt/SSD1/docker/data/fireflyiii/pgbackups
|
|
|
|
Copy folder to docker stacks
|
|
----------------------------
|
|
In Windows cmd shell in fireflyiii folder, enter:
|
|
./cp2nas
|
|
# or
|
|
pscp -P 22 -r stacks/*.* root@192.168.2.2:/mnt/SSD1/docker/stacks/fireflyiii/
|
|
|
|
Create data folders
|
|
-------------------
|
|
mkdir /mnt/data/fireflyiii/config
|
|
mkdir /mnt/data/fireflyiii/transcodes
|
|
cd /mnt/data/fireflyiii
|
|
|
|
Create secrets folder
|
|
---------------------
|
|
mkdir -p /opt/stacks/fireflyiii/secrets
|
|
|
|
Create secrets
|
|
--------------
|
|
In Truenas shell:
|
|
cd /mnt/SSD1/docker/stacks/fireflyiii/secrets
|
|
echo -n 'your_mail_host' > /mnt/SSD1/docker/stacks/fireflyiii/secrets/fireflyiii_mail_host
|
|
echo -n 'your_sender_addr' > /mnt/SSD1/docker/stacks/fireflyiii/secrets/fireflyiii_mail_from
|
|
echo -n 'your_mail_username' > /mnt/SSD1/docker/stacks/fireflyiii/secrets/fireflyiii_mail_username
|
|
echo -n 'your_mail_password' > /mnt/SSD1/docker/stacks/fireflyiii/secrets/fireflyiii_mail_password
|
|
echo -n 'your_site_owner' > /mnt/SSD1/docker/stacks/fireflyiii/secrets/fireflyiii_site_owner
|
|
# WARNING: Do not regenerate/change db password after starting firefly, as firefly will fail on authentication to database
|
|
echo -n 'your_db_database' > /mnt/SSD1/docker/stacks/fireflyiii/secrets/fireflyiii_postgresql_database
|
|
echo -n 'your_db_username' > /mnt/SSD1/docker/stacks/fireflyiii/secrets/fireflyiii_postgresql_username
|
|
openssl rand 36 | base64 -w 0 > /mnt/SSD1/docker/stacks/fireflyiii/secrets/fireflyiii_postgresql_password
|
|
# The next two secrets must be trimmed to exactly 32 characters:
|
|
openssl rand 32 | base64 -w 0 | sed 's/[\$,\#,/,+,=]//g' | cut -c -32 | tr -d '\n' > /mnt/SSD1/docker/stacks/fireflyiii/secrets/fireflyiii_app_key
|
|
openssl rand 32 | base64 -w 0 | sed 's/[\$,\#,/,+,=]//g' | cut -c -32 | tr -d '\n' > /mnt/SSD1/docker/stacks/fireflyiii/secrets/fireflyiii_static_cron_token
|
|
# restrict access
|
|
cd /mnt/SSD1/docker/stacks/fireflyiii
|
|
# chown -R firefly3:firefly3 /mnt/SSD1/docker/stacks/fireflyiii/secrets/
|
|
chown -R 33:33 /mnt/SSD1/docker/stacks/fireflyiii/secrets/ # seems like fireflyiii lately fails if not using www-data uid and gid
|
|
chmod -R 400 secrets/
|
|
# read existing acl permissions, if any
|
|
getfacl /mnt/SSD1/docker/stacks/fireflyiii/secrets
|
|
# set acl permissions
|
|
setfacl -m u:postgres:4 /mnt/SSD1/docker/stacks/fireflyiii/secrets
|
|
setfacl -m u:postgres:4 /mnt/SSD1/docker/stacks/fireflyiii/secrets/fireflyiii_postgresql_password
|
|
setfacl -m u:postgres:4 /mnt/SSD1/docker/stacks/fireflyiii/secrets/fireflyiii_postgresql_username
|
|
setfacl -m u:postgres:4 /mnt/SSD1/docker/stacks/fireflyiii/secrets/fireflyiii_postgresql_database
|
|
# NB! if you want to remove all acl entries from a folder recursively, use setfacl -b -R <foldername>
|
|
|
|
Backup fireflyiii database
|
|
--------------------------
|
|
In truenas shell:
|
|
mkdir /mnt/stpool1/apps/pgadmin/storage/stuurmcp_telkomsa.net/$(date -I)
|
|
chown pgadmin:pgadmin /mnt/stpool1/apps/pgadmin/storage/stuurmcp_telkomsa.net/$(date -I)
|
|
Using browser, log in to pgAdmin on truenas
|
|
Connect to servers; refer to "connecting to servers.txt", which also explains how to obtain db passwords
|
|
To perform plain text backup:
|
|
Navigate to Servers => fireflyiii -> Databases -> fireflyiii
|
|
Right click on fireflyiii database and select Backup...
|
|
Enter the following on the different tabs of dialog box that opened:
|
|
General:
|
|
Replace ##### with today's date in YYYY-MM-DD format
|
|
Filename: /#####/fireflyiii-backup.sql (this maps to: /mnt/stpool1/apps/pgadmin/storage/stuurmcp_telkomsa.net/#####/fireflyiii-backup.sql on truenas)
|
|
Format: Plain
|
|
Encoding: UTF8
|
|
Role name: firefly
|
|
Data Options:
|
|
Sections:
|
|
Pre-data: <select>
|
|
Data: <select>
|
|
Post-data: <select>
|
|
Objects:
|
|
Check public to select all objects
|
|
Click Backup
|
|
After successfull backup, close pgAdmin on truenas
|
|
|
|
Migrating database
|
|
------------------
|
|
# Refresh Dockge window/tab and start fireflyiii in Dockge
|
|
# After successfull startup of fireflyiii and postgress, stop fireflyiii from docker cmd line
|
|
docker stop firefly
|
|
# In truenas shell
|
|
# copy back up file(s) to fireflyiii backups folder
|
|
cp -vr /mnt/stpool1/apps/pgadmin/storage/stuurmcp_telkomsa.net/$(date -I) /mnt/SSD1/docker/data/fireflyiii/pgbackups #replace $(date -I) with date when backup was made if not today
|
|
jlmkr shell docker
|
|
cd /mnt/data/fireflyiii
|
|
# remove all files/folders from pgdata; if any are already in this folder, move it to another folder before executing next command
|
|
rm -r /mnt/data/fireflyiii/pgdata/*
|
|
# Start fireflyiii with Dockge, then:
|
|
docker stop firefly
|
|
docker exec firefly_postgresql psql -U firefly -d postgres -c "DROP DATABASE \"firefly\";"
|
|
docker exec firefly_postgresql psql -U firefly -d postgres -c "CREATE DATABASE \"firefly\";"
|
|
docker exec firefly_postgresql psql -U firefly -d firefly -f /mnt/backups/$(date -I)/fireflyiii-backup.sql
|
|
docker start firefly
|
|
|
|
Post startup if no migration was performed
|
|
-------------------------------------------
|
|
# https://docs.firefly-iii.org/references/faq/install/
|
|
# The documentation mentions the following to initialise / seed the database on a clean install:
|
|
# In docker shell:
|
|
docker exec firefly php artisan migrate:refresh --seed --force
|
|
docker exec firefly php artisan firefly-iii:upgrade-database
|
|
|
|
Stop truenas fireflyiii
|
|
-----------------------
|
|
# In truenas shell
|
|
heavyscript app --stop fireflyiii
|
|
# NB: Do NOT stop fireflyiii with truenas gui
|
|
|
|
Troubleshooting
|
|
---------------
|
|
# If you get persistent db authentication errors:
|
|
Ensure that the service name (name of the stanza), host name and container name of the postgresql container in the compose.yml file and the DB_HOST value in the .env file are all the same
|
|
|
|
If you need to log into db
|
|
--------------------------
|
|
docker exec -it firefly_postgresql bash
|
|
psql -U firefly -d firefly
|
|
|
|
|
|
|