Comment on page
Sometimes you want to use your own PostgreSQL database instead of the one provided by Supervisely. For example, you may want to use your own database for security reasons or because you already have a PostgreSQL database running in your infrastructure, or you require high availability and fault tolerance.
In this case, you will have to configure Supervisely to use your own database instead of the one provided by default.
Managed Postgres providers examples: Amazon RDS, Google Cloud SQL, Azure Database for PostgreSQL, etc.
To configure Supervisely to use your own database, you will have to edit the
.envfile which you can find in the workdir of your Supervisely installation. You can find the folder by running this command:
cd $(sudo supervisely where)
.envfile contains the following lines:
which is used in
You will have to change the values of the variables to match your database configuration. For example, if you are using Amazon RDS, you will have to change the values to something like this:
After that you will need to redeploy Supervisely services:
sudo supervisely up -d
In case you already have your valuable data in a local Supervisely database then you will need to transfer it to the new database. The migration is rather simple and can be done in a few steps:
- 1.Stop Supervisely services and export your local database using
sudo supervisely stop
sudo supervisely start postgres
sudo supervisely exec postgres pg_dump -U postgres -C clicker > supervisely_postgres_dump.sql
- 2.Restore the database dump to your own database:
PGPASSWORD=your_rds_password psql -h your_rds_endpoint -U your_rds_username -f /path/to/host/supervisely_postgres_dump.sql