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

verdi quicksetup fails silently if pgpass is not available #2588

Closed
odarbelaeze opened this issue Mar 11, 2019 · 1 comment · Fixed by #3892
Closed

verdi quicksetup fails silently if pgpass is not available #2588

odarbelaeze opened this issue Mar 11, 2019 · 1 comment · Fixed by #3892

Comments

@odarbelaeze
Copy link
Contributor

odarbelaeze commented Mar 11, 2019

There seems to be a corner-case in quicksetup when running postgres in localhost through docker and port forwarding.

Here's how I'm running postgresql:

version: '3.1'
services:
  db:
    image: postgres
    restart: always
    environment:
      POSTGRES_PASSWORD: example
    ports:
      - "5432:5432"

The problem is that when I start quicksetup with the correct credentials, I get prompted about the credentials again and again without a clear message about what's going wrong.

Here's a session to showcase the issue:

(aiida3.7) 
~/Code/aiida_core  provenance_redesign ✔                                                                                                                  20d  
▶ cat ~/.pgpass 
cat: /home/arbelaez/.pgpass: No such file or directory
(aiida3.7) 
~/Code/aiida_core  provenance_redesign ✔                                                                                                                 20d  ⍉
▶ verdi quicksetup --first-name Oscar --last-name Arbelaez --institution EPFL --email [email protected]
[sudo] password for arbelaez: 
Warning: Detected no known postgres setup, some information is needed to create the aiida database and grant 
aiida access to it. If you feel unsure about the following parameters, first check if postgresql is 
installed. If postgresql is not installed please exit and install it, then run verdi quicksetup again.
If postgresql is installed, please ask your system manager to provide you with the following parameters:
postgres host [localhost]: 
postgres port [5432]: 
template [template1]: 
postgres super user [postgres]: 

trying to access postgres..
postgres password of postgres []: 
postgres host [localhost]: 
postgres port [5432]: 
template [template1]: 
postgres super user [postgres]: 

trying to access postgres..
postgres password of postgres []: 
postgres host [localhost]: Aborted!
(aiida3.7) 
~/Code/aiida_core  provenance_redesign ✔                                                                                                                 20d  ⍉
▶ # create a .pgpass 
(aiida3.7) 
~/Code/aiida_core  provenance_redesign ✔                                                                                                                 20d  ⍉
▶ cat ~/.pgpass
localhost:5432:*:postgres:example
(aiida3.7) 
~/Code/aiida_core  provenance_redesign ✔                                                                                                                  20d  
▶ verdi quicksetup --first-name Oscar --last-name Arbelaez --institution EPFL --email [email protected]
Warning: Detected no known postgres setup, some information is needed to create the aiida database and grant 
aiida access to it. If you feel unsure about the following parameters, first check if postgresql is 
installed. If postgresql is not installed please exit and install it, then run verdi quicksetup again.
If postgresql is installed, please ask your system manager to provide you with the following parameters:
postgres host [localhost]: 
postgres port [5432]: 
template [template1]: 
postgres super user [postgres]:     

trying to access postgres..
Executing now a migrate command...
...for Django backend
Operations to perform:
  Apply all migrations: auth, contenttypes, db, sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0001_initial... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying db.0001_initial... OK
  Applying db.0002_db_state_change... OK
  Applying db.0003_add_link_type... OK
  Applying db.0004_add_daemon_and_uuid_indices... OK
  Applying db.0005_add_cmtime_indices... OK
  Applying db.0006_delete_dbpath... OK
  Applying db.0007_update_linktypes... OK
  Applying db.0008_code_hidden_to_extra... OK
  Applying db.0009_base_data_plugin_type_string... OK
  Applying db.0010_process_type... OK
  Applying db.0011_delete_kombu_tables... OK
  Applying db.0012_drop_dblock... OK
  Applying db.0013_django_1_8... OK
  Applying db.0014_add_node_uuid_unique_constraint... OK
  Applying db.0015_invalidating_node_hash...Warning: Invalidating all the hashes of all the nodes. Please run verdi rehash
 OK
  Applying db.0016_code_sub_class_of_data... OK
  Applying db.0017_drop_dbcalcstate... OK
  Applying db.0018_django_1_11... OK
  Applying db.0019_migrate_builtin_calculations... OK
  Applying db.0020_provenance_redesign... OK
  Applying db.0021_dbgroup_name_to_label_type_to_type_string... OK
  Applying db.0022_dbgroup_type_string_change_content... OK
  Applying db.0023_calc_job_option_attribute_keys... OK
  Applying db.0024_dblog_update... OK
  Applying db.0025_move_data_within_node_module... OK
  Applying db.0026_trajectory_symbols_to_attribute... OK
  Applying db.0027_delete_trajectory_symbols_array... OK
  Applying db.0028_remove_node_prefix... OK
  Applying sessions.0001_initial... OK
Database was created successfully
Installing default AiiDA user...
Starting user configuration for [email protected]...
>> User Oscar Arbelaez ([email protected]) created. <<
** NOTE: no password set for this user, 
         so they will not be able to login
         via the REST API and the Web Interface.
Setup finished.
Success: Set up profile 'quicksetup'.
@ltalirz
Copy link
Member

ltalirz commented Apr 5, 2020

There was indeed an issue with the prompt loop. This should be addressed by #3892

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

Successfully merging a pull request may close this issue.

2 participants