{"id":11584,"date":"2023-03-23T11:35:42","date_gmt":"2023-03-23T02:35:42","guid":{"rendered":"https:\/\/www.stuffy.site\/computers\/?p=11584"},"modified":"2024-05-24T16:50:12","modified_gmt":"2024-05-24T07:50:12","slug":"https-portaldocker-redis-minio%e3%82%92%e3%83%aa%e3%83%90%e3%83%bc%e3%82%b9%e3%83%97%e3%83%ad%e3%82%ad%e3%82%b7%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/www.stuffy.site\/computers\/archives\/11584","title":{"rendered":"Node.js@Docker https-portal\u3067Redis,MinIO\u3092\u30ea\u30d0\u30fc\u30b9\u30d7\u30ed\u30ad\u30b7\u3059\u308b"},"content":{"rendered":"\n<p>\u524d\u56de\u3001AWS ElasticBeansTalk \u3067\u8a66\u4f5c\u3057\u305fNode.js\u958b\u767a\u74b0\u5883\u3092Docker\u3092\u4f7f\u3063\u3066\u30ed\u30fc\u30ab\u30eb\u306b\u30dd\u30fc\u30c6\u30a3\u30f3\u30b0\u3057\u307e\u3057\u305f\u304c\u4eca\u56de\u306f\u518d\u3073AWS EC2\u306b\u30ea\u30d5\u30c8\u30a2\u30f3\u30c9\u30b7\u30d5\u30c8\u3057\u3066\u307f\u307e\u3057\u305f\u3002Redis\u3068S3\u4e92\u63db\u30b9\u30c8\u30ec\u30fc\u30b8\u30b5\u30fc\u30d0\u30fcMinIO\u306e\u63a5\u7d9a\u304c\u62d2\u5426\u3055\u308c\u308b\u539f\u56e0\u304c\u306a\u3093\u3068\u306a\u304f\u5206\u304b\u3063\u305f\u306e\u3067\u30e1\u30e2\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<!--more-->\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"Eo4C9IckmV\"><a href=\"https:\/\/www.stuffy.site\/computers\/2023\/02\/24\/miniodocker-s3%e4%ba%92%e6%8f%9b%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%82%b5%e3%83%bc%e3%83%90%e3%83%bc%e3%82%92%e6%a7%8b%e7%af%89%e3%81%99%e3%82%8b\/\">MinIO@docker S3\u4e92\u63db\u30d5\u30a1\u30a4\u30eb\u30b5\u30fc\u30d0\u30fc\u3092\u69cb\u7bc9\u3059\u308b<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;MinIO@docker S3\u4e92\u63db\u30d5\u30a1\u30a4\u30eb\u30b5\u30fc\u30d0\u30fc\u3092\u69cb\u7bc9\u3059\u308b&#8221; &#8212; \u65b0\u30c7\u30b8\u30bf\u30eb\u751f\u6d3b\u3081\u3082\" src=\"https:\/\/www.stuffy.site\/computers\/2023\/02\/24\/miniodocker-s3%e4%ba%92%e6%8f%9b%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%82%b5%e3%83%bc%e3%83%90%e3%83%bc%e3%82%92%e6%a7%8b%e7%af%89%e3%81%99%e3%82%8b\/embed\/#?secret=kdULLqpxy3#?secret=Eo4C9IckmV\" data-secret=\"Eo4C9IckmV\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>Docker\u3092\u4f7f\u3048\u3070\u30ed\u30fc\u30ab\u30eb\u3082AWS\u3082\u307b\u3068\u3093\u3069\u30b7\u30fc\u30e0\u30ec\u30b9\u306b\u74b0\u5883\u306e\u79fb\u884c\u304c\u3067\u304d\u307e\u3057\u305f<\/p>\n\n\n<table>\n<tbody>\n<tr>\n<td>VPC<\/td>\n<td>172.31.0.0\/16<\/td>\n<\/tr>\n<tr>\n<td>VPC\u30b5\u30d6\u30cd\u30c3\u30c8<\/td>\n<td>172.31.0.0\/20<\/td>\n<\/tr>\n<tr>\n<td>\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9IP\uff08\u30ed\u30fc\u30ab\u30eb\uff09<\/td>\n<td>172.31.15.141<\/td>\n<\/tr>\n<tr>\n<td>Docker \u30d6\u30ea\u30c3\u30b8\u30cd\u30c3\u30c8\u30ef\u30fc\u30af<\/td>\n<td>172.18.0.0\/24<\/td>\n<\/tr>\n<tr>\n<td>Docker\u30d6\u30ea\u30c3\u30b8GW<\/td>\n<td>172.18.0.1<\/td>\n<\/tr>\n<tr>\n<td>dnsmasq<\/td>\n<td>172.18.0.2<\/td>\n<\/tr>\n<tr>\n<td>MySQL5.7<\/td>\n<td>172.18.0.3<\/td>\n<\/tr>\n<tr>\n<td>Redis<\/td>\n<td>172.18.0.4<\/td>\n<\/tr>\n<tr>\n<td>Node.js\u30a2\u30d7\u30ea<\/td>\n<td>172.18.0.5<\/td>\n<\/tr>\n<tr>\n<td>MinIO\u30af\u30e9\u30a4\u30a2\u30f3\u30c8(mc)<\/td>\n<td>172.18.0.6<\/td>\n<\/tr>\n<tr>\n<td>MinIO\uff08S3\uff09<\/td>\n<td>172.18.0.10<\/td>\n<\/tr>\n<tr>\n<td>https-portal<\/td>\n<td>172.18.0.100<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\n\n<p><s>\u3053\u308c\u306f\u95a2\u4fc2\u306a\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304cEC2\u306b\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u5165\u3063\u3066\u3044\u306a\u3044NetworkManager\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/s><\/p>\n\n\n\n<p>MySQL\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3068MinIO(S3)\u30d0\u30b1\u30c3\u30c8\u3092\u4f5c\u6210\u3057\u3066MC\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304b\u3089\u7ba1\u7406\u8005\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u4f5c\u6210\u3057\u3066Node.js \u30b5\u30f3\u30d7\u30eb\u3092 docker build\u3057\u307e\u3057\u305f\u304c\u30dd\u30fc\u30c83000\u3067LISTEN\u3057\u3066\u3044\u308b\u30a2\u30d7\u30ea\u3092\u30ea\u30d0\u30fc\u30b9\u30d7\u30ed\u30ad\u30b7\u3059\u308bhttps-portal \u3067\u8a8d\u8a3c\u30a8\u30e9\u30fc\u304c\u51fa\u308b\u3088\u3046\u3067\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u3053\u308c\u306f\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9IP\u306e\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3067\u3042\u308beth0\u3092Docker\u306e\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\uff08172.31.15.0\/24\uff09\u3068\u3057\u3066\u4f7f\u3063\u3066\u3044\u305f\u305f\u3081\u8d77\u3053\u308bDNS\u30a8\u30e9\u30fc\u3067\u3057\u305f\u3002<\/p>\n\n\n\n<p>ip -4 a | grep inet \u3067\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n\n\n<pre>$ ip -4 a | grep inet\n    inet 127.0.0.1\/8 scope host lo<br \/>    inet 172.31.15.141\/20 brd 172.31.15.255 scope global dynamic eth0<br \/>    inet 172.17.0.1\/16 brd 172.17.255.255 scope global docker0<br \/>    inet 172.18.0.1\/24 brd 172.18.0.255 scope global global br-206fc282aa57<\/pre>\n\n\n<p>\u3067\u3059\u306e\u3067\u4eca\u56de\u306f\u30d6\u30ea\u30c3\u30b8\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\u306e\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\uff08172.18.0.0\/24\uff09\u3092\u4f7f\u3046\u3068DNS\u304c\u3044\u3044\u611f\u3058\u306b\u89e3\u6c7a\u3057\u3066\u304f\u308c\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u4e00\u65b9\u3067\u78ba\u304b\u306bhttps-portal \u30673000\u3067LISTEN\u3057\u3066\u3044\u308b\u30a2\u30d7\u30ea\u304c\u30d6\u30e9\u30a6\u30b6\u4e0a\u304b\u3089\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u3059\u304cRedis, S3\u30b3\u30f3\u30c6\u30ca\u3078\u306e\u63a5\u7d9a\u304c\u3067\u304d\u305a\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u305f\u753b\u50cf\u304c\u8868\u793a\u3055\u308c\u306a\u3044\u3088\u3046\u3067\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u305d\u306e\u70b9\u3092\u8e0f\u307e\u3048\u3064\u3064Redis, S3\u30b3\u30f3\u30c6\u30ca\u3082 https-portal \u306eDOMAIN\u8a2d\u5b9a\u3067\u8907\u6570\u30b5\u30fc\u30d3\u30b9\u3092\u30ea\u30d0\u30fc\u30b9\u30d7\u30ed\u30ad\u30b7\u3059\u308b\u3068\u826f\u3044\u3088\u3046\u3067\u3057\u305f\u3002docker-compose.yml \u306f\u6700\u7d42\u7684\u306b\u306f\u4ee5\u4e0b\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n<pre><span style=\"font-size: 14pt; color: #0000ff;\">vi docker-compose.yml<br><\/span>\nversion: '3'\nservices:\n  mysql:\n    image: mysql:5.7\n    container_name: mysql\n    ports:\n      - \"3306:3306\"\n    environment:\n      - MYSQL_USER=sampleUser\n      - MYSQL_PASSWORD=samplePass\n      - MYSQL_DATABASE=sampleDb\n      - MYSQL_ROOT_PASSWORD=rootpass\n    networks:\n      td000net1:\n        ipv4_address: 172.18.0.3\n    restart: always\n    volumes:\n      - db-data:\/var\/lib\/mysql\n\n  redis:\n    image: redis:latest\n    container_name: redis\n    ports:\n      - \"6379:6379\"\n    networks:\n      td000net1:\n        ipv4_address: 172.18.0.4\n\n  s3:\n    image: minio\/minio:latest\n    container_name: s3\n    ports:\n      - \"9000:9000\"\n      - \"9001:9001\"\n    networks:\n      td000net1:\n        ipv4_address: 172.18.0.10\n    restart: always\n    volumes:\n      - \"s3-data:\/data\"\n      - \"s3-config-data:\/root\/.minio\"\n    command: \"server \/data --console-address :9001\"\n    env_file:\n      - .env\n    environment:\n      - MINIO_ROOT_USER=${MINIO_ROOT_USER}\n      - MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}\n      - MINIO_SERVER_URL=http:\/\/172.18.0.10:9000\n\n  application:\n    image: sample_todos:1.0\n    hostname: appapi.live\n    container_name: application\n    extra_hosts:\n      - \"appapi.live:54.249.5.106\"\n    ports:\n      - \"3000:3000\"\n    networks:\n      td000net1:\n        ipv4_address: 172.18.0.5\n    restart: always\n    init: true\n    env_file:\n      - .env\n    environment:\n      - MYSQL_HOST=mysql\n      - MYSQL_PORT=3306\n      - MYSQL_USER=sampleUser\n      - MYSQL_PASS=samplePass\n      - MYSQL_DB=sampleDb\n      - AWS_ACCESS_KEY=${AWS_ACCESS_KEY}\n      - AWS_SECRET_KEY=${AWS_SECRET_KEY}\n      - MINIO_ROOT_USER=${MINIO_ROOT_USER}\n      - MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}\n      - AWS_REGION=ap-northeast-1\n      - AWS_DEFAULT_OUTPUT=json\n      - AWS_ENDPOINT=http:\/\/172.18.0.10\n      - AWS_PORT=9000\n      - AWS_S3_BUCKET=docker-local-sample-bucket\n      - IMAGE_ENDPOINT=http:\/\/appapi.live:9000\n      - REDIS_HOST=172.18.0.4\n      - REDIS_PORT=6379\n    volumes:\n      - \".:\/app\"\n      - \"\/app\/node_modules\"\n    depends_on:\n      - mysql\n      - redis\n      - s3\n  mc:\n    image: minio\/mc:latest\n    container_name: mc\n    depends_on:\n      - s3\n    entrypoint: \/bin\/sh\n    networks:\n      td000net1:\n        ipv4_address: 172.18.0.6\n    stdin_open: true\n    tty: true\n\n  dnsmasq:\n    restart: always\n    image: 4km3\/dnsmasq\n    container_name: dnsmasq\n    environment:\n      TZ: \"Asia\/Tokyo\"\n    ports:\n      - \"53:53\/udp\"\n      - \"53:53\/tcp\"\n    volumes:\n      - '.\/PV\/etc\/dnsmasq.d:\/etc\/dnsmasq.d'\n    networks:\n      td000net1:\n        ipv4_address: 172.18.0.2\n    dns:\n      - 8.8.8.8\n      - 127.0.0.1\n    cap_add:\n      - NET_ADMIN\n\n  https-portal:\n    image: steveltn\/https-portal:1\n    container_name: https-portal\n    extra_hosts:\n      - 'appapi.live:127.0.0.1'\n    ports:\n      - '80:80'\n      - '443:443'\n    links:\n      - application\n      - s3\n      - redis\n    networks:\n     td000net1:\n       ipv4_address: 172.18.0.100\n    restart: always\n    volumes:\n      - .\/certs:\/var\/lib\/https-portal\n      - \/var\/run\/docker.sock:\/var\/run\/docker.sock:ro\n    environment:\n      <span style=\"color: #0000ff;\">DOMAINS: 'appapi.live -&gt; http:\/\/application:3000, appapi.live -&gt; http:\/\/s3:9000, appapi.live -&gt; http:\/\/redis:6379'<\/span>\n      CLIENT_MAX_BODY_SIZE: 100M\n      STAGE: 'production'\n     # FORCE_RENEW: 'true'\n\nvolumes:\n  db-data:\n  s3-data:\n  s3-config-data:\n\nnetworks:\n  td000net1:\n    ipam:\n      driver: default\n      config:\n        - subnet: 172.18.0.0\/24\n          gateway: 172.18.0.1\n\n<\/pre>\n\n\n<p>\u904b\u7528\u306b\u3042\u305f\u3063\u3066\u306f S3, MySQL\u30b3\u30f3\u30c6\u30ca\u3092 docker-compose down \u3059\u308b\u524d\u306b\u30a4\u30e1\u30fc\u30b8\u3092\u305d\u306e\u90fd\u5ea6 docker commit \u3059\u308b\u3068\u5409\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u6700\u5f8c\u307e\u3067\u304a\u8aad\u307f\u3044\u305f\u3060\u304d\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u53c2\u8003URL\uff1a<a href=\"https:\/\/qiita.com\/robozushi10\/items\/e2ed733e09c9e39407f2\">[\u30b7\u30ea\u30fc\u30ba \u51682\u56de] docker-compose \u3092\u4f7f\u3063\u3066\u5373\u5ea7\u306b dnsmasq \u3092\u7acb\u3066\u308b<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u3001AWS ElasticBeansTalk \u3067\u8a66\u4f5c\u3057\u305fNode.js\u958b\u767a\u74b0\u5883\u3092Docker\u3092\u4f7f\u3063\u3066\u30ed\u30fc\u30ab\u30eb\u306b\u30dd\u30fc\u30c6\u30a3\u30f3\u30b0\u3057\u307e\u3057\u305f\u304c\u4eca\u56de\u306f\u518d\u3073AWS EC2\u306b\u30ea\u30d5\u30c8\u30a2\u30f3\u30c9\u30b7\u30d5\u30c8\u3057\u3066\u307f\u307e\u3057\u305f\u3002Redis\u3068S3\u4e92\u63db\u30b9\u30c8\u30ec\u30fc [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32,104,60,99,52,67,86],"tags":[],"class_list":["post-11584","post","type-post","status-publish","format-standard","hentry","category-aws-2","category-ec2","category-https-portal","category-minio","category-mysql","category-node-js","category-redis"],"_links":{"self":[{"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/posts\/11584","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/comments?post=11584"}],"version-history":[{"count":21,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/posts\/11584\/revisions"}],"predecessor-version":[{"id":11814,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/posts\/11584\/revisions\/11814"}],"wp:attachment":[{"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/media?parent=11584"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/categories?post=11584"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/tags?post=11584"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}