PursuanceProject / pursuance

Pursuance: end-to-end encrypted task management optimized for large numbers of volunteers. We are building a vast and formidable ecosystem of opposition to institutionalized injustice.
https://pursuanceproject.org/
Other
133 stars 15 forks source link

Cannot Create Pursuance (Table not being Created) #196

Closed greg-han closed 6 years ago

greg-han commented 6 years ago

I am running ubuntu 16.04 LTS and did all of the instructions above on a completely fresh install.

So, I've tried all of the different ways of installing the pursuance project, and I have not been able to start a pursuance to get basic functionality and work on other issues!

I'm able to install every other part of the code smoothly, but I am unable to do this command.

sudo -u postgres bash init_sql.sh

I get this error

could not change directory to "/home/user/gocode/src/github.com/PursuanceProject/pursuance/db": Permission denied sql/init001.sql: No such file or directory

I'm able to start the server fine with ./postgres postgres.conf

When attempting to create a pursuance, I get this error: Unhandled Rejection (TypeError): Cannot read property 'id' of undefined with this code snippet: ` 19 | return state; 20 | 21 | case 'POST_PURSUANCE_FULFILLED':

22 | return Object.assign({}, state, { 23 | [action.payload.id]: action.payload 24 | });`

After digging through the custom bash script init_sql.sh, all of this information has led me to the conclusion that the proper table is not being created. I am going to try and manually create the tables in the script right now, and if it works i'll post it here. Either way, after following exact installation instructions, the program does not work so I am raising this issue

greg-han commented 6 years ago

I have tried to run what is in the shell scripts myself after logging in as user postgres here is what I tried

`postgres@computer:~$ psql -U $pg_user -d leapchat -f "$file"

psql: FATAL: Peer authentication failed for user "-d"

postgres@computer:~$ cd sql/init*.sql

-bash: cd: sql/init*.sql: No such file or directory

postgres@computer:~$ psql -U $pg_user -d leapchat -f "$file"

psql: FATAL: Peer authentication failed for user "-d"

postgres@computer:~$ psql -U $pg_user -d leapchat -f "$file"

psql: FATAL: Peer authentication failed for user "-d" postgres@computer:~$ `

So I am at a loss right now.

greg-han commented 6 years ago

I also tried running this part of the script: sudo -i -u postgres postgres@gxps:~$ set -euo pipefail postgres@gxps:~$ psql < sql/pre.sql -bash: sql/pre.sql: No such file or directory and also in terminal tried using find /sql

It seems like the problem boils down to both not having permissions to the "/home/user/gocode/src/github.com/PursuanceProject/pursuance/db" folder for user postgres and also the sql folder missing from the system.

elimisteve commented 6 years ago

@greg-han

cd $(go env GOPATH)/src/github.com/PursuanceProject/pursuance/db
sudo -u postgres bash init_sql.sh

What exactly is the error when you run those 2 commands, one after the other, in the same terminal?

elimisteve commented 6 years ago

Sounds like

could not change directory to "/home/user/gocode/src/github.com/PursuanceProject/pursuance/db": Permission denied sql/init001.sql: No such file or directory

is the error; okay thanks. Researching...

greg-han commented 6 years ago

Ok, using nautilus, i moved init_sql.sh to /var/lib/postgresql (This is where user postgres has permissions to access) I ran the file, and I got this error: sql/init*.sql: No such file or directory

This is the same result as changing to using postgres using sudo -i -u postgres

Then running the shell scripts manually.

greg-han commented 6 years ago

Ok, now in the original folder where the script should have been run: $(go env GOPATH)/src/github.com/PursuanceProject/pursuance/db I manged to get the script to create the sql folder.

Now, I moved that folder into the folder which postgres has permissions: `/var/lib/postgresql'

THEN, I ran the command sudo -u postgres bash init_sql.sh

The tables were created! But the last command seemed to have failed. ERROR: role "superuser" already exists ERROR: database "leapchat" already exists GRANT ALTER ROLE CREATE EXTENSION CREATE TABLE ALTER TABLE CREATE TABLE ALTER TABLE CREATE TABLE ALTER TABLE CREATE FUNCTION ALTER FUNCTION CREATE TRIGGER CREATE INDEX ALTER INDEX CREATE FUNCTION ALTER FUNCTION CREATE TABLE ALTER TABLE CREATE TABLE ALTER TABLE CREATE TABLE ALTER TABLE CREATE EXTENSION CREATE INDEX CREATE INDEX CREATE FUNCTION ALTER FUNCTION CREATE TRIGGER /bin/bash: migrate.sh: No such file or directory

greg-han commented 6 years ago

Using nautilus, moved migrate.sh into var/lib/postgresql and ran sudo -u postgres bash init_sql.sh again.

Success!!! I can now create a pursuance and the project seems to run fine. Please let me know if there will be any problems with what I did. I figured that postgres stores its DB in a local folder and regardless of where you initialize it from, it will still create folders in the same "place".

However, I don't know if there is any code that specifically points to the folder: $(go env GOPATH)/src/github.com/PursuanceProject/pursuance/db

Someone correct me if there is a better way of doing this! Thanks.

Notes: After running migrate.sh I noticed a few "messages" I am noting them here for the future: psql::sql/migration001.sql:1: NOTICE: function subtasks_recusrive_flat(text) does not exist, skipping and psql::sql/migration001.sql:1: NOTICE: function subtasks_recusrive_flat(text,pg_catalog.int4) does not exist, skipping