Prerequisites
- Docker installed on your machine
- An active PostgreSQL database
- Postgres database connection string
Pull the Infisical Docker Image
First, ensure you have the correct version of the Infisical Docker image. You can pull it from Docker Hub using the following command:Replace
<version> with the specific version number you intend to deploy. View available versions hereSet Up the Environment Variable
The Docker image requires a
DB_CONNECTION_URI environment variable. This connection string should point to your PostgreSQL database. The format generally looks like this: postgresql://username:password@host:port/database.Run the Migration
To run the schema migration for the version of Infisical you want to deploy, use the following Docker command:Replace
<your_connection_string> with your actual PostgreSQL connection string, and <version> with the desired version number.Verify the Migration
After running the migration, it’s good practice to check if the migration was successful. You can do this by checking the logs or accessing your database to ensure the schema has been updated accordingly.
Additional discussion
- Always back up your database before running migrations, especially in a production environment.
- Test the migration process in a staging environment before applying it to production.
- Keep track of the versions and their corresponding migrations to avoid any inconsistencies.