Run the following command to create a managed Postgres database:
simplifyd create datastore
Specify the following attributes:
- Name for the database
- Project database should be setup under
- Type. In this case that should be
postgressince we are creating a Postgres database
- Runner. This should be any of the valid Simplifyd runner types [nano, micro, milli, kilo, mega, giga, tera]
- Disk size.
Once this is done, Simplifyd begins to create the database. Once ready, the folloeing environment variables are injected into the project which is made available to all apps within the project:
POSTGRESDB_<DB_NAME>_URL. This environment variable holds the connection URL to the database.
POSTGRESDB_<DB_NAME>_USER. This environment variable holds the DB user.
POSTGRESDB_<DB_NAME>_PASSWORD. This environment variable holds the DB password for the user.
POSTGRESDB_<DB_NAME>_PORT. This environment variable holds the DB Port.
DB_NAME refers to the name given to the Postgres database during setup.
Together these environment variables are used to create the connection string needed to connect to the database.
It's important to note that previously running apps would need to be stopped or updated so that they get configured with the new environment variables.
It's also important to note that at the moment external connections over the internet cannot be made to the databases. Connections can only be made from the apps within the same project.