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

Docker WebUI: State reset after container stopped #43

Open
mm10079 opened this issue Mar 12, 2023 · 10 comments
Open

Docker WebUI: State reset after container stopped #43

mm10079 opened this issue Mar 12, 2023 · 10 comments

Comments

@mm10079
Copy link

mm10079 commented Mar 12, 2023

I set "admins": ["username"] in config.json
but when use webUI login admin user, I still cant do anything.
This is my config.json setting:
{ "permissions": { "banned": [], "guest": ["writeChat"], "user": ["guest"], "leader": ["user"], "admin": ["user", "clearChat", "setLeader", "lockPlaylist", "banClient"] }, "admins": ["username"] }
I use synctube on Turenas scale docker
I tried to set admin user in user.josn,but user.json will reset when docker reboot.

@RblSb
Copy link
Owner

RblSb commented Mar 12, 2023

Can you use server console after running synctube?
If you run node build/server.js in synctube folder, synctube should start, and you will see synctube cli, where you can send any text to see list of server commands. If you run here /addAdmin Name password, then it should add admin to user/users.json
image

@mm10079
Copy link
Author

mm10079 commented Mar 13, 2023

Add Admin successful,but still appear Access Error on the webUI.
image
image
maybe I should change or should not change something in config.json

@RblSb
Copy link
Owner

RblSb commented Mar 13, 2023

You probably trying to make action that is out of your user group permissions (I will make errors more verbose). Is this error happens when you trying to write to chat or something else?
You can send me your user/config.json, so i will try to reproduce this problem and say whats wrong here.

@mm10079
Copy link
Author

mm10079 commented Mar 13, 2023

I'm trying to make the administrator the only one who has permission to control video playback and add videos
So I removed the rest of the privileges for normal users, like in config.json
image
I don't understand how to divide the privileges of administrators and general users
Maybe remove the guest's permissions is a mistake

@RblSb
Copy link
Owner

RblSb commented Mar 13, 2023

You need to move guest privileges to level up, so they will be available for admin, for example:

	"permissions": {
		"banned": [],
		"guest": ["writeChat"],
		"user": ["guest"],
		"leader": ["user"],
		"admin": ["user", "addVideo", "removeVideo", "changeOrder", "toggleItemType", "requestLeader", "rewind", "clearChat", "setLeader", "lockPlaylist", "banClient"]
	},

So in this case you should not get Access error when you add video as admin. Remember to restart server after changing config.
Also remember that you can be detected as admin (blue nickname in userlist) when you run server locally, and you ip is equal to server ip. This can be disabled with "localAdmins": false in config.

@mm10079
Copy link
Author

mm10079 commented Mar 14, 2023

After I restart docker on webUI, user.json will lost all change.
I tried use cli to kill old pod and start new pod, but it will make docker crush.

@RblSb
Copy link
Owner

RblSb commented Mar 14, 2023

I think you are running container without v (volume) argument, that mounts folder to keep data, instead of cleaning it at container exit.
Not sure how to web ui works, but in cli container start is:
docker run --rm -it -p 4200:4200 -v ${PWD}/user:/usr/src/app/user synctube
So there is user folder mounted to write server state outside of temp container. If chat messages are keeped in history after container restart, then it working.

@mm10079
Copy link
Author

mm10079 commented Mar 14, 2023

I have been set this host path setting for volume, so my config.json not be remove. Just user.json be reset
image

@RblSb
Copy link
Owner

RblSb commented Mar 14, 2023

I think there is no volume to user folder outside of container, so you are:

  • Run container, its creates temporary file system with files
  • Admin is added to temp/user/users.json file inside of container, because you have no link to yourPC/user/ (volume) to write data
  • After container restart, yourPC/user/users.json is copied to temp container file system again
  • You lost all your temp/user/users.json and temp/user/state.json (chat history, playlist) changes (config.json is not changed by server anyway)

I just tested run instructions, and they works for me. I'm a not docker user, since it eats 10 GB for nothing, when you can have 60 MB node server setup. Have no idea if something should be changed to support WebUI too.

@mm10079
Copy link
Author

mm10079 commented Mar 14, 2023

I think I set the right volume on the webUI, I can see the new admin have been add in myPC/user/user.json.
The user.json will be reset when I stop container not after run container.
Maybe this is a bug of turecharts docker setting.
I will try other way.
Thank your help a lot.

@RblSb RblSb changed the title Set admin user Docker WebUI: State reset after container stopped Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants