Rewrite in 45 Days, third Week
The third week of our endeavour to rewrite an old legacy django rest app with fastapi. This is in continuation of last week. This week we had a huge success!
Jul 10, 2022
Day 13 Update: Today, same as last day, we worked on middleware and legacy code. We also refined the settings file structure supporting injection during build time. We are still gunning for the first working end point. We are not using .env files. We are using OmegaConf. This gives us so much more capabilities, it is hard to imaging anyone sticking to .env file. Go check it out. I would suggest fastapi move over using this awesome library!
Jul 11, 2022
Day 14 Update: Same as before. No visible advancement. This is by far the hardest part so it seems. We are trying to import the legacy code at a cutoff point which will not force us to rewrite the whole logic form scratch. There is 15 years of logic in this code which would take a lot of time to rewrite. A lot of the legacy code does the same as pydantic would do, and the idea is to move as much logic as possible to pydantic.
Jul 12, 2022
Day 15 Update: FINALLY! First endpoint is working!!! And the first middleware integrated!!! What a day. What a team ! Now we know the system is capable and working. We will add tests and start refactoring as well as adding more endpoints! It is very important to start refactoring the imported legacy code as soon as we have good enough tests. We need to start with a clean and beautiful system without all "holding back legacy code".
Starting tomorrow a QA representative will join our daily meetings and we will see how to integrate QA into our daily lives. I am aiming for continuous deployment, not delivery. I am sure we have the ability, but will management agree ? Let's hope so!
领英推荐
Jul 14, 2022
Day 16 Update: We are working on our second endpoint and additional middleware components. Some functionality is heavily coupled with the django framework and it quite hard to decouple from that. The team is on it. In the meantime we now have test code coverage in jenkins which will help us when we get to the refactoring stage.
We are looking at integrating K6 into the CI/CD process. Since we are generating OpenAPI spec, I used this article to create stubs from our OpenAPI spec and voila!!! Something to start with. After telling this to our QA representative, she created K6 scripts from the existing Postman test scripts and that too worked.
Now we will integrate K6 as sanity tests into Jenkins!
Jul 15, 2022
Day 17 Update: We added another middleware component and are still working on the second endpoint. There is one tough know to untie there. That is bound to happen when ripping a 15 year legacy app from it's framework and changing it.
At one point we thought that the application code might be inseparable from django serializer component, and that would have been disastrous as we would have to rewrite the whole business logic. For now we seem to be in the clear. Legacy code can be so treacherous.
Next week we will start incorporating more endpoints. Until then, yours truly !