DEV Community

Dinesh S
Dinesh S

Posted on • Updated on

7 tips to help you deploy code with confidence

Writing code is great, but how do you deploy your code with confidence?

Here are 7 tips that will help you with it.

1. Code reviews

Get your code reviewed by your peers. Common patterns and bugs can be spotted in these reviews by senior devs.

2. Deploy small features/chunks of code

Deploying a small feature set reduces the number of errors that might come up. This also restricts issues to the feature being deployed, which makes it easy to debug and test.

3. Keep an eye out for database migration changes

You need to be careful when deploying database migrations. Identify if they are destructive or not and employ migration deployment strategies accordingly. Deployment with a migration change makes it challenging to do rollbacks.

4. Write unit tests & integrate them with CI system

Having unit tests validates the requirement and makes sure any new code changes don't break existing functionality. Make sure your CI system runs these on all PR's to validate that the new changes don't break the existing code.

5. Testing in test/gamma environment

You can have automated integration tests to verify if the code works when integrated with other services. Also manually testing in Gamma/Staging env is always better as these environments mimic production.

6. Have a rollback strategy ready

Before you deploy your code, have a rollback plan ready. Let's say there is a bug after deployment, how do you roll back to the previous version? There won't be time to think when production is broken. This will save you from panic & distress.

7. Have a good error-monitoring system in place.

Don't wait for users to notify you of any issues in your application. Have an error-monitoring system which allows you to respond to issues promptly & proactively.

Top comments (0)