<@ULVA73B9P> I am running a self-hosted Prefect 2....
# ask-marvin
t
@Marvin I am running a self-hosted Prefect 2.x server in an AWS EKS Kubernetes cluster. It connects to a managed AWS RDS PostgreSQL database. I want to upgrade to Prefect 3.x and the instructions say to run “prefect server database upgrade”. How can I accomplish this on my setup?
m
To upgrade your self-hosted Prefect server in an AWS EKS Kubernetes cluster from 2.x to 3.x, and handle the database migration, you can follow these general steps. Prefect uses Alembic to manage database migrations, which makes the process relatively smooth. 1. Ensure Compatibility: Before starting the upgrade, ensure that your environment and configurations are compatible with Prefect 3.x. You might want to validate your PostgreSQL database configuration and ensure all environment variables are properly set. 2. Backup: Always take a backup of your existing database before performing any migrations or upgrades. This step is crucial in case you need to roll back. 3. Upgrade Prefect: Install the Prefect 3.x version on your system. This might involve updating your Docker images or Helm charts if you're using Kubernetes. 4. Run Database Upgrade: Once the new version of Prefect is installed, you can run database migrations using the command:
Copy code
prefect server database upgrade
This command applies new schema changes to your database, making it compatible with Prefect 3.x. This uses Alembic under the hood to manage your migrations. 5. Confirm Migration: Check if the migration has been applied correctly by inspecting your database or logs. 6. Restart Services: After the database migration, restart your Prefect services to ensure all components are aligned with the new version. For more detailed information, you can refer to these resources: - Prefect 3.x Database Migration: here - General self-hosting guidelines for Prefect 2.x: here If you encounter any issues, be sure to check Prefect's GitHub issues page or Prefect's community forums for solutions and feedback from other users who have performed similar upgrades. Don't worry, upgrading isn't usually as scary as it sounds, but always keep that backup just in case something unexpected occurs. It’s always good to have an escape plan!