title: From Local Docker Setup to Kubernetes Production
body: <p>I have a local Docker setup consisting of four containers: a flask web app, MySQL, Redis, and an RQ worker.</p>
  
  <p>The setup is essentially the same as Miguel Grinberg's Flask Mega-Tutorial. Here are links for his <a href="https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xxii-background-jobs" rel="nofollow noreferrer">tutorial</a> and his <a href="https://github.com/miguelgrinberg/microblog/tree/v0.22" rel="nofollow noreferrer">code</a>.</p>
  
  <p>The only difference in my case is that I've replaced his export blog post function, which runs on the rq-worker, with another that is incredibly computationally intensive and long running (30 minutes).</p>
  
  <p><strong>What is the best way for me to deploy this application for production?</strong> </p>
  
  <p>I only expect it to be accessed by a one or two people at a time and for them to visit only once or twice a week.</p>
  
  <p>I've been looking into Kubernetes examples but I'm having difficulty translating them to my setup and figuring out how to deploy to GCP. I'm open to other deployment options.</p>
  
  <p>Here are the docker run commands from the tutorial:</p>
  
  <p><code>docker run --name redis -d -p 6379:6379 redis:3-alpine</code></p>
  
  <pre><code>docker run --name mysql -d -e MYSQL_RANDOM_ROOT_PASSWORD=yes \
      -e MYSQL_DATABASE=flaskapp -e MYSQL_USER=flaskapp \
      -e MYSQL_PASSWORD=mysqlpassword \
      mysql/mysql-server:5.7
  </code></pre>
  
  <pre><code>docker run --name rq-worker -d --rm -e SECRET_KEY=my-secret-key \
      -e MAIL_SERVER=smtp.googlemail.com -e MAIL_PORT=587 -e MAIL_USE_TLS=true \
      -e MAIL_USERNAME=example@gmail.com -e MAIL_PASSWORD=mysqlpassword \
      --link mysql:dbserver --link redis:redis-server \
      -e DATABASE_URL=mysql+pymysql://flaskapp:mypassword@dbserver/flaskapp \
      -e REDIS_URL=redis://redis-server:6379/0 \
      --entrypoint venv/bin/rq \
      flaskapp:latest worker -u redis://redis-server:6379/0 dyson-tasks
  </code></pre>
  
  <pre><code>docker run --name flaskapp -d -p 8000:5000 --rm -e SECRET_KEY=my_secret_key \
      -e MAIL_SERVER=smtp.googlemail.com -e MAIL_PORT=587 -e MAIL_USE_TLS=true \
      -e MAIL_USERNAME=example@gmail.com -e MAIL_PASSWORD=mypassword \
      --link mysql:dbserver --link redis:redis-server  \
      -e DATABASE_URL=mysql+pymysql://flaskapp:mysqlpassword@dbserver/flaskapp \
      -e REDIS_URL=redis://redis-server:6379/0 \
      flaskapp:latest 
  </code></pre>