Indico on GCP setup

Has anyone attempted to put Indico on GCP before?

I installed Indico on a Ubuntu compute engine vm and the Postgres database is in Cloud SQL. Both the vm and database are using private ip and the vm can communicate with the database so there should not be a firewall issue. Using psql from the vm, I can query the database.

root@hostname:/opt/indico/etc# psql -h db_private_ip -U indico
Password for user indico: 
psql (15.6 (Ubuntu 15.6-1.pgdg22.04+1), server 15.5)
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, compression: off)
Type "help" for help.

indico=> select * from alembic_version;
 version_num  
--------------
 aba7935f9226
(1 row) 

In the indico.conf file, I have tried different variations for the sqlalchemy line:

SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2:///indico:password@db_private_ip/indico'
SQLALCHEMY_DATABASE_URI = 'postgresql:///indico:password@db_private_ip/indico'
SQLALCHEMY_DATABASE_URI = 'postgresql+pg8000:///indico:password@db_private_ip/indico'

(I have also tried using 2 slashes instead of 3 slashes)

For the apache virtual host section, I have tried these for ProxyPass:

ProxyPass / unix:/opt/indico/web/uwsgi.sock|uwsgi://localhost/
ProxyPass / unix:/opt/indico/web/uwsgi.sock|uwsgi://db_private_ip
ProxyPass / unix:/opt/indico/web/uwsgi.sock|uwsgi://db_private_ip/5432

ProxyPass / https://localhost:8000/
ProxyPassReverse / https://localhost:8000/

ProxyPass / unix:/opt/indico/web/uwsgi.sock|uwsgi://localhost/ 
ProxyPassReverse / unix:/opt/indico/web/uwsgi.sock|uwsgi://localhost/ 

One of the messages in syslog is:

(psycopg2.OperationalError) connection to server on socket “/var/run/postgresql/.s.PGSQL.5432” failed: No such file or directory\n\tIs the server running locally and accepting connections on that socket?

Anyone know what should be used for the “SQLALCHEMY_DATABASE_URI” and “ProxyPass” lines? Is it a bad idea to put the database on a different machine for Indico?

Thank you.

Hi!

SQLALCHEMY_DATABASE_URI = ‘postgresql:///indico:password@db_private_ip/indico’

You have an extra slash there after postgresql: and you might need to specify the port here as well

Edit: also, you should not put your db in the proxy pass config

And maybe also check if you need more params for ssl mode, as psql is using ssl in output.
See [1].

[1] PostgreSQL: Documentation: 16: 34.1. Database Connection Control Functions

Hello,

I have also tried using 2 slashes instead of 3 slashes after postgresql: as well as including the port number like @db_private_ip:5432/indico.

Do you have any suggestions as to what the ProxyPass line should look like for connecting to an external database?

Thanks.

I’ll take a look at that documentation. Thanks for that suggestion.

SQLALCHEMY_DATABASE_URI = 'postgresql://username:password@hostname:5432/dbname' should work, copied this literally from a real config file and just replaced the data.

And stop putting this in ProxyPass, it has nothing to do with the database. That statement tells Apache how to connect to uWSGI which always runs on the same host. Revert it to whatever you had originally.

I put “ProxyPass” back to its original configuration. And thank you for confirming the syntax for the “SQLALCHEMY_DATABASE_URI” line.

I reimported the database and it’s working now. I think what happened was the ‘indico db upgrade’ did not succeed the first time. I just saw the first 2 lines and that was it:
Context implies PostgresqlImpl.
Will assume transactional DDL.

After reimporting, I ran ‘indico db upgrade’ again and saw a bunch of ‘Running upgrade’ lines.

Thanks everyone.

1 Like