Recently, I successfully moved my web application from AWS to Google Cloud Platform (GCP). The move was very smooth because I used Docker. This post is a record of how I run my Django app and IoT system using Docker Compose.
My compose.yml file manages everything. It has several important containers:
Keeping data safe during the migration was very important. Here is what I did to restore my data on GCP:
I moved my Django data from SQLite to PostgreSQL.
I used backup files from AWS to restore my InfluxDB database and Grafana dashboards. I had to fix some file permissions to make Grafana work correctly.
I use Certbot (Let's Encrypt) to get a free SSL certificate. To keep the website safe, I set up a "cron" job in my new GCP Ubuntu server. This cron job checks and updates the SSL certificate automatically every day.
To keep the server running smoothly, I used a few helpful tricks:
Checking logs: If a container stops, I use docker compose logs to find the error.
Memory: I created a "swapfile" in Ubuntu because my server needed more memory to run all the containers at the same time.
Moving from AWS to GCP was a great success. Because my whole system was containerized with Docker, I did not have to worry about OS differences. I could start my web app on GCP very quickly and easily.
Hello, my name is Koki. I am currently learning the web framework Django and English. In my free time, I enjoy hiking, cycling, and visiting shrines and temples. At work, I make software for programmable logic controllers (PLCs), I work especially with OMRON and Mitsubishi PLCs. Please feel free to contact me for any inquiries, job requests, or just to chat. We look forward to hearing from you via email!