cortex-lab / alyx

Database for experimental neuroscience laboratories
44 stars 11 forks source link

Permissions issues using sudo -u postgres & other minor setup tweaks #628

Closed sneakers-the-rat closed 4 years ago

sneakers-the-rat commented 4 years ago

Hello! Had trouble running the setup script -- using the sudo -u postgres syntax leaves the home directory set for the calling user, and even when the postgres group was given write and execution privileges I was still getting permissions errors. Didn't want to have to make the postgres user the owner of the repository directory, so changed the _psql command to use sudo su - postgres -c "command" syntax. This runs the command as the postgres user in a login shell which fixed permissions errors for me. I don't think this has any negative effects, but could be wrong.

I also was getting errors calling alyxvenv/bin/python because I accidentally named mine alyxenv, so to make it a bit more flexible (not have to have an exactly correctly named venv) I added a check that the user was in a virtual environment and then changed those calls to just use python.

I also wrapped the commands in try/catch blocks with status reporting because I wasn't sure if the setup was succesful or not :)

Anyway, hope that's useful.

details: