Card image cap

How I Migrated My Django App from AWS to GCP with Docker

1. Introduction

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.

2. My System Parts

My compose.yml file manages everything. It has several important containers:

  • Nginx: For the web server and safe HTTPS connections.
  • Django & PostgreSQL: The main application and its database.
  • Mosquitto (MQTT): For receiving data from IoT devices.
  • InfluxDB & Grafana: For saving device data and showing it on beautiful graphs.

3. Moving and Restoring Data

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.

4. Security and Auto-Updates

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.

5. Fixing Problems

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.

Conclusion

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.

Category : diary, Posted : May 6, 2026, 10:18 p.m.,
Update : May 6, 2026, 10:23 p.m., By : koki,

Profile

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!

Category

10 Latest articles