Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Dockerを利用したローカル環境から本番環境までの構築設計

2,204 views

Published on

Dockerを利用したローカル環境から本番環境までの構築設計について紹介しています

Published in: Engineering
  • Be the first to comment

Dockerを利用したローカル環境から本番環境までの構築設計

  1. 1. Docker Koichi Nagaoka
  2. 2. (@kkoudev) 12 iOS/ Android
  3. 3. Docker
  4. 4. Docker Docker OS macOS Linux Docker
  5. 5. Docker
  6. 6. Docker Docker 
 Docker 

  7. 7. 1.
  8. 8. Web 1. ( ) 2. ( ) 3. ( ) 4. ( )
  9. 9. 1. 2. 1 1 3. (ALB RDS ElastiCache)
  10. 10. Docker
  11. 11. 2. Docker
  12. 12. / ■ 
 AWS Application Load Balancer (ALB) 
 
 ■ 
 AWS ElastiCache (Redis) 
 
 ■ 
 AWS RDS (MySQL) 
 
 ■web01/02 (EC2 )
 Nginx (HTTP )
 Web (Django Python3 )
 
 ■batch01/02 (EC2 )
 Python3 
 (Celery beat)
 RabbitMQ (Celery )
  13. 13. 2-1.
  14. 14. Web OS
  15. 15. Docker 1. ALB HAProxy 
 2. HAProxy Redis MySQL Nginx RabbitMQ Python3 Homebrew 
 3. 
 4. Web venv 
 5. Web pip
  16. 16. Docker 1. Homebrew 
 2. OS 
 3. 1 2
  17. 17. 
 1 ( )
  18. 18. Docker 1. ALB HAProxy 
 2. HAProxy Redis MySQL Nginx RabbitMQ Python ( ) docker-compose (docker- compose.yml) 
 3. 
 4. VOLUME 
 5. Web Docker Python pip 
 6. docker-compose docker-compose.yml
  19. 19. Docker 1. Homebrew OK Docker docker-compose 
 2. OS Docker OS 
 3. 1 2 
 4. docker-compose.yml docker-compose up -d
  20. 20. Docker Docker
  21. 21. 2-2.
  22. 22. Docker / 1. ALB ElastiCache (Redis) RDS (MySQL) 
 2. Nginx RabbitMQ Python Ansible 
 3. / 
 4. Web (Capistrano Ansistrano )
 5. Web venv 
 6. Web pip
  23. 23. Docker / 1. Ansible ( )
  24. 24. Docker / 1. ALB ElastiCache (Redis) RDS (MySQL) 
 2. Nginx RabbitMQ Python ( ) docker- compose (docker-compose.yml) 
 3. 
 4. docker-compose docker-compose.yml
  25. 25. Docker / 1. docker-compose OK
 2. venv 
 3. 2 (DB )
 4. docker-compose.yml docker-compose up -d
  26. 26. Docker docker-compose
  27. 27. 3.
  28. 28. Docker
  29. 29. 3-1.
  30. 30. docker- compose.yml Web Docker
  31. 31. Docker docker login Web gitignore docker-compose
  32. 32. sources clone
  33. 33. 3-2.
  34. 34. Python pip requirements.txt
  35. 35. 1
  36. 36. 1. Python Docker 2. 1 VOLUME 
 (pip --user PYTHONUSERBASE ) 3. 2 PYTHONUSERBASE bin PATH
  37. 37. docker-compose ( )
  38. 38. docker-compose ( ) PYTHONUSERBASE PATH env_file
  39. 39. ( ) # 
 docker-compose run --rm web pip install --user -r requirements.txt # 
 docker-compose -f docker-compose.local.yml up -d
  40. 40. 1. Python Docker 2. Docker 3. 2 bin PATH
  41. 41. docker-compose ( / )
  42. 42. docker-compose ( / )
  43. 43. Dockerfile
  44. 44. Dockerfile Python ( ) ADD /var/opt/example pip ( .local ) ADD ADD
  45. 45. ( ) # ( )
 docker-compose -f docker-compose.development.yml pull docker-compose -f docker-compose.development.yml run --rm web python manage.py collectstatic -- noinput
 docker-compose -f docker-compose.development.yml up -d # ( Web)
 docker-compose -f docker-compose.production_web.yml pull
 docker-compose -f docker-compose.production_web.yml run --rm web python manage.py collectstatic -- noinput docker-compose -f docker-compose.production_web.yml up -d
 # ( Batch)
 docker-compose -f docker-compose.production_batch.yml pull docker-compose -f docker-compose.production_batch.yml up -d
  46. 46. Jenkins CircleCI CI docker build docker push Docker pull
  47. 47. Docker docker-compose.yml 
 1 Docker
  48. 48. -01. Docker
  49. 49. Docker
  50. 50. -01. Docker
  51. 51. Docker A Docker 30 
 Docker 2GB 
 2GB
  52. 52. Docker A Vagrant Docker 
 1 
 Docker 30
  53. 53. Docker A 1. Docker 
 2. FROM Dockerfile 

  54. 54. -02.
  55. 55. Docker A Docker RDS S3 
 DB AWS IAM ( )
  56. 56. Docker A 1. Docker DB Docker 
 2. gettext envsubst 3. direnv
  57. 57. Docker
  58. 58. Thanks!

×