[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[],[],null,["# Reduce Deployment Risk with Blue-Green Deployments\n\nThis page shows you how to deploy a new version of your App and migrate\ntraffic over from an old to a new version.\n\nPushing the initial App\n-----------------------\n\nUse the Kf CLI to push the initial version of your App with any Routes: \n\n $ kf push app-v1 --route my-app.my-space.example.com\n\nPushing the updated App\n-----------------------\n\nUse the Kf CLI to push a new version of your App without any Routes: \n\n $ kf push app-v2 --no-route\n\nAdding Routes to the updated App\n--------------------------------\n\nUse the Kf CLI to bind all existing Routes to the updated App with a weight of 0\nto ensure they don't get any requests. \n\n $ kf map-route app-v2 my-space.example.com --hostname my-app --weight 0\n\nShifting traffic\n----------------\n\nStart shifting traffic from the old App to the updated App by updating the\nweights on the Routes. \n\n $ kf map-route app-v1 my-space.example.com --hostname my-app --weight 80\n $ kf map-route app-v2 my-space.example.com --hostname my-app --weight 20\n\nIf the deployment is going well, you can shift more traffic by updating the weights\nagain: \n\n $ kf map-route app-v1 my-space.example.com --hostname my-app --weight 50\n $ kf map-route app-v2 my-space.example.com --hostname my-app --weight 50\n\n| **Note:** Weights split traffic proportionally to the sum of the weights of all Apps mapped to the Route. It's common practice to treat weights as percentages.\n\nCompleting traffic shifting\n---------------------------\n\nOnce you're satisfied that the new service hasn't introduced regressions,\ncomplete the rollout by shifting all traffic to the new instance: \n\n $ kf map-route app-v1 my-space.example.com --hostname my-app --weight 0\n $ kf map-route app-v2 my-space.example.com --hostname my-app --weight 100\n\nTurning down the original App\n-----------------------------\n\nOnce you're satisfied that quick rollbacks aren't needed, remove the original\nroute and stop the App: \n\n $ kf unmap-route app-v1 myspace.example.com --hostname my-app\n $ kf stop app-v1\n\nOr delete the App and all associated Route mappings: \n\n $ kf delete app-v1"]]