Closed VLucet closed 2 years ago
Hi! Thanks a lot for your message. I have been informed about problems with database authentication, mostly due to special characters like underscores and hyphens in account names (as in your case). These have mostly been resolved, but chances are some special environments still require optimization.
Could you please check the contents of Postgres' authentication file? You can do so with the following command:
version=12 # replace this with the current PostgreSQL version you have installed; check with "psql -V"
sudo cat /etc/postgresql/$version/main/pg_hba.conf
You should see this line in there, among others:
host all all 0.0.0.0/0 md5
(for the latest versions of Postgres "md5" might be replaced with "scram-sha-256")
If you cannot find it, you can add it manually:
version=12 # see above
echo "host all all 0.0.0.0/0 scram-sha-256" | sudo tee -a /etc/postgresql/$version/main/pg_hba.conf > /dev/null
# restart server
sudo service postgresql restart
Then try again.
If the line is there and you still get this error: can you execute the following statements from within the AIDE root directory?
export AIDE_CONFIG_PATH=config/settings.ini # modify to point to your custom settings.ini file if needed
export AIDE_MODULES=FileServer
export PYTHONPATH=.
dbName=$(python util/configDef.py --section=Database --parameter=name)
dbUser=$(python util/configDef.py --section=Database --parameter=user)
dbPassword=$(python util/configDef.py --section=Database --parameter=password)
dbPort=$(python util/configDef.py --section=Database --parameter=port --fallback=5432)
sudo -u postgres psql -c "CREATE USER \"$dbUser\" WITH PASSWORD '$dbPassword';"
sudo -u postgres psql -c "CREATE DATABASE \"$dbName\" WITH OWNER \"$dbUser\" CONNECTION LIMIT -1;"
sudo -u postgres psql -d $dbName -c "GRANT CREATE, CONNECT ON DATABASE \"$dbName\" TO \"$dbUser\";"
sudo -u postgres psql -d $dbName -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";"
sudo -u postgres psql -d $dbName -c "GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO \"$dbUser\";"
# then try again
python setup/setupDB.py
Please let me know if that worked; otherwise we'd have to dig a little deeper.
Hi, thanks for the reply!
I do see the line, but it is repeated 4 times. I edited the conf file so that it is only there once (must have rerun the same command multiple times I guess?) Just restarting the service didn't work. But your second set of instructions seems to have worked (the python script ran no problem). My understanding is that it manually created the proper user with the proper username and granted access database access to it? Just trying to understand. I will let you know if I run into more issues. But that did it, thanks!
Hi! I am trying to set up AIDE on my local machine but I am having issues with setting up the database. Everything seems to work fine until I have to run
python setup/setupDB.py
. I seem to have the .ini file set up properly, and the postgres database seems to have been set up correctly as well. But I am quite new to databases, so my ability to debug on my own is a little limited.The error I get when I run
python setup/setupDB.py
is the following: