IceWhaleTech / CasaOS-AppStore

Manifest files for CasaOS Apps
Apache License 2.0
194 stars 346 forks source link

[App Request] Firefly III #402

Open ThalesADAmaral opened 10 months ago

ThalesADAmaral commented 10 months ago

App Information

Why do you want this app?

I don't think there is a more complete option than this application for managing personal finances. Another detail is that it is extremely difficult to install on CasaOS (I haven't managed it so far because I'm a newbie) and I can't find tutorials for either CasaOS or portainer, which help me when installing.

Additional information?

yml file: https://raw.githubusercontent.com/firefly-iii/docker/main/docker-compose.yml

.env: https://raw.githubusercontent.com/firefly-iii/firefly-iii/main/.env.example

.db.env: https://raw.githubusercontent.com/firefly-iii/docker/main/database.env

jkano commented 9 months ago

This is how I manage to install Firefly III in CasaOS using manual install:

  1. Click on the + button and Install a customized app
  2. Click on the import button (located on the top right, next to the X to close)
  3. In the Docker Compose Window paste the following:
    View file

firefly.yml

version: '3.3'

services:
  firefly:
    image: fireflyiii/core:latest
    hostname: app
    container_name: firefly-core
    restart: always
    volumes:
      - firefly_upload:/var/www/html/storage/upload
    networks:
      - firefly
    ports:
      - 80:8080
    depends_on:
      - db
    labels:
      icon: https://winsomnia.net/assets/icons/Firefly-iii.jpg
    environment:
      - ALLOW_WEBHOOKS=false
      - APP_DEBUG=true
      - APP_ENV=local
      - APP_KEY=<YOUR_KEY>
      - APP_LOG_LEVEL=notice
      - APP_NAME=Firefly
      - APP_URL=<YOUR_APP_URL>
      - AUDIT_LOG_CHANNEL=
      - AUDIT_LOG_LEVEL=emergency
      - AUTHENTICATION_GUARD=web
      - AUTHENTICATION_GUARD_EMAIL=
      - AUTHENTICATION_GUARD_HEADER=REMOTE_USER
      - BROADCAST_DRIVER=log
      - CACHE_DRIVER=file
      - CACHE_PREFIX=firefly
      - COOKIE_DOMAIN=
      - COOKIE_PATH=/
      - COOKIE_SAMESITE=lax
      - COOKIE_SECURE=false
      - CUSTOM_LOGOUT_URL=
      - DB_CONNECTION=mysql
      - DB_DATABASE=firefly
      - DB_HOST=db
      - DB_PASSWORD=dbpassword
      - DB_PORT=3306
      - DB_SOCKET=
      - DB_USERNAME=firefly
      - DEFAULT_LANGUAGE=en_US
      - DEFAULT_LOCALE=equal
      - DEMO_PASSWORD=
      - DEMO_USERNAME=
      - DISABLE_CSP_HEADER=false
      - DISABLE_FRAME_HEADER=false
      - DKR_BUILD_LOCALE=false
      - DKR_CHECK_SQLITE=true
      - DKR_RUN_MIGRATION=true
      - DKR_RUN_PASSPORT_INSTALL=true
      - DKR_RUN_REPORT=true
      - DKR_RUN_UPGRADE=true
      - DKR_RUN_VERIFY=true
      - ENABLE_EXTERNAL_MAP=false
      - ENABLE_EXTERNAL_RATES=false
      - FIREFLY_III_LAYOUT=v1
      - IPINFO_TOKEN=
      - LOG_CHANNEL=stack
      - MAIL_ENCRYPTION=null
      - MAIL_FROM=changeme@example.com
      - MAIL_HOST=null
      - MAIL_MAILER=log
      - MAIL_PASSWORD=null
      - MAIL_PORT=2525
      - MAIL_SENDMAIL_COMMAND=
      - MAIL_USERNAME=null
      - MAILGUN_DOMAIN=
      - MAILGUN_ENDPOINT=api.mailgun.net
      - MAILGUN_SECRET=
      - MANDRILL_SECRET=
      - MAP_DEFAULT_LAT=51.983333
      - MAP_DEFAULT_LONG=5.916667
      - MAP_DEFAULT_ZOOM=6
      - MYSQL_SSL_CA=
      - MYSQL_SSL_CAPATH=/etc/ssl/certs/
      - MYSQL_SSL_CERT=
      - MYSQL_SSL_CIPHER=
      - MYSQL_SSL_KEY=
      - MYSQL_SSL_VERIFY_SERVER_CERT=true
      - MYSQL_USE_SSL=false
      - PAPERTRAIL_HOST=
      - PAPERTRAIL_PORT=
      - PASSPORT_PRIVATE_KEY=
      - PASSPORT_PUBLIC_KEY=
      - PGSQL_SCHEMA=public
      - PGSQL_SSL_CERT=null
      - PGSQL_SSL_CRL_FILE=null
      - PGSQL_SSL_KEY=null
      - PGSQL_SSL_MODE=prefer
      - PGSQL_SSL_ROOT_CERT=null
      - PUSHER_ID=
      - PUSHER_KEY=
      - PUSHER_SECRET=
      - QUEUE_DRIVER=sync
      - REDIS_CACHE_DB=1
      - REDIS_DB=0
      - REDIS_HOST=127.0.0.1
      - REDIS_PASSWORD=
      - REDIS_PATH=
      - REDIS_PORT=6379
      - REDIS_SCHEME=tcp
      - REDIS_USERNAME=
      - SEND_ERROR_MESSAGE=true
      - SEND_REPORT_JOURNALS=true
      - SESSION_DRIVER=file
      - SITE_OWNER=<YOUR_EMAIL>
      - SPARKPOST_SECRET=
      - STATIC_CRON_TOKEN=<STATIC_CRON_TOKEN>
      - TRACKER_SITE_ID=
      - TRACKER_URL=
      - TRUSTED_PROXIES=**
      - TZ=<YOUR_TIMEZONE_HERE>
      - VALID_URL_PROTOCOLS=

  db:
    image: mariadb:lts
    hostname: db
    container_name: firefly-db
    restart: always
    networks:
      - firefly
    volumes:
      - firefly_db:/var/lib/mysql
    labels:
      icon: https://winsomnia.net/assets/icons/Firefly-iii.jpg
    environment:
      - MYSQL_DATABASE=firefly
      - MYSQL_PASSWORD=dbpassword
      - MYSQL_RANDOM_ROOT_PASSWORD=yes
      - MYSQL_USER=firefly

  cron:
    image: alpine
    hostname: cron
    container_name: firefly-cron
    restart: always
    networks:
      - firefly
    labels:
      icon: https://winsomnia.net/assets/icons/Firefly-iii.jpg
    command: 
      - sh
      - -c
      - echo "0 3 * * * wget -qO- http://app:8080/api/v1/cron/<STATIC_CRON_TOKEN>" | crontab - && crond -f -L /dev/stdout

volumes:
   firefly_iii_upload:
   firefly_iii_db:

networks:
  firefly:
    name: firefly
    driver: bridge

  1. You will see a warning about needing to configure other things, it's fine, click Ok

  2. Now you will have the following window (DO NOT CLICK INSTALL YET)

  3. First give the App a name on the Title field

  4. Now add the web UI host and port (i.e. 192.168.1.32 : 80)

    Note: If you change the port here you MUST change it in the Port section too.

  5. Now you have to change some other things in the Environment Variables section:

  1. Now, go to the db tab above and change the environment variables if you need to (like the DB password if you changed it above):

  2. Finally go to the cron tab above and under container command you will see a __ that you MUST replace with the token you generated in step 8.

  3. Click on Install, if everything is fine, now you should see the Installing window

  4. After install is complete now you can navigate to your instance in the HOST:PORT address you configured:

Note: One thing to notice is that CasaOS doesn't have support for env files right now so better is to create a _dockercompose.yml file with every environment variable in the environment section and import it to CasaOS.

Hope this helps!

If you need help don't hesitate on comment here.

ThalesADAmaral commented 8 months ago

Thank you so much @jkano ! I will try to install in the next days and i will post here the result

ThalesADAmaral commented 8 months ago

image

@jkano , it worked!! Thank you so much!

I only noticed now, but the app is with this strange name on it (as the image shows). I'm asking my self now, have i done something wrong?

Other question: How do i keep the app updated (or it's automatically updated)?

And, for last, i didn't get it when you said:

Note: One thing to notice is that CasaOS doesn't have support for env files right now so better is to create a docker_compose.yml file with every environment variable in the environment section and import it to CasaOS.

If it's working, do i need to do something else?

jkano commented 8 months ago

@regassa22 glad it worked for you!

Regarding the app name, did you fill the Title field in step 6? I think if you don’t add a title it will put the random generated name that Docker puts to the container.

You can check if it has a name by clicking the three dots in the app icon and clicking on Settings:

Settings

Then, inside firefly settings (make sure the selected tab is firefly) you can set a name for the App (Title field) and save it:

Firefly name

And about last part (my comment about the env files) you don’t have to do anything else, the file that I gave to you already had the env file info inside it. That was only a comment saying that CasaOS doesn’t support env files so you have to manually add all the options inside the env file to a manual installation.

Regarding how to update the app, I can give you a guide on how to do it, it’s not that hard but you have to do it correctly because you may lose your data.

ThalesADAmaral commented 8 months ago

Do you mind to share how to install the Firefly Data Import Tool? @jkano

jkano commented 8 months ago

@regassa22 sure.

Please follow the next steps to install the Firefly Importer as a separate app in Casa OS:

  1. Open your Firefly app and go to your profile (Left menu - Options - Profile)
  2. Click on the OAuth tab
  3. Inside OAuth Clients click on Create new client and fill as shown

image

Note: The Redirect URL IP address that is shown there is my Firefly URL, your IP should be different. This is the IP of the device Firefly is installed on. Port is 81 as we are going to install the importer on port 81. Also, remember to uncheck the Confidential option

  1. Now you should see a new Client created, write down the Client ID number.

image

  1. Return to CasaOS, now click on the + button and Install a customized app
  2. Click on the import button (located on the top right, next to the X to close)
  3. In the Docker Compose Window paste the following and click submit:
View file #### firefly-importer.yml ``` name: firefly-importer services: importer: image: fireflyiii/data-importer:latest hostname: importer restart: always container_name: firefly-importer ports: - '81:8080' environment: - FIREFLY_III_URL= - VANITY_URL= - FIREFLY_III_CLIENT_ID= - TZ= - FIREFLY_III_ACCESS_TOKEN= - NORDIGEN_ID= - NORDIGEN_KEY= - NORDIGEN_SANDBOX=false - SPECTRE_APP_ID= - SPECTRE_SECRET= - USE_CACHE=false - IGNORE_DUPLICATE_ERRORS=false - AUTO_IMPORT_SECRET= - CAN_POST_AUTOIMPORT=false - CAN_POST_FILES=false - IMPORT_DIR_ALLOWLIST= - VERIFY_TLS_SECURITY=true - JSON_CONFIGURATION_DIR= - CONNECTION_TIMEOUT=31.41 - APP_ENV=local - APP_DEBUG=false - LOG_CHANNEL=stack - LOG_RETURN_JSON=false - LOG_LEVEL=debug - TRUSTED_PROXIES= - ASSET_URL= - ENABLE_MAIL_REPORT=false - EXPECT_SECURE_URL=false - MAIL_MAILER= - MAIL_DESTINATION=noreply@example.com - MAIL_FROM_ADDRESS=noreply@example.com - MAIL_HOST=smtp.mailtrap.io - MAIL_PORT=2525 - MAIL_USERNAME=username - MAIL_PASSWORD=password - MAIL_ENCRYPTION=null - MAILGUN_DOMAIN= - MAILGUN_SECRET= - MAILGUN_ENDPOINT= - POSTMARK_TOKEN= - BROADCAST_DRIVER=log - CACHE_DRIVER=file - QUEUE_CONNECTION=sync - SESSION_DRIVER=file - SESSION_LIFETIME=120 - IS_EXTERNAL=false - REDIS_HOST=127.0.0.1 - REDIS_PASSWORD=null - REDIS_PORT=6379 - REDIS_DB="0" - REDIS_CACHE_DB="1" - TRACKER_SITE_ID= - TRACKER_URL= - APP_NAME=DataImporter ```
  1. You will see the following window as when installing Firefly the first time:

image

  1. Edit the following options:
Title: Put whatever you want to name your app here (i.e. Firefly Importer)
Icon URL: Leave blank to have a generic icon
Network: Select whatever network is inside the Bridge section, not HO
Web UI: 

This has 4 parts:
- Protocol: http://
- The IP or your device (i.e. 192.168.1.3)
- Port: 81
- /

Environment variables:

FIREFLY_III_URL: Here you add your firefly URL (i.e: your IP, http://192.168.1.3:80)
VANITY_URL: Same URL as FIREFLY_III_URL
FIREFLY_III_CLIENT_ID: Here you put the number you wrote down on step 4
TZ: Your timeZone, you can use the same as when you created firefly (see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
  1. Now click on Install, Casa OS should start installing:

image

Note: Sometimes, the installing popup message doesn't dissapear even when it says installation completed. You can click on the X to close it.

  1. Now you should have the Firefly Importer installed:

image

  1. Click on it and it should open:

image

  1. Click on Authorize and now you should see your Firefly Data Import tool

image

jkano commented 8 months ago

Oh, and to update the app:

There is a manual way and an automatic way, but I'm not sure if the automatic way works because Firefly haven't had any update since I installed it, I'm on last version 6.1.10.

The automatic way should work by clicking on the three dots in the app and click on Check then update

image

But I havent tested it as there are no updates yet.

The manual way is a little bit more risky, but you can do this:

  1. Click on the three dots on Firefly app, then on Settings
  2. In the Window you see, click on the Top right button Export Compose File
  3. Save your Firefly.yaml file inside your computer (you will need it later)
  4. Close the Settings Window.
  5. Open again the three dot menu and now click on Uninstall

⚠️BEWARE: Do NOT check the Delete userdata (config folder) or you will lose everything!

  1. Now you should have your Firefly uninstalled.
  2. Now proceed to install it again by going to the plus button ( + ) and click on Install a customized app
  3. But now, you click on the top button Import, and click on the section that says Drop your Docker compose here or click to upload

image

  1. Locate the file you saved on step 3, open it and click on Submit
  2. Now click on Install (You shouldn't have to edit any option because everything should be already filled by the file you saved)
  3. Now you should have your Firefly installation back again and updated to the last version

ℹ️ I'm going to test whenever Firefly release a new update if the Check then update option works and I post here so you dont have to do it manually.

Jaeger87 commented 6 months ago

Hi @jkano, I followed your guide and I installed Firefly III on my zima board, unfortunatly after a device reboot it seems that the system fails to boot Firefly III (I just see the cron process on the process list). Any advice?

joaonscarvalho commented 4 months ago

Hi @jkano, I followed your guide and I installed Firefly III on my zima board, unfortunatly after a device reboot it seems that the system fails to boot Firefly III (I just see the cron process on the process list). Any advice?

Did you learned how to solve it? I'm facing the same problem but in ubuntu CasaOS

jkano commented 4 months ago

Hi @jkano, I followed your guide and I installed Firefly III on my zima board, unfortunatly after a device reboot it seems that the system fails to boot Firefly III (I just see the cron process on the process list). Any advice?

Weird, that does not happen to me. What do you see in casa OS? Maybe you can try to check CasaOS logs to see why your firefly iii instance is not booting up. Mine works after restarts.

joaonscarvalho commented 4 months ago

Hi @jkano, I followed your guide and I installed Firefly III on my zima board, unfortunatly after a device reboot it seems that the system fails to boot Firefly III (I just see the cron process on the process list). Any advice?

Weird, that does not happen to me. What do you see in casa OS? Maybe you can try to check CasaOS logs to see why your firefly iii instance is not booting up. Mine works after restarts.

  • UPDATE* I was able to solve the problem on Nextcloud, change the restart policy to unless-stopped, but that didn't do the trick on Firefly III

Thank you. I restarted CasaOS and the same issue occurred. With Nextcloud, simply entering the settings and clicking save without making any changes restores normal functionality. However, with Firefly III, if I do the same (enter settings and click save), I can access it, but it redirects directly to the registration page. This is happening on the second different installation of CasaOS that I have done, and the logs do not provide much information

26T19:23:22.026+0100 info CPU thermal zone found: x86_pkg_temp, path: /sys/devices/virtual/thermal/thermal_zone6. {"func": "service.GetCPUThermalZone", "file": "/home/runner/work/CasaOS/CasaOS/service/system.go", "line": 462} 27T10:04:48.518+0100 info CPU thermal zone found: x86_pkg_temp, path: /sys/devices/virtual/thermal/thermal_zone6. {"func": "service.GetCPUThermalZone", "file": "/home/runner/work/CasaOS/CasaOS/service/system.go", "line": 462} 27T10:04:48.705+0100 info Notified systemd that casaos main service is ready {"func": "main.main", "file": "/home/runner/work/CasaOS/CasaOS/main.go", "line": 208} 27T10:04:48.706+0100 info CasaOS main service is listening... {"address": "127.0.0.1:38347", "func": "main.main", "file": "/home/runner/work/CasaOS/CasaOS/main.go", "line": 224} 27T10:04:58.524+0100 info when CheckAndMountAll storages {"storages": {"mountPoints":[]}, "func": "service.(storageStruct).CheckAndMountAll", "file": "/home/runner/work/CasaOS/CasaOS/service/storage.go", "line": 71} 27T10:04:58.526+0100 info when CheckAndMountAll section {"section": {"remotes":[]}, "func": "service.(storageStruct).CheckAndMountAll", "file": "/home/runner/work/CasaOS/CasaOS/service/storage.go", "line": 76} 27T10:09:53.022+0100 info CPU thermal zone found: x86_pkg_temp, path: /sys/devices/virtual/thermal/thermal_zone6. {"func": "service.GetCPUThermalZone", "file": "/home/runner/work/CasaOS/CasaOS/service/system.go", "line": 462}

jkano commented 4 months ago

Hi @jkano, I followed your guide and I installed Firefly III on my zima board, unfortunatly after a device reboot it seems that the system fails to boot Firefly III (I just see the cron process on the process list). Any advice?

Weird, that does not happen to me. What do you see in casa OS? Maybe you can try to check CasaOS logs to see why your firefly iii instance is not booting up. Mine works after restarts.

  • UPDATE* I was able to solve the problem on Nextcloud, change the restart policy to unless-stopped, but that didn't do the trick on Firefly III

Thank you. I restarted CasaOS and the same issue occurred. With Nextcloud, simply entering the settings and clicking save without making any changes restores normal functionality. However, with Firefly III, if I do the same (enter settings and click save), I can access it, but it redirects directly to the registration page. This is happening on the second different installation of CasaOS that I have done, and the logs do not provide much information

So, even after changing it to unless-stopped is not booting up on restart? Or now is booting up but then you see the registration screen?

It will be easier to debug if you can share screenshots of your configuration for firefly III on casaOS. Firefly being asking for registration on boot suggests something is not correctly configured on the data volume or location.

joaonscarvalho commented 4 months ago

Hi @jkano, I followed your guide and I installed Firefly III on my zima board, unfortunatly after a device reboot it seems that the system fails to boot Firefly III (I just see the cron process on the process list). Any advice?

Weird, that does not happen to me. What do you see in casa OS? Maybe you can try to check CasaOS logs to see why your firefly iii instance is not booting up. Mine works after restarts.

  • UPDATE* I was able to solve the problem on Nextcloud, change the restart policy to unless-stopped, but that didn't do the trick on Firefly III

Thank you. I restarted CasaOS and the same issue occurred. With Nextcloud, simply entering the settings and clicking save without making any changes restores normal functionality. However, with Firefly III, if I do the same (enter settings and click save), I can access it, but it redirects directly to the registration page. This is happening on the second different installation of CasaOS that I have done, and the logs do not provide much information

So, even after changing it to unless-stopped is not booting up on restart? Or now is booting up but then you see the registration screen?

It will be easier to debug if you can share screenshots of your configuration for firefly III on casaOS. Firefly being asking for registration on boot suggests something is not correctly configured on the data volume or location.

It does not start until I enter the settings and save. However, it always redirects to the registration window. If I click on sign in, the page returns to the registration window.

Here are my configuration. And thank you for you support! 1 2 3 4 5 6 7 8 9 10 11

jkano commented 4 months ago

Hi @jkano, I followed your guide and I installed Firefly III on my zima board, unfortunatly after a device reboot it seems that the system fails to boot Firefly III (I just see the cron process on the process list). Any advice?

Weird, that does not happen to me. What do you see in casa OS? Maybe you can try to check CasaOS logs to see why your firefly iii instance is not booting up. Mine works after restarts.

  • UPDATE* I was able to solve the problem on Nextcloud, change the restart policy to unless-stopped, but that didn't do the trick on Firefly III

Thank you. I restarted CasaOS and the same issue occurred. With Nextcloud, simply entering the settings and clicking save without making any changes restores normal functionality. However, with Firefly III, if I do the same (enter settings and click save), I can access it, but it redirects directly to the registration page. This is happening on the second different installation of CasaOS that I have done, and the logs do not provide much information

So, even after changing it to unless-stopped is not booting up on restart? Or now is booting up but then you see the registration screen? It will be easier to debug if you can share screenshots of your configuration for firefly III on casaOS. Firefly being asking for registration on boot suggests something is not correctly configured on the data volume or location.

It does not start until I enter the settings and save. However, it always redirects to the registration window. If I click on sign in, the page returns to the registration window.

Here are my configuration. And thank you for you support!

I see what is the issue here. You setup your containers to run in the /tmp folder, which is purged (emptied) after a reboot by Linux OS.

So, by changing the configuration to save the data in other folder like /home// it should work (also uncheck all 3 of the containers to run without priviledges because they don't need it anymore).

joaonscarvalho commented 4 months ago

containers

Extraordinary! It’s working now! Thank you very much, the issue was indeed with the temporary folder. I created new ones, pointed the containers to them, and restarted CasaOS without losing the Firefly data. Thank you very much!

Apok01 commented 2 days ago

@jkano Muchas gracias Jose!