#Give me an exact workflow to push from dev to prod deployment

13 messages · Page 1 of 1 (latest)

oak plover
#

Give me an exact workflow to push from dev to prod deployment

bitter craneBOT
#

Hi @oak plover. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Here's an exact workflow to push from a development deployment to a production deployment in Convex:

  1. Develop and test your changes locally using your individual dev deployment. Run npx convex dev to start your local development environment Typical team development workflow (https://docs.convex.dev/production#typical-team-development-workflow).

  2. When your changes are ready, commit them to your Git repository and create a pull request or commit to a shared branch Typical team development workflow (https://docs.convex.dev/production#typical-team-development-workflow).

  3. If you're using a hosting provider like Vercel or Netlify, set up automatic deployments to trigger when changes are merged to your main branch Hosting and Deployment (https://docs.convex.dev/production/hosting).

  4. If you're deploying manually, follow these steps:
    a. Checkout the branch you want to deploy (usually main)
    b. Run the following command:

    npx convex deploy --cmd 'npm run build'
    

    This command will deploy your backend code to your production deployment and build your frontend Custom Hosting (https://docs.convex.dev/production/hosting/custom#build-and-deploy-to-convex-and-github-pages).

  5. Confirm that you want to push your current backend code to your production deployment when prompted Custom Hosting (https://docs.convex.dev/production/hosting/custom#build-and-deploy-to-convex-and-github-pages).

  6. If you're using a hosting provider, the frontend will be automatically deployed. If you're using custom hosting, you'll need to deploy the built frontend code to your hosting provider Custom Hosting (https://docs.convex.dev/production/hosting/custom#how-it-works).

#

By following this workflow, you ensure that your production deployment has your newest functions and your app is configured to connect to it Using Convex with Vercel (https://docs.convex.dev/production/hosting/vercel#how-it-works).

Remember, you should only deploy to your production deployment after thoroughly testing your changes on your local development deployment Project Configuration (https://docs.convex.dev/production/project-configuration).

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@oak plover Kapa.ai is still learning and improving, please let me know how I did by reacting below.

oak plover
#

@bitter crane And how do I work with preview deployments

bitter craneBOT
#

Let me check the knowledge base for you again. One moment! :books:

#

Certainly! I'd be happy to explain how to work with preview deployments in Convex. Preview deployments are a great way to test both frontend and backend changes before pushing them to production. Here's how you can work with them:

  1. First, ensure you have a Convex Pro plan, as preview deployments are a Pro feature Preview Deployments (https://docs.convex.dev/production/hosting/preview-deployments).

  2. Set up the CONVEX_DEPLOY_KEY environment variable:

  3. (Optional) Set up default environment variables for your preview deployments in your Convex project Using Convex with Vercel (https://docs.convex.dev/production/hosting/vercel#preview-deployments).

  4. (Optional) If you need to set up initial data for your preview deployments, you can create a function to do this and add it to your deploy command:

    npx convex deploy --cmd 'npm run build' --preview-run 'functionName'
    

    Replace 'functionName' with the name of your setup function Using Convex with Netlify (https://docs.convex.dev/production/hosting/netlify#deploy-previews).

  5. When you push changes to a feature branch or create a pull request, your hosting provider (like Vercel or Netlify) will create a preview deployment. Convex will automatically create a corresponding backend preview deployment Using Convex with Vercel (https://docs.convex.dev/production/hosting/vercel#how-it-works-1).

#
  1. You can now test your changes using the preview URL provided by your hosting provider. This preview will use a fresh Convex backend deployment, separate from your production and development deployments Using Convex with Netlify (https://docs.convex.dev/production/hosting/netlify#how-it-works-1).

  2. Preview deployments are automatically cleaned up after 14 days, or when a new preview deployment with the same name is created. You can also manually delete them from the Convex dashboard Preview Deployments Limits (https://docs.convex.dev/production/hosting/preview-deployments#limits).

Remember that preview deployments are currently a beta feature. If you encounter any issues or have feedback, you can reach out to the Convex team on their Discord community Preview Deployments Limits (https://docs.convex.dev/production/hosting/preview-deployments#limits).

By using preview deployments, you can effectively test your changes in an isolated environment before merging them into your main branch and deploying to production.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@oak plover Kapa.ai is still learning and improving, please let me know how I did by reacting below.

oak plover
#

@bitter crane So preview deployments is a Vercal only feature?

bitter craneBOT
#

Let me check the knowledge base for you again. One moment! :books:

#

No, preview deployments are not a Vercel-only feature in Convex. Let me clarify this for you:

  1. Convex preview deployments are a feature available on the Convex Pro plan, and they can be used with various hosting providers, not just Vercel Preview Deployments (https://docs.convex.dev/production/hosting/preview-deployments).

  2. Convex supports preview deployments with both Vercel and Netlify:

  3. The Convex CLI (npx convex deploy) is designed to work with various environments. It can infer the Git branch name for Vercel, Netlify, GitHub, and GitLab environments CLI Deploy (https://docs.convex.dev/cli#deploy-convex-functions-to-a-preview-deployment).

  4. You can even use preview deployments with custom hosting solutions by specifying the preview deployment name manually using the --preview-create option CLI Deploy (https://docs.convex.dev/cli#deploy-convex-functions-to-a-preview-deployment).

So, while Vercel is one of the supported platforms for preview deployments, it's not the only one. Convex has designed this feature to be flexible and work with multiple hosting providers and environments.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: