linkwarden
linkwarden copied to clipboard
Using existing PostgreSQL Database
How can I configure and install Linkwarden so that it uses an existing Postgresql installation? unfortunately i have not found anything about this in the documentation.
Thank you.
If you aren't using docker-compose, you can just set DATABASE_URL and it should work as expected.
@fantibaer I just went through this a few minutes ago, so it's fresh in my mind. Thought I would contribute in a little more detail in case you or the next person that Google brings here has the same skill level I do (I.e.: need a little more guidance than most)
I'm assuming that you are using the docker install method. If you are not, I'm too novice to be any help.
In my compose.yaml file, I commented out the existing line for DATABASE_URL and added a new line immediately after it as follows.
- DATABASE_URL=${DATABASE_URL}
And in my .env file, using the provided sample .env file, I filled out line 6 as follows.
DATABASE_URL=postgresql://username:[email protected]:5432
Adjusting to use the username, password, and IP address for your database server, obv.
Over on my Postgres server, I used pgAdmin to create a new user, and after some trial and error figured out that I needed to give that user the following privileges.
And that is the sum total of everything I know about setting up a manual database install. You now know everything I know. Maybe a look at my .yaml and .env files for linkwarden, postgres and pgadmin would help you? I'll be pasting those in as marked up screen shots below because a decade of meme wars on social media has rotted my brain I guess.
And one last little thing. If you are currently installing a stand alone postgres server via docker as I am, you will run into one really stupid permission problem when setting up the pgAdmin container. The pgAdmin devs have set the UID and GID of their container's internal user as 5050 and the best I can tell, the reason they did it was to make the UID:GID match the IP port that pgAdmin uses. The result is that if you simply follow the docker install guide, you will end up with a "Permission denied: '/var/lib/pgadmin/sessions'" error getting in your way.
I found this being discussed in several places on the internet, including their github at https://github.com/laradock/laradock/issues/2552
The fix is to chown -R 5050:5050 whatever folder on the host system you are keeping the container's persistent files at. In my case, I put my compose.yaml file at /opt/stacks/pgadmin/compose.yaml and as this part of my yaml file
volumes: - ./data:/var/lib/pgadmin
The persistant data is in a subfolder, at /opt/stacks/pgadmin/data/
So on my host system sudu chown -R 5050:5050 /opt/stacks/pgadmin/data/ got me all sorted out.
I don't really get why it has to be this way, but I also don't know what's going on in their development environment so my criticism is kinda unqualified. Anyways, I'm going to stop talking and hang up now.