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

Add postgres as database engine #388

Merged
merged 5 commits into from
Jan 12, 2023
Merged

Add postgres as database engine #388

merged 5 commits into from
Jan 12, 2023

Conversation

tomamplius
Copy link
Contributor

Allow use postgres as db engine

Copy link
Owner

@sissbruecker sissbruecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks I'm more open to this now, as the code doesn't use any SQLite specific features anymore. For some history, also see #218, and this fork: https://github.com/RoGryza/linkding-postgres.

The setup in the PR currently doesn't work, as the psycopg2 database driver is missing. So the main issue that needs to be solved is to get the driver set up for local development and in the Docker container for production.

siteroot/settings/base.py Show resolved Hide resolved
siteroot/settings/base.py Outdated Show resolved Hide resolved
docs/Options.md Outdated Show resolved Hide resolved
siteroot/settings/base.py Outdated Show resolved Hide resolved
.env.sample Show resolved Hide resolved
@sissbruecker
Copy link
Owner

Polished the docs a bit. I also had to change the setup a bit to fix issues with the Docker image. The only combination I got to work (locally at least) was to use psycopg2 instead of psycopg2-binary, and then also install libpq-dev in the Docker image. Otherwise I got errors at runtime with libpq either not being available, or being to old.

I'm still waiting for the cross-platform image to built, I'll post an update when it's ready for testing.

@sissbruecker
Copy link
Owner

I've pushed the Docker image with Postgres support for testing to: sissbruecker/linkding:test.

@tomamplius Would you mind giving it a try?

@tomamplius
Copy link
Contributor Author

I sorry i not use docker. i don't know how test it?

@sissbruecker
Copy link
Owner

Out of curiosity, how do you intend to run linkding without using Docker?

If you still want to give it a try using Docker, you can follow the instruction in the README, but use the sissbruecker/linkding:test image instead of sissbruecker/linkding:latest.

Otherwise I'll try to do some manual testing myself soon.

@tomamplius
Copy link
Contributor Author

Hi, i create script to create Debian package from git and deploy on proxmox lxc contener with apt.
My git is https://git.lgy.fr/thomas/debmaker.
I will push linkding script later when deb file will respect (FHS)[https://fr.wikipedia.org/wiki/Filesystem_Hierarchy_Standard]

@sissbruecker
Copy link
Owner

OK got it 👍

Anyway, then I'll do some testing using Docker myself.

@tomamplius
Copy link
Contributor Author

Thank you a lot.
And great work about this project.
I will work to new PR to add djengo-opensearch after

@sissbruecker sissbruecker merged commit 13e0516 into sissbruecker:master Jan 12, 2023
@ghost
Copy link

ghost commented Jan 13, 2023

Thanks for the Postgres support! Does anyone know if there's an easy way to migrate a sqlite database to Postgres? I'd like to migrate my existing installation and would prefer to avoid manually re-adding my bookmarks if possible.

@sissbruecker
Copy link
Owner

The easiest way is probably to export your bookmarks from the settings, and then import them again after switching the database. This will result in some minor differences (web archive snapshots will be generated again, scraped websites titles+descriptions will become the default unless an explicit title+description has been set), but those are usually acceptable.

Otherwise SQLite allows backups to SQL files, but I have my doubts if the generated syntax works out of the box with PostreSQL. Also the schema definition would have to be removed, as that is created by linkding on startup.

@tomamplius
Copy link
Contributor Author

pg loader is a good way https://pgloader.readthedocs.io/en/latest/ref/sqlite.html

@tomamplius
Copy link
Contributor Author

with data only option

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

Successfully merging this pull request may close these issues.

2 participants