SurfSense icon indicating copy to clipboard operation
SurfSense copied to clipboard

Looks like installation prerequisites stage requires postgreesql first

Open CoruNethron opened this issue 4 months ago • 7 comments

Cloned pgvector.git, started make:

make: pg_config: Command not found

Seems like there is a pre-prerequie to install postgreeSQL itself.

Executing these commands seems to help w. MacOS:

brew install postgresql
brew services start postgresql@14

CoruNethron avatar Oct 07 '25 03:10 CoruNethron

Probably it's not such an easy task to get PostgreeSQL up and running under MacOS:

psql
psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
	Is the server running locally and accepting connections on that socket?

Probably it requires some additional steps like settin up default user and password, but all my attempts failed:

 1017  brew services restart postgresql
 1018  psql -U postgree
 1019  createuser --superuser postgres
 1020  psql -U postgree
 1021  brew services stop postgresql
 1022  ls /opt/homebrew/var/postgresql@14/
 1023  brew postgresql-upgrade-database
 1024  ls /opt/homebrew/var/postgresql@14/
 1025  vim /opt/homebrew/var/postgresql@14/postmaster.opts
 1026  brew tap homebrew/services
 1027  ps -ef | grep UID && ps -ef | grep postgres
 1028  pg_ctl
 1029  pg_ctl --help
 1030  pg_ctl init
 1031  pg_ctl start
 1032  psql
...
 1273  psql --version
 1274  psql -U postgres
 1275  ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
 1276  alias pg_start="launchctl load ~/Library/LaunchAgents"
 1277  alias pg_stop="launchctl unload ~/Library/LaunchAgents"
 1278  pg_start
 1279  sudo pg_start
 1280  sudo launchctl load ~/Library/LaunchAgents
 1281  psql

Probably would be nice to get PostgreeSQL dockerized as well.

P.S. up to this point my attempt to get this software up and running is stuck. Waiting for guides on how to deal with postgree and with browser extension or 'Crawl' software (#375). But I feel this is very advanced and useful project. Really want to put my hands on it. Thank you.

CoruNethron avatar Oct 07 '25 05:10 CoruNethron

Probably it's not such an easy task to get PostgreeSQL up and running under MacOS:

psql
psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
	Is the server running locally and accepting connections on that socket?

Probably it requires some additional steps like settin up default user and password, but all my attempts failed:

 1017  brew services restart postgresql
 1018  psql -U postgree
 1019  createuser --superuser postgres
 1020  psql -U postgree
 1021  brew services stop postgresql
 1022  ls /opt/homebrew/var/postgresql@14/
 1023  brew postgresql-upgrade-database
 1024  ls /opt/homebrew/var/postgresql@14/
 1025  vim /opt/homebrew/var/postgresql@14/postmaster.opts
 1026  brew tap homebrew/services
 1027  ps -ef | grep UID && ps -ef | grep postgres
 1028  pg_ctl
 1029  pg_ctl --help
 1030  pg_ctl init
 1031  pg_ctl start
 1032  psql
...
 1273  psql --version
 1274  psql -U postgres
 1275  ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
 1276  alias pg_start="launchctl load ~/Library/LaunchAgents"
 1277  alias pg_stop="launchctl unload ~/Library/LaunchAgents"
 1278  pg_start
 1279  sudo pg_start
 1280  sudo launchctl load ~/Library/LaunchAgents
 1281  psql

Probably would be nice to get PostgreeSQL dockerized as well.

P.S. up to this point my attempt to get this software up and running is stuck. Waiting for guides on how to deal with postgree and with browser extension or 'Crawl' software (#375). But I feel this is very advanced and useful project. Really want to put my hands on it. Thank you.

@NatsumeRyuhane @Sampada-Is-Learning I remember you guys also facing issues setting up postgres on Mac. How did you solve that?

MODSetter avatar Oct 07 '25 18:10 MODSetter

brew install postgres installs the latest version of postgres which is 18 afaik. You might want to install and start postgres 14. Just use postgres@14 for installation and starting the service.

samkul-swe avatar Oct 07 '25 19:10 samkul-swe

@samkul-swe thanks, but my brew install postgres actually installed v.14 by default

The issue comes aftrer, that upon brew services start postgresql@14 the service is not actually started. Maybe it requires additional steps to pre-configure it before first run?

CoruNethron avatar Oct 07 '25 22:10 CoruNethron

brew install pgvector

Try this please

samkul-swe avatar Oct 07 '25 23:10 samkul-swe

@samkul-swe brew install pgvector succeeds. But I still have no idea if I should start manually some service or change/set any default or specific username and password, cause I'm not a postgree user. If we suppose, that successfull installation of pgvector is enough to place a checkmark for pre-install steps, then problem arise in Docker Installation documentation:

This documentation starts with copying some pre-defined environment files. I think it's better to start with git clone and cd .. becasue non-experienced user will definitely face an issue trying to copy non-existing files. I'm sorry for such a dumb proposal, but I insist that installation stage should be as much copy-paste as possible, or at least well-explained.

Then We might want to change some of 66 (sixty six) variables before we get started to docker compose. Which of these variables do I need to set manually and which of them I'll better leave as is? We have PGADMIN_PORT that is 5050 by default, but when I visit localhost:5050 , I see ERR_CONNECTION_REFUSED . Also we have POSTGRES_USER and POSTGRES_PASSWORD which is postgree by default. I'm not sure how would I check if in my setup these username and password are active or not cause of this . And looking at another 66 variables feels like a whole-day research , analyzing each variable importance, looking at what is default value in .env file and deciding if I need to set another value to get it working.

With respect and best wishes.

P.S.: btw. @MODSetter why the postgrees is not included within docker image? I think that it may be a possible alternative to provide, probably more fat but self-contained distribution, that requires less manual setup by including and configuring it within docker image.

CoruNethron avatar Oct 16 '25 07:10 CoruNethron

FYI: I managed to run it locally somehow.

Despite the fact that no 5432 nor 5050 ports was accessible on my local machine, after installing pgvector, I just moved on to environment variables setup and docker.

The variables, that I actually changed:

./SurfSence/.env

POSTGRES_PASSWORD=myownvaluefromhead

./SurfSence/surfsence_backend/.env

DATABASE_URL=postgresql+asyncpg://postgres:myownvaluefromhead@localhost:5432/surfsense
SECRET_KEY=SECRETqwe
AUTH_TYPE=LOCAL
TTS_SERVICE=local/kokoro

I dodn't expect to run whole surfsense.com locally, but that's what it is. Impressed.

Then, after registration of a new user fails with "something go wrong", I passed a pgAdmin stages from documentation

And then I can register a new user.

To setup local LLM I have to specify API base url as http://host.docker.internal:8080/v1 whilst llama.cpp is running on my host machine and listening on port 8080.

After that I'm able to talk to LLM in a chat UI.

Started uploading a PDF. At the moment, it's still n progress. Last probably related logs on a backend docker container was ms-marco-MiniLM-L-12-v2.zip: 100%|██████████| 21.6M/21.6M [01:58<00:00, 192kiB/s] and task is in progress for about half an hour now.

Anyways, sorry that I convert a postgree-related issue to just my installation and configuration experience. It's now much more managable and debuggable story, that I probably can handle.

Thank you.

CoruNethron avatar Oct 16 '25 08:10 CoruNethron