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

Unable to login successfully during the local development environment setup #4090

Closed
codetochangeMinds opened this issue Nov 13, 2020 · 7 comments · Fixed by #4126
Closed
Assignees
Labels
Lead: @cdrini Issues overseen by Drini (Staff: Team Lead & Solr, Library Explorer, i18n) [managed] Priority: 1 Do this week, receiving emails, time sensitive, . [managed] Theme: Development Issues related to the developer experience and the dev environment. [managed] Type: Bug Something isn't working. [managed]

Comments

@codetochangeMinds
Copy link

codetochangeMinds commented Nov 13, 2020

At the time of login to OL interface an internal error is noticed.

Evidence / Screenshot (if possible)

Screenshot from 2020-11-13 12-09-28
Screenshot from 2020-11-13 13-05-44

Relevant url?

Steps to Reproduce

  1. Run docker-compose up
  2. Browse to localhost:8080
  3. Try to Login
  • Actual: Showed Internal Error
  • Expected:

Details

  • Logged in (Y/N)? Y
  • Browser type/version? Firefox/Chromium
  • Operating system? Ubuntu 18.04
  • Environment (prod/dev/local)? local

Proposal & Constraints

Related files

Stakeholders

@codetochangeMinds codetochangeMinds added Needs: Triage This issue needs triage. The team needs to decide who should own it, what to do, by when. [managed] Type: Bug Something isn't working. [managed] labels Nov 13, 2020
@cclauss
Copy link
Collaborator

cclauss commented Nov 13, 2020

Did this happen immediately after a reboot? Or had the server been up for a while?

Do you get the same behaviour if you do docker-compose down && PYENV_VERSION=3.8.6 docker-compose up

@codetochangeMinds
Copy link
Author

It happened after the server was up for a while. If I execute the above given command then I get different error and its not displaying even the home page.

File "/home/openlibrary/.pyenv/versions/3.8.6/lib/python3.8/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
self.wsgi = self.app.wsgi()
File "/home/openlibrary/.pyenv/versions/3.8.6/lib/python3.8/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "scripts/openlibrary-server", line 82, in load
load_infogami(self.config_file)
File "scripts/openlibrary-server", line 50, in load_infogami
import infogami

@SouthGoingZax
Copy link
Collaborator

I get the same thing now, which makes my local environment unusable. The server has been up for a while, and it started happening after a git pull. I don't know what the usergroup normally is for local accounts, so I'm not sure if it's related to the beta-testers usergroup or not. Is there some way outside of using the site to see or add usergroup members? If so, I'd be happy to try that.

image

@mekarpeles mekarpeles added the Lead: @cdrini Issues overseen by Drini (Staff: Team Lead & Solr, Library Explorer, i18n) [managed] label Nov 16, 2020
@cdrini
Copy link
Collaborator

cdrini commented Nov 16, 2020

P1 since blocking local development.

Yes, the beta-testers usergroup is the problem. It doesn't exist in local docker's DB. To fix it:

  1. Find/Modify the code that looks for /usergroup/beta-testers to not try to get that username (ctrl-shift-f or grep the codebase for beta-testers, and try to comment out the appropriate place)
  2. Start docker, and log in as admin
  3. Create the usergroup (go to localhost:8080/usergroup/beta-testers and paste just the description from https://openlibrary.org/usergroup/beta-testers.json into it)
  4. Dump the database using /openlibrary/scripts/dev-instance/create-dev-db-pgdump.sh > /openlibrary/scripts/dev-instance/dev_db.pg_dump (inside home) to update the db.
  5. Commit the updated db

See #720 (comment) for more info

@cdrini cdrini added Priority: 1 Do this week, receiving emails, time sensitive, . [managed] Theme: Development Issues related to the developer experience and the dev environment. [managed] and removed Needs: Triage This issue needs triage. The team needs to decide who should own it, what to do, by when. [managed] labels Nov 16, 2020
@cdrini cdrini added this to the Active Sprint milestone Nov 16, 2020
@cdrini
Copy link
Collaborator

cdrini commented Nov 16, 2020

Would you be able to take a look at this, @SouthGoingZax ?

@SouthGoingZax
Copy link
Collaborator

SouthGoingZax commented Nov 17, 2020

Re: #1, here is a work-around (not sure if this changes the priority of the issue):

diff --git a/conf/openlibrary.yml b/conf/openlibrary.yml
index 903e32d94..61295f244 100644
--- a/conf/openlibrary.yml
+++ b/conf/openlibrary.yml
@@ -77,9 +77,7 @@ features:
     support: admin
     undo: enabled
     upstream: enabled
-    user_metadata:
-        filter: usergroup
-        usergroup: /usergroup/beta-testers
+    user_metadata: enabled
 
 upstream_to_www_migration: true
 default_template_root: /upstream
diff --git a/openlibrary/core/models.py b/openlibrary/core/models.py
index e895c89e9..0fa99711f 100644
--- a/openlibrary/core/models.py
+++ b/openlibrary/core/models.py
@@ -672,7 +672,8 @@ class User(Thing):
         return self.is_usergroup_member('/usergroup/sponsors')
 
     def is_beta_tester(self):
-        return self.is_usergroup_member('/usergroup/beta-testers')
+        #return self.is_usergroup_member('/usergroup/beta-testers')
+        return True
 
     def get_lists(self, seed=None, limit=100, offset=0, sort=True):
         """Returns all the lists of this user.

For step 5, it seems like I have to do that on db, not home, as I get a psql-related file not found error on home.

I have the dump, but my database is not really a model database at this point. I corrupted authors on books on the frontpage to work on a related PR. I also somehow got into a state around the time this bug showed up where an attempt to log in with the admin credentials succeeded but silently created a new, duplicate (but non-admin) account. Future log-ins would use that non-admin account, and I had to muck with psql to undo enough of it to be able to log in to the original admin account to work on this issue, but there is still cruft left-over from that account creation in dump diff. Is there a clean way for me to reset my local database, and then I can re-do these steps for a clean diff?

@cdrini
Copy link
Collaborator

cdrini commented Nov 17, 2020

@SouthGoingZax that looks great so far!

docker-compose down

# Remove all ol-related volumes
docker volume ls
docker volume rm openlibrary_blah

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Lead: @cdrini Issues overseen by Drini (Staff: Team Lead & Solr, Library Explorer, i18n) [managed] Priority: 1 Do this week, receiving emails, time sensitive, . [managed] Theme: Development Issues related to the developer experience and the dev environment. [managed] Type: Bug Something isn't working. [managed]
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants