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