[SUPPORT] - Community Applications - ghostfolio


Recommended Posts

Welcome to the support page of the ghostfolio Community Applications template

This Support Thread explains how to set up your ghostfolio Application in Unraid:

 

About Ghostfolio:

Ghostfolio is an open source wealth management software built with web technology. The application empowers busy people to keep track of stocks, ETFs or cryptocurrencies and make solid, data-driven investment decisions.

 

Project Page: https://ghostfol.io

GitHub Repository: https://github.com/ghostfolio/ghostfolio

Docker Hub: https://hub.docker.com/r/ghostfolio/ghostfolio

License Information: AGPL-3.0 license

 

There are two ways of setting up ghostfolio:

  1. automated Ansible Setup (beta)
  2. custom setup

 

Automated Ansible Setup

I build a docker container automating ghostfolio container setup via Ansible. If you want to give it a try, check out: ghostfolio-installer.

 

Custom Setup

Alternatively, you can setup the containers manually and have full control.

 

0. Prerequisites:

As Ghostfolio requires a Postgres and Redis instance to run, you should set them up first.

 

1. Install Postgres:

Open the Community Applications and search for "postgres". Install a postgres container (e.g. Postgres-14) and make sure to set:

  • POSTGRES_PASSWORD (to a secure password - for demo purposes: "password")
  • POSTGRES_USER (to e.g. ghostfolio)
  • POSTGRES_DB (to e.g. ghostfolio-db)

 

2. Install Redis:

Open the Community Applications and search for "redis". Install the (official) redis container.

 

3. Install Ghostfolio:

Open the Community Applications and search for "ghostfolio" by LeonStoldt. Install the container and make sure to set:

  • REDIS_HOST (to the name of your redis instance or directly to the IP which can be found at the "Docker" tab under "Port Mappings")
  • REDIS_PORT
  • REDIS_PASSWORD (optional)
  • DATABASE_URL (to the schema: postgresql://${USER}:${PASSWORD}@${NAME_OR_IP_OF_PG_HOST}:5432/${DATABASE}?sslmode=prefer - in this example it would be: postgresql://ghostfolio:password@postgres:5432/ghostfolio-db?sslmode=prefer)
  • JWT_SECRET_KEY (to a secure JWT secret key)
  • BASE_CURRENCY (e.g. USD, EUR, ...)

 

To run ghostfolio, start postgres and redis first and then start ghostfolio. Then click Ghostfolio and open the Web-UI. You should now see the Ghostfolio Application - start configuring and enjoy!

 

Troubleshooting:

  • Referencing container hosts (postgres and redis) by name only works if they are in the same docker network. If not, you should provide the IP or an internal hostname directly.
  • `yarn database:setup` could cause trouble when setting up the database (until it will be fixed by Issue 924)
  • Database Migration (should not be necessary since 1.181.2): Click the Ghostfolio container and choose "Console". Enter `yarn database:migrate` to initially set up the database and visit your WebUI to get started.*
  • If manually applying database migrations, baselining migrations is available via `npx prisma ...` in the container.

 

As many of you had trouble setting it up, I created a short demo video on a new machine to show how it could be done. I hope it'll help:

 

Important Notice!

I am not a ghostfolio expert and can or will guarantee that it hasn't (known) issues. If you come across problems unrelated to Unraid - by that I mean problems with ghostfolio itself and software or UI bugs - please consider creating an issue at the official ghostfolio repository.

 

* @ikoyhn and @SmartPhoneLover thank you very much for the database migration hints

Edited by LeonStoldt
add ghostfolio installer
  • Thanks 1
Link to comment
17 hours ago, SmartPhoneLover said:

I have build it, but I'm getting infinite errors (console):

WARN [DataGatheringService] Faild to gather data for symbol USDEUR from YAHOO at xxxx-xx-xx

It makes the container to overload the CPU (server).

 

https://github.com/ghostfolio/ghostfolio/issues/924

I also was getting that error that was nearly crashing my server. The issue is the database command yarn database:setup, what I had to do to fix this was clear my postgresDB and run the command yarn database:migrate instead. Seems the issue is the default data that gets inserted using the setup version of the command.

In reality I wouldn't think this error should cause CPU overload, maybe the authors of the project could lower the amount of logs written?

 

Edited by ikoyhn
clarity
  • Like 1
Link to comment

Managed to get this up and running after adding the redis_port variable and an account created, however, whenever i try to add anything i save it and at the bottom it says Oops, something went wrong, please try again.  

 

In the container logs i see this

 

[32m[Nest] 1 - [39m05/23/2022, 2:39:45 PM [32m LOG[39m [38;5;3m[NestApplication] [39m[32mNest application successfully started[39m[38;5;3m +319ms[39m
[32m[Nest] 1 - [39m05/23/2022, 2:39:45 PM [32m LOG[39m [32m ________ __ ____ ___[39m
[32m[Nest] 1 - [39m05/23/2022, 2:39:45 PM [32m LOG[39m [32m / ____/ /_ ____ _____/ /_/ __/___ / (_)___[39m
[32m[Nest] 1 - [39m05/23/2022, 2:39:45 PM [32m LOG[39m [32m / / __/ __ \/ __ \/ ___/ __/ /_/ __ \/ / / __ \[39m
[32m[Nest] 1 - [39m05/23/2022, 2:39:45 PM [32m LOG[39m [32m/ /_/ / / / / /_/ (__ ) /_/ __/ /_/ / / / /_/ /[39m
[32m[Nest] 1 - [39m05/23/2022, 2:39:45 PM [32m LOG[39m [32m\____/_/ /_/\____/____/\__/_/ \____/_/_/\____/ v1.150.0[39m
[32m[Nest] 1 - [39m05/23/2022, 2:39:45 PM [32m LOG[39m [32m[39m
[32m[Nest] 1 - [39m05/23/2022, 2:39:45 PM [32m LOG[39m [32mListening at http://localhost:3333[39m
[32m[Nest] 1 - [39m05/23/2022, 2:39:45 PM [32m LOG[39m [32m[39m
[32m[Nest] 1 - [39m05/23/2022, 2:39:45 PM [32m LOG[39m [38;5;3m[DataGatheringService] [39m[32mData gathering has been reset.[39m
[32m[Nest] 1 - [39m05/23/2022, 2:40:00 PM [32m LOG[39m [38;5;3m[DataGatheringService] [39m[32m7d data gathering has been started.[39m
[31m[Nest] 1 - [39m05/23/2022, 2:42:23 PM [31m ERROR[39m [38;5;3m[ExceptionsHandler] [39m[31mConnection is closed.[39m

Error: Connection is closed.

at Redis.sendCommand (/ghostfolio/apps/api/node_modules/ioredis/built/redis/index.js:636:24)
at Script.execute (/ghostfolio/apps/api/node_modules/ioredis/built/script.js:27:34)
at Redis.addJob (/ghostfolio/apps/api/node_modules/ioredis/built/commander.js:158:27)
at Object.addJob (/ghostfolio/apps/api/node_modules/bull/lib/scripts.js:49:19)
at addJob (/ghostfolio/apps/api/node_modules/bull/lib/job.js:82:18)
at /ghostfolio/apps/api/node_modules/bull/lib/job.js:95:14
[31m[Nest] 1 - [39m05/23/2022, 2:43:04 PM [31m ERROR[39m [38;5;3m[YahooFinanceService] [39m[31mBadRequestError: Missing required query parameter=symbols[39m

[31m[Nest] 1 - [39m05/23/2022, 2:43:37 PM [31m ERROR[39m [38;5;3m[ExceptionsHandler] [39m[31mConnection is closed.[39m

Error: Connection is closed.

at Redis.sendCommand (/ghostfolio/apps/api/node_modules/ioredis/built/redis/index.js:636:24)
at Script.execute (/ghostfolio/apps/api/node_modules/ioredis/built/script.js:27:34)
at Redis.addJob (/ghostfolio/apps/api/node_modules/ioredis/built/commander.js:158:27)
at Object.addJob (/ghostfolio/apps/api/node_modules/bull/lib/scripts.js:49:19)
at addJob (/ghostfolio/apps/api/node_modules/bull/lib/job.js:82:18)
at /ghostfolio/apps/api/node_modules/bull/lib/job.js:95:14

 

Link to comment

@hermy65 it looks like your connection to redis does not work properly. How did you setup redis and reference it in the ghostfolio container?

 

I could reproduce your issue without the REDIS_PORT variable in the ghostfolio container. I forgot to add the variable to the template and will do it soon. For now, please add a new variable to your ghostfolio template and call it "REDIS_PORT" (case sensitive). It should be 6379 by default or your custom port of your redis container.

The REDIS_HOST variable should be set to your Unraid IP or local hostname. 

 

To check, you could run 'ping ${Unraid_IP}:6379' and check if redis is reachable from your ghostfolio console / container.

 

It sounds like you already did most of it, so maybe check your configurations, give the containers a restart in the correct order and check if it works.

Link to comment
7 minutes ago, LeonStoldt said:

@hermy65 it looks like your connection to redis does not work properly. How did you setup redis and reference it in the ghostfolio container?

 

I could reproduce your issue without the REDIS_PORT variable in the ghostfolio container. I forgot to add the variable to the template and will do it soon. For now, please add a new variable to your ghostfolio template and call it "REDIS_PORT" (case sensitive). It should be 6379 by default or your custom port of your redis container.

The REDIS_HOST variable should be set to your Unraid IP or local hostname. 

 

To check, you could run 'ping ${Unraid_IP}:6379' and check if redis is reachable from your ghostfolio console / container.

 

It sounds like you already did most of it, so maybe check your configurations, give the containers a restart in the correct order and check if it works.

 

I am able to ping the ip:port of redis through the container. I had already added the REDIS_PORT variable and mapped it to 6379. As for how i configured it, ive tried redis both through host mode and br0 with a custom ip and neither appear to work for me.

Link to comment

Hi @Lee B,

it seems like REDIS_PASSWORD is not supported (as NOAUTH is expected). The .env file in the github repository only contains host and port.

Could you please create a GitHub issue to request adding the Redis Password / Authentication?

If you want, you can contribute the necessary changes yourself - of course :)

Edited by LeonStoldt
Link to comment
44 minutes ago, LeonStoldt said:

Hi @Lee B,

it seems like REDIS_PASSWORD is not supported (as NOAUTH is expected). The .env file in the github repository only contains host and port.

Could you please create a GitHub issue to request adding the Redis Password / Authentication?

If you want, you can contribute the necessary changes yourself - of course :)

 

PR created because I have the same need :)

Link to comment

I have also tried setting up ghostfolio. I have installed redis and pstgresql-14.
I also added the variable "REDIS_PORT" to ghostfolio. All three containers run in the same network (bridge).
The Redis and postgres container are running after starting the Ghostfolio container I can't get into the console of the container (Error response from daemon: Container c1..... is not running).

Link to comment

@netsrot303 I could reproduce your error when the redis is not available and it seems that ghostfolio started. In the background, the ghostfolio container was stopped already. You should see it when you go into your Unraid console and execute something like 'docker ps -a' and take a look at your ghostfolio container - or directly ask for the logs 'docker logs ghostfolio' or 'docker logs 12x73d...' if you reference it by the container id. Make sure to check your redis configuration.

Link to comment

@SH4LT1S I just created a video for you to show how it can be set up. It is two minutes, I would guess that is easy to set up. Besides, I created a detailed description on how to set up and added this video to show it more visually.

I'll admit it might require some basic basic knowledge of docker and how containers or applications talk to each other but it is basically everything the same with docker, containers and multiple applications working together in Unraid.

It would be helpful if you could specify what your problems are and what do you find confusing - otherwise we cannot help ;)

 

Oh and if you are interested in ghostfolio and cannot self-host it or you don't want to, there is a public available service which you can use. Depending on your needs it might cost some money for hosting - but you can check it out here.

NOTICE!: It is not my service and I don't receive any of that money. I just brought it to the Unraid Community Store to share.

 

Thank you!

Edited by LeonStoldt
Link to comment
20 hours ago, LeonStoldt said:

@SH4LT1S I just created a video for you to show how it can be set up. It is two minutes, I would guess that is easy to set up. Besides, I created a detailed description on how to set up and added this video to show it more visually.

I'll admit it might require some basic basic knowledge of docker and how containers or applications talk to each other but it is basically everything the same with docker, containers and multiple applications working together in Unraid.

It would be helpful if you could specify what your problems are and what do you find confusing - otherwise we cannot help ;)

 

Oh and if you are interested in ghostfolio and cannot self-host it or you don't want to, there is a public available service which you can use. Depending on your needs it might cost some money for hosting - but you can check it out here.

NOTICE!: It is not my service and I don't receive any of that money. I just brought it to the Unraid Community Store to share.

 

Thank you!

Thanks, video helped but now i get P1013: The provided database string is invalid. invalid port number in database URL. Please refer to the documentation in https://www.prisma.io/docs/reference/database-reference/connection-urls for constructing a correct connection string. In some cases, certain characters must be escaped. Please check the string for any illegal characters.
error Command failed with exit code 1.

Link to comment

@SH4LT1S great to hear the video helped!

Basically, you already wrote what's the problem. The database connection string should look like this:

"postgresql://${USERNAME}:${PASSWORD}@${PG_HOST}:${PG_PORT}/${PG_DB}?sslmode=prefer"

You need to replace it with the correct values:

${USERNAME} = your postgres username when creating the postgres container

${PASSWORD} = your postgres password (if it is to "secure" you might need to escape some characters or choose a simpler password - I would suggest choosing a demo password to verify it's working and change the password later on to some more secure one)

${PG_HOST} = Usually this is your IP of your (Unraid) system where the postgres is running

${PG_PORT} = default is 5432, if you change it to something else, change this one aswell

${PG_DB} = the name of your postgres database to store your data in 

 

You should find all this information at the website you posted: https://www.prisma.io/docs/concepts/database-connectors/postgresql

 

If your connection string still does not work, you can write me a pm to debug whats wrong with your connection string.

Link to comment

As I was debugging some problems with @hermy65 in private messages, I would like to provide another method of debugging / checking if it's working. Some problems may occur in view of wrong configuration when changing the demo / default values. If you come across problems with the communication between Ghostfolio and redis / postgres you could try manually starting the containers via docker command from the Unraid console / command line and then (after verifying it's working) change some parameters and values in the configuration. That way you know which (config) value causes the problems.

 

To run it via command line open the terminal of Unraid (in the upper right hand corner) and run the following commands to start all the container and migrate the database:

 

1. Start Postgres:

docker run -d --name='ghostfolio-postgres' --net='bridge' -e TZ="Europe/Berlin" -e HOST_OS="Unraid" -e 'POSTGRES_PASSWORD'='password' -e 'POSTGRES_USER'='ghostfolio' -e 'POSTGRES_DB'='ghostfolio-db' -p '5432:5432/tcp' -v '/mnt/cache/appdata/ghostfolio-postgres':'/var/lib/postgresql/data':'rw' 'registry.hub.docker.com/library/postgres:14'

 

2. Start Redis:

docker run -d --name='ghostfolio-redis' --net='bridge' -e TZ="Europe/Berlin" -e HOST_OS="Unraid" -p '6379:6379/tcp' 'redis'

 

3. Start Ghostfolio: (Remember to change the <IP> to your Unraid IP address!)

docker run -d --name='Ghostfolio' --net='bridge' -e TZ="Europe/Berlin" -e HOST_OS="Unraid" -e 'REDIS_HOST'='<IP>' -e 'DATABASE_URL'='postgresql://ghostfolio:password@<IP>:5432/ghostfolio-db?sslmode=prefer' -e 'JWT_SECRET_KEY'='123456' -e 'REDIS_PORT'='6379' -e 'ALPHA_VANTAGE_API_KEY'='' -e 'ACCESS_TOKEN_SALT'='GHOSTFOLIO' -p '3333:3333/tcp' 'ghostfolio/ghostfolio'

 

4. Migrate database initially:

docker exec -it Ghostfolio yarn database:migrate

 

 

This is basically the same as you would do with the provided Templates via UI - just doing it via command line.

Link to comment
On 5/24/2022 at 6:04 PM, lurkio said:

Dang. Secure Redis needs more support, especially for tools that contain or work with sensitive information. 

REDIS_PASSWORD has been added in the latest update. I believe you'll have to manually add the environment variable in Unraid at the moment, but the app supports it now.

Edited by scud133b
Link to comment
On 5/28/2022 at 2:57 PM, LeonStoldt said:

@SH4LT1S great to hear the video helped!

Basically, you already wrote what's the problem. The database connection string should look like this:

"postgresql://${USERNAME}:${PASSWORD}@${PG_HOST}:${PG_PORT}/${PG_DB}?sslmode=prefer"

You need to replace it with the correct values:

${USERNAME} = your postgres username when creating the postgres container

${PASSWORD} = your postgres password (if it is to "secure" you might need to escape some characters or choose a simpler password - I would suggest choosing a demo password to verify it's working and change the password later on to some more secure one)

${PG_HOST} = Usually this is your IP of your (Unraid) system where the postgres is running

${PG_PORT} = default is 5432, if you change it to something else, change this one aswell

${PG_DB} = the name of your postgres database to store your data in 

 

You should find all this information at the website you posted: https://www.prisma.io/docs/concepts/database-connectors/postgresql

 

If your connection string still does not work, you can write me a pm to debug whats wrong with your connection string.

Hello, I fixed the problem by changing the password to a basic one with just letters and numbers but without special characters, since they need to be converted somehow.

Link to comment

@scud133b Yes! I added REDIS_PASSWORD to the template, so you don't have to add it manually now.

 

@SH4LT1S you can try an URL-Encoder to escape special characters: https://www.urlencoder.org/ 

Normally special characters are escaped by adding a backslash "\" as prefix e.g. \$ to escape a $

In some cases (docker-compose context I believe) it is done by a double dollar sign $$ to escape a $

As the jdbc url is a url - I would first try a Url-Encoder. It might be a bit tricky and try and error but doing small steps helps a lot ;)

 

---

UPDATE:

I added new Environment Variables to the template file in view of new releases:

  • BASE_CURRENCY: Added support to set the base currency as an environment variable (BASE_CURRENCY) - Release: 1.151.0
  • REDIS_PASSWORD: Exposed the environment variable REDIS_PASSWORD - Release: 1.155.0
Link to comment

Bashing my head against the wall on this, haha. I followed the steps completely and I'm fine getting into the Web GUI, I set myself up, add an account, go in to try and add my first transaction - then I get the infinite loop with postgres14.

 

To be clear, I installed redis, installed postgres14, (both are running), then installed ghostfolio setting the links to both other containers. Ghostfolio auto-starts after clicking apply, I hit the ghostfolio console and did the migrate command.  Then as above and get the errors.

 

I tried a couple additional things. I nuked ghostfolio and postgres14 and tried again with the database setup command and as shown here that infinite looped it immediately. Then I tried nuking only postgres14 thinking maybe ghostfolio was doing something as it started up that was an issue - but confirmed I'm still having the problem.

 

This is what I'm seeing in the postgres14 logs infinitely after trying to add an F buy.  Total noob on database items so probably something simple I'm missing.

 

2022-06-05 10:39:32.634 EDT [34] ERROR:  duplicate key value violates unique constraint "MarketData_date_symbol_key"
2022-06-05 10:39:32.634 EDT [34] DETAIL:  Key (date, symbol)=(2020-12-29 00:00:00, F) already exists.
2022-06-05 10:39:32.634 EDT [34] STATEMENT:  INSERT INTO "public"."MarketData" ("createdAt","dataSource","date","id","symbol","marketPrice") VALUES ($1,$2,$3,$4,$5,$6) RETURNING "public"."MarketData"."id"
2022-06-05 10:39:32.651 EDT [34] ERROR:  duplicate key value violates unique constraint "MarketData_date_symbol_key"
2022-06-05 10:39:32.651 EDT [34] DETAIL:  Key (date, symbol)=(2020-12-29 00:00:00, F) already exists.
2022-06-05 10:39:32.651 EDT [34] STATEMENT:  INSERT INTO "public"."MarketData" ("createdAt","dataSource","date","id","symbol","marketPrice") VALUES ($1,$2,$3,$4,$5,$6) RETURNING "public"."MarketData"."id"
2022-06-05 10:39:32.665 EDT [34] ERROR:  duplicate key value violates unique constraint "MarketData_date_symbol_key"
2022-06-05 10:39:32.665 EDT [34] DETAIL:  Key (date, symbol)=(2020-12-29 00:00:00, F) already exists.
2022-06-05 10:39:32.665 EDT [34] STATEMENT:  INSERT INTO "public"."MarketData" ("createdAt","dataSource","date","id","symbol","marketPrice") VALUES ($1,$2,$3,$4,$5,$6) RETURNING "public"."MarketData"."id"

 

  • Like 1
Link to comment

I just set up this server, and it seems to be working. Performance is very lackluster however, is this normal behaviour for other people as well? Furthermore, it seems I cannot add BTC to my activities. I was wondering if this is working for other people on this sub?

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.