Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update installation docs #31

Closed
shricodev opened this issue Feb 13, 2023 · 10 comments
Closed

Update installation docs #31

shricodev opened this issue Feb 13, 2023 · 10 comments

Comments

@shricodev
Copy link

I followed all the installation guide and still had problem with make postgres on a debian machine.
Initially I had the following error when running the sudo make postgres

-> Configure PostgreSQL database
-> Create database user 'packagedb'
sudo -u postgres createuser --no-createrole --no-superuser --login --inherit --createdb packagedb || true
sudo: unknown user: postgres
sudo: error initializing audit plugin sudoers_audit
sudo -u postgres psql -c "alter user packagedb with encrypted password 'packagedb';" || true
sudo: unknown user: postgres
sudo: error initializing audit plugin sudoers_audit
-> Drop 'packagedb' database
sudo -u postgres dropdb packagedb || true
sudo: unknown user: postgres
sudo: error initializing audit plugin sudoers_audit
-> Create 'packagedb' database
sudo -u postgres createdb --encoding=utf-8 --owner=packagedb packagedb
sudo: unknown user: postgres
sudo: error initializing audit plugin sudoers_audit
make: *** [Makefile:87: postgres] Error 1

so I started the service sudo service postgresql start
and I tried creating a user postgres manually and the error still persists with the following error message.

-> Configure PostgreSQL database
-> Create database user 'packagedb'
sudo -u postgres createuser --no-createrole --no-superuser --login --inherit --createdb packagedb || true
createuser: error: could not connect to database template1: could not connect to server: No such file or directory
	Is the server running locally and accepting
	connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
sudo -u postgres psql -c "alter user packagedb with encrypted password 'packagedb';" || true
psql: error: could not connect to server: No such file or directory
	Is the server running locally and accepting
	connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
-> Drop 'packagedb' database
sudo -u postgres dropdb packagedb || true
dropdb: error: could not connect to database template1: could not connect to server: No such file or directory
	Is the server running locally and accepting
	connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
-> Create 'packagedb' database
sudo -u postgres createdb --encoding=utf-8 --owner=packagedb packagedb
createdb: error: could not connect to database template1: could not connect to server: No such file or directory
	Is the server running locally and accepting
	connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
make: *** [Makefile:87: postgres] Error 1

am I missing something?

Installed OS: Debian 6.0.12-1parrot1 x86_64 GNU/Linux
Installed PostgreSQL: postgres (PostgreSQL) 13.9 (Debian 13.9-0+deb11u1)

@shricodev
Copy link
Author

I've tried some online solutions but none of them seems to work here :(

@35C4n0r
Copy link
Contributor

35C4n0r commented Feb 13, 2023

@OctoPie23 Try this, since it worked for me ;)

  1. First Start your postgresql service. Use sudo service postgresql start
  2. Find your postgresql.conf file, you can do it by sudo -u postgres psql -c 'SHOW config_file'
  3. Open that file and listen_address to '*'
  4. Restart your postgres server sudo service postgresql restart

Now try sudo make postgres or make postgres.

@AyanSinhaMahapatra AyanSinhaMahapatra changed the title Problem with make postgres Update installation docs Feb 13, 2023
@AyanSinhaMahapatra
Copy link
Member

@OctoPie23 did this work? ^

@AyanSinhaMahapatra
Copy link
Member

@JonoYang I also had to run make envfile before make postgres, otherwise I got the following error traceback:

  File "/home/ayansinha/nexB/write_access/purldb/purldb/settings.py", line 31, in <module>
    SECRET_KEY = env.str("SECRET_KEY")
  File "/home/ayansinha/nexB/write_access/purldb/venv/lib/python3.8/site-packages/environ/environ.py", line 213, in str
    value = self.get_value(var, cast=str, default=default)
  File "/home/ayansinha/nexB/write_access/purldb/venv/lib/python3.8/site-packages/environ/environ.py", line 407, in get_value
    raise ImproperlyConfigured(error_msg) from exc
django.core.exceptions.ImproperlyConfigured: Set the SECRET_KEY environment variable

Is this right? Do we need to update the docs at README.rst for this?

Also we might want to add .env to the .gitignore file.

@35C4n0r
Copy link
Contributor

35C4n0r commented Feb 13, 2023

@JonoYang I also had to run make envfile before make postgres, otherwise I got the following error traceback:

  File "/home/ayansinha/nexB/write_access/purldb/purldb/settings.py", line 31, in <module>
    SECRET_KEY = env.str("SECRET_KEY")
  File "/home/ayansinha/nexB/write_access/purldb/venv/lib/python3.8/site-packages/environ/environ.py", line 213, in str
    value = self.get_value(var, cast=str, default=default)
  File "/home/ayansinha/nexB/write_access/purldb/venv/lib/python3.8/site-packages/environ/environ.py", line 407, in get_value
    raise ImproperlyConfigured(error_msg) from exc
django.core.exceptions.ImproperlyConfigured: Set the SECRET_KEY environment variable

Is this right? Do we need to update the docs at README.rst for this?

Also we might want to add .env to the .gitignore file.

Yup that is right, we need the SECRET_KEY before setting up postgres, we do need to update that.

@shricodev
Copy link
Author

shricodev commented Feb 13, 2023

@OctoPie23 did this work? ^

Will look into it and let you know :P

@shricodev
Copy link
Author

@AyanSinhaMahapatra I couldn't reproduce that following error. Because I tried reinstalling the postgres. I guess that error was because of installation fault somehow.

I faced another error somehow similar to yours related to the SECRET_KEY which was resolved when I ran make envfile first and then make postgres and everything worked fine except few tests but still everything works fine. I've added the test errors here https://gist.github.com/OctoPie23/6cccbaf4faa7ba20785d3144d77b4f79

So, yeah in the documentation in the steps its better to add make envfile before make postgres.

@shricodev
Copy link
Author

Also the python-dev is updated to python2/3-dev so we should also consider changing it.
Currently using the Ubuntu 22.04. Above it says that use python3-dev but down it says https://scancode-toolkit.readthedocs.io/en/stable/getting-started/install.html#prerequisites

piyush@piyush-virtual-machine:~/Desktop$ sudo apt install python-dev bzip2 xz-utils zlib1g libxml2-dev libxslt1-dev libpopt0
[sudo] password for piyush: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package python-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  python2-dev:i386 python2:i386 python2-dev python2 python-dev-is-python3

E: Package 'python-dev' has no installation candidate

@35C4n0r
Copy link
Contributor

35C4n0r commented Feb 16, 2023

@AyanSinhaMahapatra I couldn't reproduce that following error. Because I tried reinstalling the postgres. I guess that error was because of installation fault somehow.

I faced another error somehow similar to yours related to the SECRET_KEY which was resolved when I ran make envfile first and then make postgres and everything worked fine except few tests but still everything works fine. I've added the test errors here https://gist.github.com/OctoPie23/6cccbaf4faa7ba20785d3144d77b4f79

So, yeah in the documentation in the steps its better to add make envfile before make postgres.

@OctoPie23 saw the gist, can you please specify the python version you are using

@shricodev
Copy link
Author

@35C4n0r Python 3.10.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants