I have an old website that runs on a single LEMP Ubuntu server where a bunch of services are installed: NGINX, MySQL, PHP, Redis, Certbot, Postfix, WP-CLI, AWS-CLI, Fail2Ban, cron jobs and some custom scripts.
Now since I don't want to upgrade Ubuntu on a live server, when the Ubuntu version would approach the end of life I always migrate the website on a fresh VM with new LTS Ubuntu, where I would beforehand manually make sure that every service is installed and configured.
I have a document that outlines what needs to be installed, configured and how, but I find this manual approach to be really tedious, time consuming and error prone. The server now runs on Ubuntu 18.04 and although I have ESM enabled on that server which grants me updates till 2028 I guess the time has come to move the website to Ubuntu 22.04. For example VS Code stopped supporting Ubuntu 18.04 for remote access.
What I want to do is write a Python script that automatically installs and configures every service on a fresh server OR use Docker to basically do the same where every service is meticulously defined in a giant docker compose file, where services are sharing volumes, and they are using custom config files.
What would you do? What is a more sound approach? Or should I just continue manually installing everything, the migration rarely happens anyways.