Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration dependant on URL #10

Closed
shad-lp opened this issue Jun 3, 2021 · 8 comments
Closed

Configuration dependant on URL #10

shad-lp opened this issue Jun 3, 2021 · 8 comments
Labels
🐛 Bug [ISSUE] Ticket describing something that isn't working

Comments

@shad-lp
Copy link

shad-lp commented Jun 3, 2021

Hello,

I'm working of my personal dashboard for some days now, and I have spotted a strange behaviour.
Dashy is atm running backend behind my reverse proxy, e.g. I'm reaching it through dashy.ndd.tld
Until now I was using Dashmachine on www.ndd.tld, and I'd like to make dashy my primary dashboard from now on.

When I tweak Nginx to switch subdomains, I'm getting back to the initial configuration, see dashy.ndd.tld here :

dashy_rp_1

www.ndd.tld :

dashy_rp_2

Context :

  • Container restart doesn't affect this behaviour.
  • If I NAT container's port 80 to host (instead of using https to access dashy), I also get the default page.

So it seems that the configuration is related to the URL. But I thought that in any case, it should load the conf.yml file in the container.
So I tried to check conf.yml in the container, I felt upset when I saw that my conf.yml file is the default one :

docker exec -it dashy cat /usr/share/nginx/html/conf.yml

dashy_rp_3

My guess is that when I edit my config through the UI, changes are saved elsewhere than in the conf.yml file. Not the best way to ensure data persistance.

If it can help you, here is my docker-compose file :

version: '2.1'
services:

   dashy:
      image: lissy93/dashy
      container_name: dashy
      networks:
         - net-proxy
      # for testing purpose only
      ports:
         - 22080:80
      volumes:
         - icons:/usr/share/nginx/html/item-icons
         - config:/usr/share/nginx/html
      labels:
#         - "diun.enable=true"
         - "com.centurylinklabs.watchtower.enable=true"
      restart: unless-stopped

volumes:

   icons:
   config:

networks:

   net-proxy:
      external: true

Another thing that disturbs me is the backup/restore config tool. Besides it is a rather cool feature, I can't find any mention of WHERE my data is saved. This stands as a real privacy concern imho.

Staying available if you need further details.

@Lissy93
Copy link
Owner

Lissy93 commented Jun 3, 2021

Hey @shadowKing001, thanks for raising this.

That is actually the expected behavior, you will need paste your modified config file into conf.yml for changes to take effect and persist across instances. If you'e got any suggestions on how I can implement this better, I would be happy to change it. Sorry if I didn't make that so clear in the text.

In terms of the backup and restore feature, it is done using a Cloudflare worker (a platform for running serverless functions), and stored in the KV data store. Everything is encrypted client-side using AES with your passphrase as the key (see CloudBackup.js). If you don't enable that feature, then no data will be sent to the server, ever.
If you'd like a bit more info, here are the docs, and here is the code - hope that helps :)

@shad-lp
Copy link
Author

shad-lp commented Jun 3, 2021

That is actually the expected behavior, you will need paste your modified config file into conf.yml for changes to take effect and persist across instances. If you'e got any suggestions on how I can implement this better, I would be happy to change it. Sorry if I didn't make that so clear in the text.

I'm not a developer so I cannot technically tell you how it could or should be done, but having a kind of "sandbox" like you did is a great feature imho. But if you promote a way to edit settings through a GUI, then you should not stop half-way.

As you mention alternatives :

  • Homer is strictly set through YML file editing.
  • Dashmachine can be fully set from GUI or command line.
  • Heimdall is meant to be GUI edited.

They have obvious caveats, I tried them all, but as you can see, you can fully configure your UI either way.

So if I were you I'd try to give the user a way to overwrite the conf.yml file without having to SSH into the server, etc...
And maybe embed by default an original conf.yml file (e.g. conf.yml.original) and add a way to reset the conf.yml file from the GUI ? Not sure about this last feature.

Regarding backup, thanks it's way more clear. 👍

@shad-lp
Copy link
Author

shad-lp commented Jun 3, 2021

I am still facing issues getting my conf.yml loaded.
Although my conf.yml file has been correctly mounted in the container (I checked it did with docker exec -it dashy cat /usr/share/nginx/html/conf.yml) I am still getting the default config if I use any other URL/browser I have tweaked my UI with.

So basically, it seems that the content of the conf.yml file is not taken into account. Everything is happening locally. I tried to clear my cookies and cache, it has not gotten any better.

Am I missing something ?

@Lissy93
Copy link
Owner

Lissy93 commented Jun 6, 2021

Hey @shadowKing001
I'm sorry about that, was my fault, it was caused by the build phase happening when the Docker image was initialized.

I've totally rewritten the Docker image, and now the source is included in the container, allowing it to be rebuilt when the config changes. You'll need to ensure you've got the latest version of the image from Docker Hub, then paste your config into a YAML file and spin up the new container with:

docker run -d \
  -p 8080:80 \
  -v /root/my-local-conf.yml:/app/public/conf.yml \
  --name my-dashboard \
  --restart=always \
  lissy93/dashy:latest

Then, if you make any changes to your config, just run docker exec -it [container-id] yarn build and the app will be rebuilt.

So this should now all be working- very sorry for the trouble, I've not Dockerized many apps before, so this part was new to me.

@Lissy93 Lissy93 added the 🐛 Bug [ISSUE] Ticket describing something that isn't working label Jun 7, 2021
@shad-lp
Copy link
Author

shad-lp commented Jun 7, 2021

Wow, you made that UI even better, it's getting serious... love it, really.
I've been able to load my configuration as per your instructions and it went smoothly.
Thanks a lot for your work, any way to make a donation ?

@shad-lp
Copy link
Author

shad-lp commented Jun 16, 2021

Hello @Lissy93
I'm bumping this issue because I'm still experiencing something that I presume you did on purpose (and has some benefits) but feels a bit awkward to me.

Let's say I'm trying to change the "description" field manually in the conf.yml file :

---
appConfig:
  theme: "colorful"
  fontAwesomeKey: "0821c65656"
pageInfo:
  title: "XXX"
  navLinks:
    - title: "Home"
      path: "/"
    - title: "Docker Hub"
      path: "https://hub.docker.com/r/lissy93/dashy"
    - title: "Source Code"
      path: "https://github.com/Lissy93/dashy"
  description: "dashy"

and following to the documentation, I set a yarn build to take changes into account.

If I use my browser with cookies enabled (normal navigation mode), changes are not visible.
If I navigate in privacy mode, the change is active.

Moreover, whatever I could do in the WebUI config section has no impact on the conf.yml file.
The sole way is to download the config file through the UI, and overwrite the one on my server, rebuild it, and delete cookies.
A bit complex for a simple change.

When I say that I think that you did it on purpose (tell me if I'm wrong), it's because I see a major benefit with this : multiple users can customize their dashboard on their own browsers. If they sync their browsers on their devices, it is even more convenient.

But there is a major drawback : at home I'm the one managing all the network and applications stuff, and I'm frequently adding new apps. So basically my family members can check the up-to-date dashboard to discover what is new, they don't have to bother with bookmarks in their browsers or waiting for me to tell them they should add a new app to their dashboard.

One page to rules them all 💍

If the dashboard display is related to their cookie, this use case is broken.
If I were alone, that would be less problematic.

I hope that I've been clear, thanks again !

@Lissy93
Copy link
Owner

Lissy93 commented Jun 16, 2021

Yeah, I agree with you totally. The reason I did it was because from a frontend app alone, it is not possible to write changes to disk. However I've now build a simple node backend, which is what the Docker image uses to serve up the app, so going forward there is no reason why Dashy cannot write changes made from the UI into the YAML file. It is on my todo list to write an endpoint in the Node server, which Dashy calls to, which then updates the conf.yaml file on disk, and I will try and get it done this weekend.

I'll keep this issue open, and update you when it's implemented :)

@Lissy93
Copy link
Owner

Lissy93 commented Jun 21, 2021

This is now fixed in #43 - You can now write config directly to the conf.yml file through the UI :)

After updating, if the change is not visible, then do a hard refresh (Shift + F5). After the config has been edited, the app should then rebuild automatically, but can also be manually triggered through the UI also. This functionality can be disabled by setting allowConfigEdit to false (under appConfig). This feature is only available if you are using the Node server (which is the default in the Docker container), since this functionality isn't possible in the client-side alone.
Hope that's useful :)

@Lissy93 Lissy93 closed this as completed Jun 21, 2021
asterling8516 pushed a commit to asterling8516/dashy that referenced this issue Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug [ISSUE] Ticket describing something that isn't working
Projects
None yet
Development

No branches or pull requests

2 participants