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

Can I specify a database to automatically open? #14

Closed
1 task done
halfer opened this issue Aug 3, 2024 · 8 comments
Closed
1 task done

Can I specify a database to automatically open? #14

halfer opened this issue Aug 3, 2024 · 8 comments

Comments

@halfer
Copy link

halfer commented Aug 3, 2024

Is this a new feature request?

  • I have searched the existing issues

Wanted change

Hi folks

I'm logging this as a "feature request", but I expect it is already possible. I have scoured the docs fairly thoroughly, and cannot find anything.

I have set up this image in my Docker Compose like so:

  db-browser:
    image: lscr.io/linuxserver/sqlitebrowser:latest
    ports:
      - 3000:3000
    environment:
      - FM_HOME=/database
    volumes:
      - ../database:/database
      - ../storage/sqlitebrowser:/config

This seems to work great; the database volume lets the system read from my SQLite folder. However I'd love to be able to load a database automatically, as for my current project I'll always be working on just one database.

I wonder if it could be this file?

https://github.com/linuxserver/docker-sqlitebrowser/blob/master/root/defaults/autostart

Could I just amend this to have a fully-qualified database pathname, and it would auto-open? I'd need my own Dockerfile so as to make this change, but that is not much bother. (I may yet try this, but it is rather guesswork at this stage).

Thanks for your work - this is going to be very useful!

Reason for change

I suspect this is not a code change, maybe a documentation change. I think it would be a generally useful feature.

Proposed code change

Probably a code change is not necessary.

@halfer halfer added the enhancement New feature or request label Aug 3, 2024
Copy link

github-actions bot commented Aug 3, 2024

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

@halfer
Copy link
Author

halfer commented Aug 3, 2024

Right, well I tried modifying the /root/autostart file, and the browser app still starts up, but there does not seem to be any autoloading.

Might there be an env var for this that I've simply overlooked?

@aptalca
Copy link
Member

aptalca commented Aug 3, 2024

Check if the sqlitebrowser accepts such arguments or env vars. That's not under our control.

@halfer
Copy link
Author

halfer commented Aug 3, 2024

Thanks for the note @aptalca.

I notice in the VNC windowing environment, I can close the "DB Browser for SQLite" window, right-click to get a GUI context menu, choose "xterm", then type sqlitebrowser /database/database-dev.sqlite and that has the effect that I want.

I note also that without my writing the /root/autostart file with a custom Dockerfile, there is no file in this location at all. So I think I have misunderstood where the default command of sqlitebrowser is stored so that it is invoked on GUI start-up.

Thus I don't think this is a downstream issue per se; I just need to find where this command is stored. Is it started by the S6 supervisor system?

@halfer
Copy link
Author

halfer commented Aug 3, 2024

Ha, well I found a yucky solution. I worked out where the executable was, and hacked it in a downstream image. I'd be happy if there is an easier way to do this, but it'll do for now...

FROM lscr.io/linuxserver/sqlitebrowser:latest

# Ooh, a bit hacky!
RUN mv /usr/bin/sqlitebrowser /usr/bin/sqlitebrowser-exec
RUN echo '#!/bin/bash' > /usr/bin/sqlitebrowser
RUN echo '/usr/bin/sqlitebrowser-exec /database/database-dev.sqlite' >> /usr/bin/sqlitebrowser
RUN chmod +x /usr/bin/sqlitebrowser

@aptalca
Copy link
Member

aptalca commented Aug 3, 2024

If the cli argument works, you can just set it in autostart in the config folder. That's persistent

@LinuxServer-CI
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.

@LinuxServer-CI LinuxServer-CI closed this as not planned Won't fix, can't repro, duplicate, stale Nov 2, 2024
@LinuxServer-CI LinuxServer-CI moved this from Issues to Done in Issue & PR Tracker Nov 2, 2024
Copy link

github-actions bot commented Dec 2, 2024

This issue is locked due to inactivity

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

No branches or pull requests

3 participants