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

Not able to access DB when running on phet-server-dev #208

Closed
jbphet opened this issue May 8, 2019 · 8 comments
Closed

Not able to access DB when running on phet-server-dev #208

jbphet opened this issue May 8, 2019 · 8 comments
Assignees

Comments

@jbphet
Copy link
Contributor

jbphet commented May 8, 2019

I'm trying to test and debug some changes to rosetta by running it on phet-server-dev. Unfortunately, this currently isn't working, and from the log it looks like the problem is related to failures when trying to read previously stored strings from the database (recall that while rosetta stores translated strings in GitHub, it supports storage of unfinished translation strings in a database that we make available). My guess is that something about the DB on phet-server-dev is different from the one that is presumably working on phet-server. Here is what is showing up in the logs:

May 08 15:38:04 phet-server-dev.int.colorado.edu rosetta[29665]: May 08 2019 15:38:04 MDT - info: running query: SELECT * from saved_translations where user_id = $1 AND locale = $2 AND (repository = 'shred' OR repository = 'isotopes-and-atomic-mass' OR repository = 'joist' OR repository = 'scenery-phet')
May 08 15:38:04 phet-server-dev.int.colorado.edu rosetta[29665]: May 08 2019 15:38:04 MDT - error: unhandled rejection, error.message = password authentication failed for user "phet-admin"

@mattpen - can you help me figure out what's up with this?

@mattpen
Copy link
Contributor

mattpen commented May 9, 2019

@jbphet - It looks like there was no user created for phet-admin on phet-server-dev, so I just created one. It should work now, can you please try again or send me the steps to test?

@mattpen mattpen assigned jbphet and unassigned mattpen May 9, 2019
@jbphet
Copy link
Contributor Author

jbphet commented May 10, 2019

I just tested this, and the problem is still present. @mattpen - it doesn't seem like creating the phet-admin user changed anything. Back to you for further investigation.

If you'd like to test changes yourself, you can make them, and then try to log in to rosetta and get to the sim translation page while watching the log file using journalctl. When I try to get to a translation page, I see the errors described above appear in the log, and then the page times out in my browser. I'd be glad to demonstrate over Zoom if it would help.

@jbphet
Copy link
Contributor Author

jbphet commented May 11, 2019

Actually, I've found some issues in configurePreferences.js that might explain what's going on here, and I'll need to discuss it with @zepumph before spending any more time on it. Assigning back to myself.

@jbphet jbphet assigned zepumph and jbphet and unassigned mattpen May 11, 2019
@jbphet
Copy link
Contributor Author

jbphet commented May 17, 2019

It looks like in September of last year some work was done related to #167, where we wanted to replace the pg-query library with something more current. As part of this effort, code was added to set environment variables fir a different library called pg. However, this code isn't currently working on phet-server-dev, and I have some questions about it:

  • The pg package depends on environment variables for things like the DB location, and the code that sets the values of the environment variables is in an if block with the condition if ( process.env.ENV === 'dev' ) (see configurePreferences.js line 46 as of this writing) . I don't understand the intent here, and was wondering if someone could explain it to me. Without these values set, I don't think queries will work, so why is the if clause used? How is the process.env.ENV variable supposed to get set?
  • pg-query is still used in stringSubmissionQueue.js. Why is this? Did the effort to replace it only get part way finished?
  • Was this tested anywhere? I don't see any variables for setting the preferences in the .phet directory for phet-admin, so I'm wondering if this was just being tested locally and was never deployed on phet-server-dev. Perhaps the variables were meant to allow local testing, and it was never deployed, which is fine, but I'd like to know what was done and the state it was in when last worked on.

I'm going to assign to @mbarlow12 to see if he is still working on any of this and, if so, maybe he can save me some time by clarifying what was going on with this. Also assigning to @zepumph in case he has any insight (@zepumph - if you don't have any knowledge on this, feel free to just say so and unassign).

@jbphet jbphet assigned mbarlow12 and unassigned jbphet May 17, 2019
@zepumph
Copy link
Member

zepumph commented May 17, 2019

I'm sorry to say I don't think I can help here! I remember doing c4b8413, but don't know anything about the dev environment if block, or work done on pg.

Good luck!

@zepumph zepumph removed their assignment May 17, 2019
@mbarlow12
Copy link
Contributor

I don't think this was ever pushed to phet-server-dev and tested sufficiently.

  • the issue with configurePreferences.js was to allow different credentials for local development. For the app to work with pg those variables will need to be set for production and phet-server-dev to the appropriate values.
  • The pg-query statements appear to be errors. If I remember correctly, for the cases where a simple SQL query string is used, you should be able to just drop pg in the place of pg-query
    I'm not doing any additional work on this (and am not on payroll any longer), so I'm unsure what fixes I ought to make. Happy to make some changes over the next few days if necessary, though.

@mbarlow12 mbarlow12 assigned jbphet and unassigned mbarlow12 May 20, 2019
@jbphet
Copy link
Contributor Author

jbphet commented May 21, 2019

Thanks @mbarlow12 - I'll take it from here.

@jbphet
Copy link
Contributor Author

jbphet commented Dec 4, 2019

This took some time, but I believe I have it working now. I've asked @oliver-phet to keep an eye out for any reports of issues from translators, and will close this for now. If I hear of problems, I'll reopen.

@jbphet jbphet closed this as completed Dec 4, 2019
@jbphet jbphet mentioned this issue Dec 5, 2019
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

5 participants