Closed mrc4tt closed 2 years ago
In order to actually toggle something, what exactly is being set? Do you have any links to anything that describes the result you're expecting from such a flag?
https://hub.docker.com/r/hackebein/ts3server - Found it from this link.
I could not use it for my docker-compose because it did not work properly (and I have no experience with setting up docker-compose), so I only made docker-compose (with your image)
It looks like it is executing this (from here):
# Patch for disable GDPR save database
if [[ "${TS3SERVER_PATCH_GDPR_SAVE}" == "true" ]]; then
echo 'update clients set client_lastconnected=:client_lastconnected:, client_totalconnections=client_totalconnections+1 where client_id=:client_id: and server_id=:server_id:;' > sql/client_update_stats.sql
fi
Which is just creating a SQL file which Teamspeak checks for on startup apparently (according to the documentation, see below). I'll see if there is something I can do to allow dropping in .sql files at least.
From the documentation about the sql/
directory:
* dbsqlpath (*sql/*)
The physical path where your SQL script files are located.
Default: The server will search for SQL script files in the 'sql/' subdirectory.
Oh, I didn't check it was there.
If it's possible I can set "custom environment" manually, would be nice. (Unless.. I need to update build the docker-teamspeak?)
It's been a while since I have looked at how everything is setup inside the TeamSpeak container so I'm shooting from the hip a bit. Looks like it is actually overwriting the default client_update_stats.sql
file that exists which makes sense:
Default contents:
update clients set client_lastconnected=:client_lastconnected:, client_totalconnections=client_totalconnections+1, client_lastip=:client_lastip: where client_id=:client_id: and server_id=:server_id:;
Updated contents from the above code:
update clients set client_lastconnected=:client_lastconnected:, client_totalconnections=client_totalconnections+1 where client_id=:client_id: and server_id=:server_id:;
Which will result in the IP not being logged, I am assuming. So yes, this would be pretty simple to implement. If you give me a bit, I should be able to take care of it. I think the thing to keep in mind is that I would assume that it only runs these scripts on startup so if you already have data, it might not update, you might have to start from scratch unless there is another way to set the same. I'm no db expert so I'm just going with assumptions around the logic of how it ought to work in some capacity..
I created an image that you could try:
mbentley/teamspeak:alpine-gdpr-test
I am not exactly sure how to validate that it worked but you should be able to pass -e TS3SERVER_GDPR_SAVE=true
and you will see a message that indicates that it is writing the sql file like this:
INFO: User doesn't exist; creating...
Found a license agreement method; launching TeamSpeak
INFO: Updating 'client_update_stats.sql' to not log client IP addresses for GDPR...
...
@mbentley I can confirm it works <3 - I did test on a new "installed TS3 server"
If I would like to make some "edit" of it (manually... how can I do that?)
Well that depends. What do you mean by an edit of it? Can you give an example?
I submitted https://github.com/mbentley/docker-teamspeak/pull/new/add-gdpr-no-ip-log for the code that I pushed to that temporary tag that you tested. I'll wait before merging it until I understand this use case you have.
Well that depends. What do you mean by an edit of it? Can you give an example?
Yeah. Example update the "default.sql" if it's possible with this:
i_client_max_clones_uid
to be -1
for Server Groups: Guest & [T] Guest.
Hmm, honestly I would say that the easiest solution to this would be to bind mount over the file with your own customized copy. I don't see a clean and easy way to maintain this at the image layer and safely also ensure that I could parse and modify the sql files generically.
Run a container to pull the defaults.sql
out:
$ docker run -itd --name ts --entrypoint sh mbentley/teamspeak -l
350cbacc4abaed700085613a9a2477b107c8e10d5e8ee68b9c1004d28a9d6b39
$ docker cp ts:/opt/teamspeak/sql/defaults.sql defaults.sql
$ docker kill ts; docker rm ts
$ ls -l defaults.sql
-rw-rw-rw- 1 mbentley staff 71582 Jun 1 04:48 defaults.sql
Example run command to bind mount over the customized file:
docker run -d --name teamspeak \
-e PUID=503 \
-e PGID=503 \
-e TS3SERVER_GDPR_SAVE=true \
-e TS3SERVER_LICENSE=accept \
-p 9987:9987/udp -p 30033:30033 -p 10011:10011 -p 41144:41144 \
-v /path/to/teamspeak/data:/data \
-v /path/to/teamspeak/sql/defaults.sql:/opt/teamspeak/sql/defaults.sql \
mbentley/teamspeak
And you could add in whatever additional customizations you needed to make as well:
docker run -d --name teamspeak \
-e PUID=503 \
-e PGID=503 \
-e TS3SERVER_GDPR_SAVE=true \
-e TS3SERVER_LICENSE=accept \
-p 9987:9987/udp -p 30033:30033 -p 10011:10011 -p 41144:41144 \
-v /path/to/teamspeak/data:/data \
-v /path/to/teamspeak/sql/defaults.sql:/opt/teamspeak/sql/defaults.sql \
-v /path/to/teamspeak/sql/my_random_file.sql:/opt/teamspeak/sql/my_random_file.sql \
mbentley/teamspeak
I would be more than happy to add that sort of use case to the README.
Thank you very much (Only last question, before we can lock this as solved)
Do you know, where I need to place the /path/to/sql/defaults.sql
?
I have this example docker-compose.yml right now: - And I can't see where I place the "defaults.sql"
the default.sql
are placed at /root/srvs/ts3/defaults.sql
As example
version: '2'
services:
teamspeak_gdpr: #Same as the name of the container
image: mbentley/teamspeak:alpine-gdpr-test #The image of the container
restart: always #The TeamSpeak server will automatically start after a host restart
container_name: teamspeak_gdpr #The name of the container
environment:
- TS3SERVER_LICENSE=accept #Required to start the server
- TS3SERVER_GDPR_SAVE=true
volumes:
- ./data:/data:rw #Every server has it's data saved in it's folder
ports: #These are the ports required to run. Left side is the server port, right side is inside the container
- '1337:1337/udp'
- '30047:30047'
- '10025:10025'
command: #This one is required for the server to start with the right ports
- inifile=/data/ts3server.ini
- serveradmin_password=test1234
Under volumes
. Inside the container, the sql files are in the /opt/teamspeak/sql/
directory:
$ docker run -it --rm --entrypoint ls mbentley/teamspeak -l /opt/teamspeak
total 15576
-rw-rw-rw- 1 root root 73722 Jun 9 09:08 CHANGELOG
-rw-r--r-- 1 root root 68142 Jun 1 08:52 LICENSE
drwxr-xr-x 3 root root 4096 Sep 1 16:39 doc
-rwxr-xr-x 1 root root 1044616 Jun 9 11:59 libts3_ssh.so
-rwxr-xr-x 1 root root 43072 Jun 9 11:59 libts3db_mariadb.so
-rwxr-xr-x 1 root root 387464 Jun 9 11:59 libts3db_postgresql.so
-rwxr-xr-x 1 root root 1257920 Jun 9 11:59 libts3db_sqlite3.so
drwxr-xr-x 2 root root 4096 Sep 1 16:39 redist
drwxrwxrwx 2 root root 4096 Sep 1 16:39 serverquerydocs
drwxrwxrwx 6 root root 12288 Sep 1 16:39 sql
-rwxr-xr-x 1 root root 13024464 Jun 9 11:59 ts3server
-rwxrwxrwx 1 root root 117 Jun 1 08:48 ts3server_minimal_runscript.sh
-rwxrwxrwx 1 root root 2654 Jun 1 08:48 ts3server_startscript.sh
drwxr-xr-x 2 root root 4096 Sep 1 16:39 tsdns
So your compose would be something like:
version: '2'
services:
teamspeak_gdpr: #Same as the name of the container
image: mbentley/teamspeak:alpine-gdpr-test #The image of the container
restart: always #The TeamSpeak server will automatically start after a host restart
container_name: teamspeak_gdpr #The name of the container
environment:
- TS3SERVER_LICENSE=accept #Required to start the server
- TS3SERVER_GDPR_SAVE=true
volumes:
- ./data:/data:rw #Every server has it's data saved in it's folder
- /path/to/sql/defaults.sql:/opt/teamspeak/sql/defaults.sql:ro
ports: #These are the ports required to run. Left side is the server port, right side is inside the container
- '1337:1337/udp'
- '30047:30047'
- '10025:10025'
command: #This one is required for the server to start with the right ports
- inifile=/data/ts3server.ini
- serveradmin_password=test1234
I just merged #36 so the updates should be published on Docker Hub now under the normal tags.
I just merged #36 so the updates should be published on Docker Hub now under the normal tags.
Cool, sorry for the bump after it closed.
chown: changing ownership of '/opt/teamspeak/sql/defaults.sql': Read-only file system
I did set it like this (example) - maybe I need to remove defaults.sql from /opt/teamspeak/sql
?
- /root/srvs/ts3/defaults.sql:/opt/teamspeak/sql/defaults.sql:ro
Ah yeah, then just change it to rw
instead of ro
.
Hi, @mbentley
I would like to hear, about you're planned to add a custom environment to your docker-teamspeak.
For example; I would like to add this on docker-compose: TS3SERVER_GDPR_SAVE=true -
So it can hidden client's IP address
If possible it can be made.