Iterapp supports Postgresql 14 out of the box. Opt in by adding an empty section tag in your iterapp.toml.
And Iterapp will create a fresh new database for your app and add a schema for your app on Iterapps Postgres cluster.
Any values beneath a section-tag will relate to the section. So move properties that do not relate to any tag to the top of the file.
applings = ["app1", "app2"]
will not work as applings property is semantically under postgres-section, which
is incorrect. The easiest solution is to move
[postgres] to the end of the
The following environment variables are available when you would want to connect to the schema:
When your application receives
SIGTERM, database connections are given 10 seconds to deregister before being dropped.
So to connect to your database locally, you can use the
environment variable in your app. Just change
database to what corresponds to your local database setup:
DATABASE_URL = postgres://user:password@host:port/database
Your database is initially empty. Your app is responsible for both creating tables and adding data into them. There are several ways of doing this. One approach would be to add migration-sqls when the app starts.
You will have one database per environment, which means that production and in test have their own database.
You can enable postgresql extensions in your app by adding something like this to iterapp.toml
Note that when removing extensions from the list, they will not yet be removed from postgres if they are already deployed. This will probably be fixed at some later time.
In addition to the above, you can also connect to your own database on google cloud. To get started:
First you need to create your cloud SQL database in google-cloud. Notice your
connection string (it looks something like
You need to give the service account
firstname.lastname@example.org access to connect to the
database. To do that, add it to IAM with the
Cloud SQL Client role.
Then add the following to
You will then be able to connect to your cloud sql instance on
You also need credentials to login to the database, the above will only create the network-level connection. You should encrypt the credentials and add them as environment variables (see secrets).
If you want to connect to both to the db from iterapp and your own cloud sql
instance, you can add both
iterapp postgres will always listen on port 5432, so if you try to use that as a
port number in
cloud_sql_postgres_instances, you will get an error.