Closed adamzvolanek closed 3 months ago
Thanks for the PR! I approve of the changes from the first commit, but I have a question about the following line from the second one:
Otherwise, the user must set ownership and populate the docker's
/data
directory with the repositories data directory
This is not supposed to be the case. The data
directory in this repository is used when building the docker image; its only purpose is to provide airports.db
when first creating the jetlog database, and also world.geo.json
for the backend geography API.
For this reason, that directory (in the docker container) goes in /app/data
, not /data
. This makes me wonder whether populating that directory in the way you described has actually worked for you? In theory it should only be the "set ownership" part that makes a difference.
edit: spelling
Using the latest docker image, upon running my docker-compose file, these are the errors that occur.
text error warn system array login
Database file not found, creating it...
Could not create database. Please check your volume's ownership
Database file not found, creating it...
Could not create database. Please check your volume's ownership
Database file not found, creating it...
Could not create database. Please check your volume's ownership
Database file not found, creating it...
After the docker failing, the directories appear like this.
root@dev-laptop:/mnt/user/appdata/internal# ls -al
total 0
drwxr-xr-x 1 root root 42 Jul 27 12:15 ./
drwxrwxrwx 1 nobody users 198 Jun 7 20:25 ../
drwxr-xr-x 1 911 911 301 Dec 19 2023 Home_Assistant/
drwxr-xr-x 1 root root 6 Jul 27 12:15 jetlog/
root@dev-laptop:/mnt/user/appdata/internal# ls -al jetlog/
total 0
drwxr-xr-x 1 root root 6 Jul 27 12:15 ./
drwxr-xr-x 1 root root 42 Jul 27 12:15 ../
root@dev-laptop:/mnt/user/appdata/internal#
I deleted .../appdata/internal/jetlog
and re-created the docker. Returned to the same error. I copied and pasted in the world.geo.json
and airports.db
into .../appdata/internal/jetlog
with 777 permissions and the docker started with no issues.
INFO: Started server process [8]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:3000 (Press CTRL+C to quit)
Please let me know what I am doing wrong. I tried looking through the dockerfile however could not find though I am not spending too much time troubleshooting.
Containers directory structure after running,
# ls -al
total 52
drwxr-xr-x 1 1000 1000 66 Jul 27 11:50 .
drwxr-xr-x 1 root root 192 Jul 27 12:39 ..
-rw-r--r-- 1 root root 298 Jul 26 10:12 Pipfile
-rw-r--r-- 1 root root 48972 Jul 26 10:12 Pipfile.lock
drwxr-xr-x 1 root root 68 Jul 8 06:37 data
drwxr-xr-x 1 root root 176 Jul 27 11:50 dist
drwxr-xr-x 1 root root 96 Jul 27 11:50 server
Updating the docker compose to allow the changing of ports like this works as expected.
---
services:
jetlog:
container_name: jetlog
image: pbogre/jetlog
networks:
- proxy
ports:
- "${SERVER_IP}:8914:8914"
volumes:
- /mnt/user/appdata/internal/jetlog:/data
environment:
- TZ=America/Chicago
- PUID=99
- PGID=100
- JETLOG_PORT=8914
restart: unless-stopped
networks:
proxy:
name: ${DOCKER_NETWORK}
driver: bridge
external: true
drwxr-xr-x 1 root root 6 Jul 27 12:15 jetlog/
When you first run the container, did you first manually create the volume folder (/mnt/user/appdata/internal/jetlog
) or did you let docker create it? If you create the folder manually as your normal user, it should be created without root ownership which would allow Jetlog to create files in it.
If not, I believe docker will create the folder with root:root
as owner. To change this, you can run
sudo chown -R 1000:1000 /mnt/user/appdata/internal/jetlog
After running this command, Jetlog should be able to create the database file.
I copied and pasted in the world.geo.json and airports.db into .../appdata/internal/jetlog with 777 permissions and the docker started with no issues.
This is the strangest part to me. Those two files are never even used in that directory, so adding them regardless of their permissions shouldn't make a difference. May I ask how you're changing their permission? Perhaps you're changing the permission of the whole folder recursively which then allows Jetlog to create the database file.
Regardless, thanks for this pull request! I'm happy with the changes you made, so I will merge this. If your problem persists, please feel free to open an issue so that we can discuss that in detail there.
Related https://github.com/pbogre/jetlog/issues/7#issuecomment-2252587530
Modifies the readme to have configuration options and a explanation.