# Indico on GCP setup

**URL:** <https://talk.getindico.io/t/indico-on-gcp-setup/3529>\
**Category:** General Discussion\
**Created:** [May 10, 2024, 5:04am UTC](https://talk.getindico.io/t/indico-on-gcp-setup/3529 "2024-05-10T05:04:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![fireball](https://talk.getindico.io/user_avatar/talk.getindico.io/fireball/32/1171_2.png) [@fireball](https://talk.getindico.io/u/fireball)\
**Post date:** [May 10, 2024, 5:04am UTC](https://talk.getindico.io/t/indico-on-gcp-setup/3529/1 "2024-05-10T05:04:08Z")

</div>

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.

```auto
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:

```auto
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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![troun](https://talk.getindico.io/user_avatar/talk.getindico.io/troun/32/1230_2.png) [@troun](https://talk.getindico.io/u/troun)\
**Post date:** [May 10, 2024, 7:45am UTC](https://talk.getindico.io/t/indico-on-gcp-setup/3529/2 "2024-05-10T07:45:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bpedersen2](https://talk.getindico.io/user_avatar/talk.getindico.io/bpedersen2/32/25_2.png) [@bpedersen2](https://talk.getindico.io/u/bpedersen2)\
**Post date:** [May 10, 2024, 1:44pm UTC](https://talk.getindico.io/t/indico-on-gcp-setup/3529/3 "2024-05-10T13:44:54Z")

</div>

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.&nbsp;Database Connection Control Functions](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING-URIS)

---

<div class="post-metadata">

**Author:** ![fireball](https://talk.getindico.io/user_avatar/talk.getindico.io/fireball/32/1171_2.png) [@fireball](https://talk.getindico.io/u/fireball)\
**Post date:** [May 10, 2024, 3:59pm UTC](https://talk.getindico.io/t/indico-on-gcp-setup/3529/4 "2024-05-10T15:59:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![fireball](https://talk.getindico.io/user_avatar/talk.getindico.io/fireball/32/1171_2.png) [@fireball](https://talk.getindico.io/u/fireball)\
**Post date:** [May 10, 2024, 4:00pm UTC](https://talk.getindico.io/t/indico-on-gcp-setup/3529/5 "2024-05-10T16:00:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ThiefMaster](https://talk.getindico.io/user_avatar/talk.getindico.io/thiefmaster/32/509_2.png) [@ThiefMaster](https://talk.getindico.io/u/ThiefMaster)\
**Post date:** [May 10, 2024, 4:07pm UTC](https://talk.getindico.io/t/indico-on-gcp-setup/3529/6 "2024-05-10T16:07:42Z")

</div>

`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.

---

<div class="post-metadata">

**Author:** ![fireball](https://talk.getindico.io/user_avatar/talk.getindico.io/fireball/32/1171_2.png) [@fireball](https://talk.getindico.io/u/fireball)\
**Post date:** [May 15, 2024, 10:27pm UTC](https://talk.getindico.io/t/indico-on-gcp-setup/3529/7 "2024-05-15T22:27:49Z")

</div>

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.
