From e7f6d126139005812b7223228fdbbca776d6d508 Mon Sep 17 00:00:00 2001 From: Tatsumi0000 <19218690+Tatsumi0000@users.noreply.github.com> Date: Sat, 20 Apr 2024 21:35:38 +0900 Subject: [PATCH 01/18] =?UTF-8?q?=E3=83=AD=E3=83=BC=E3=82=AB=E3=83=AB?= =?UTF-8?q?=E3=81=A7=E4=BD=BF=E3=81=86k8s=E3=81=AE=E9=9B=9B=E5=BD=A2?= =?UTF-8?q?=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit まだローカルファイルのマウントやDBデータの永続化がまだできてない - #226 --- web/infra/base/deployment.yaml | 27 +++++++++++++ web/infra/base/kustomization.yaml | 11 ++++++ .../development/deployment.patch.yaml | 39 +++++++++++++++++++ .../overlays/development/kustomization.yaml | 9 +++++ 4 files changed, 86 insertions(+) create mode 100644 web/infra/base/deployment.yaml create mode 100644 web/infra/base/kustomization.yaml create mode 100644 web/infra/overlays/development/deployment.patch.yaml create mode 100644 web/infra/overlays/development/kustomization.yaml diff --git a/web/infra/base/deployment.yaml b/web/infra/base/deployment.yaml new file mode 100644 index 00000000..7bbe0ea2 --- /dev/null +++ b/web/infra/base/deployment.yaml @@ -0,0 +1,27 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: starry-kids +spec: + replicas: 1 + selector: + matchLabels: + app: starry-kids + template: + metadata: + labels: + app: starry-kids + spec: + containers: + - name: frontend + image: frontend-image + ports: + - containerPort: 5173 + resources: + limits: + memory: "64Mi" + cpu: "250m" + command: + - "npm" + - "run" + - "dev" diff --git a/web/infra/base/kustomization.yaml b/web/infra/base/kustomization.yaml new file mode 100644 index 00000000..933e4e27 --- /dev/null +++ b/web/infra/base/kustomization.yaml @@ -0,0 +1,11 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +namespace: "starry-kids" + +resources: + - deployment.yaml + +images: + - name: frontend-image + newName: ghcr.io/tatsumi0000/starry-kids/frontend + newTag: latest \ No newline at end of file diff --git a/web/infra/overlays/development/deployment.patch.yaml b/web/infra/overlays/development/deployment.patch.yaml new file mode 100644 index 00000000..d0bfbd23 --- /dev/null +++ b/web/infra/overlays/development/deployment.patch.yaml @@ -0,0 +1,39 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: starry-kids +spec: + replicas: 2 + selector: + matchLabels: + app: starry-kids + template: + metadata: + labels: + app: starry-kids + spec: + containers: + - name: backend + image: ghcr.io/tatsumi0000/starry-kids/backend:latest + ports: + - containerPort: 3000 + resources: + limits: + cpu: "250m" + memory: "769Mi" + command: + - "bin/rails" + - "s" + - "-b" + - "0.0.0.0" + - name: db + image: mysql:8.1.0 + ports: + - containerPort: 3306 + resources: + limits: + cpu: "250m" + memory: "769Mi" + env: + - name: MYSQL_ROOT_PASSWORD + value: "password" diff --git a/web/infra/overlays/development/kustomization.yaml b/web/infra/overlays/development/kustomization.yaml new file mode 100644 index 00000000..af7213e6 --- /dev/null +++ b/web/infra/overlays/development/kustomization.yaml @@ -0,0 +1,9 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +namespace: "starry-kids" + +resources: + - "../../base" + +patches: + - path: deployment.patch.yaml \ No newline at end of file From 2527483f928bde32daa175dc2d6fb5988788e389 Mon Sep 17 00:00:00 2001 From: Tatsumi0000 <19218690+Tatsumi0000@users.noreply.github.com> Date: Sat, 20 Apr 2024 23:58:22 +0900 Subject: [PATCH 02/18] =?UTF-8?q?=E3=83=87=E3=82=A3=E3=83=AC=E3=82=AF?= =?UTF-8?q?=E3=83=88=E3=83=AA=E5=90=8D=E3=82=92=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit localの開発環境なのでこっちのがわかりやすい --- web/infra/overlays/{development => local}/deployment.patch.yaml | 0 web/infra/overlays/{development => local}/kustomization.yaml | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename web/infra/overlays/{development => local}/deployment.patch.yaml (100%) rename web/infra/overlays/{development => local}/kustomization.yaml (100%) diff --git a/web/infra/overlays/development/deployment.patch.yaml b/web/infra/overlays/local/deployment.patch.yaml similarity index 100% rename from web/infra/overlays/development/deployment.patch.yaml rename to web/infra/overlays/local/deployment.patch.yaml diff --git a/web/infra/overlays/development/kustomization.yaml b/web/infra/overlays/local/kustomization.yaml similarity index 100% rename from web/infra/overlays/development/kustomization.yaml rename to web/infra/overlays/local/kustomization.yaml From 56a669909f7d673620de81f9011362d4f43b16ca Mon Sep 17 00:00:00 2001 From: Tatsumi0000 <19218690+Tatsumi0000@users.noreply.github.com> Date: Sat, 20 Apr 2024 23:58:48 +0900 Subject: [PATCH 03/18] =?UTF-8?q?=E3=83=AD=E3=83=BC=E3=82=AB=E3=83=AB?= =?UTF-8?q?=E3=81=AEfrontend=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=82=92?= =?UTF-8?q?=E3=83=9E=E3=82=A6=E3=83=B3=E3=83=88=E3=81=97=E3=81=BE=E3=81=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/infra/base/deployment.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/web/infra/base/deployment.yaml b/web/infra/base/deployment.yaml index 7bbe0ea2..7d4b44ac 100644 --- a/web/infra/base/deployment.yaml +++ b/web/infra/base/deployment.yaml @@ -25,3 +25,11 @@ spec: - "npm" - "run" - "dev" + volumeMounts: + - name: frontend + mountPath: /usr/src/app/frontend + volumes: + - name: frontend + hostPath: + path: ../../../frontend + type: Directory From 6b61a903409f700056413ce8f153935de7140c86 Mon Sep 17 00:00:00 2001 From: Tatsumi0000 <19218690+Tatsumi0000@users.noreply.github.com> Date: Sun, 21 Apr 2024 00:48:40 +0900 Subject: [PATCH 04/18] =?UTF-8?q?=E9=8D=B5=E3=81=AFcommit=E3=81=97?= =?UTF-8?q?=E3=81=9F=E3=81=8F=E3=81=AA=E3=81=84=E3=81=AE=E3=81=A7=E9=99=A4?= =?UTF-8?q?=E5=A4=96=E8=A8=AD=E5=AE=9A=E3=81=AB=E3=81=A4=E3=81=84=E3=81=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/infra/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 web/infra/.gitignore diff --git a/web/infra/.gitignore b/web/infra/.gitignore new file mode 100644 index 00000000..f38ab000 --- /dev/null +++ b/web/infra/.gitignore @@ -0,0 +1 @@ +pub-cert.pem \ No newline at end of file From 228a578a83e6e74d5b872aa26536dbf7d791b430 Mon Sep 17 00:00:00 2001 From: Tatsumi0000 <19218690+Tatsumi0000@users.noreply.github.com> Date: Sun, 21 Apr 2024 01:04:00 +0900 Subject: [PATCH 05/18] =?UTF-8?q?=E3=83=AD=E3=83=BC=E3=82=AB=E3=83=AB?= =?UTF-8?q?=E3=81=AE=E3=83=87=E3=82=A3=E3=83=AC=E3=82=AF=E3=83=88=E3=83=AA?= =?UTF-8?q?=E3=81=9F=E3=81=A1=E3=82=92=E3=83=9E=E3=82=A6=E3=83=B3=E3=83=88?= =?UTF-8?q?=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/infra/overlays/local/deployment.patch.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/web/infra/overlays/local/deployment.patch.yaml b/web/infra/overlays/local/deployment.patch.yaml index d0bfbd23..cc50cc35 100644 --- a/web/infra/overlays/local/deployment.patch.yaml +++ b/web/infra/overlays/local/deployment.patch.yaml @@ -26,6 +26,14 @@ spec: - "s" - "-b" - "0.0.0.0" + volumeMounts: + - name: backend + mountPath: /usr/src/app/backend + volumes: + - name: backend + hostPath: + path: ../../../backend + type: Directory - name: db image: mysql:8.1.0 ports: @@ -34,6 +42,14 @@ spec: limits: cpu: "250m" memory: "769Mi" + volumeMounts: + - name: db + mountPath: /var/lib/mysql + volumes: + - name: db + hostPath: + path: db_data + type: Directory env: - name: MYSQL_ROOT_PASSWORD value: "password" From 5c6c2715b37f236f298dce7602fef2ae609dc38c Mon Sep 17 00:00:00 2001 From: Tatsumi0000 <19218690+Tatsumi0000@users.noreply.github.com> Date: Sun, 21 Apr 2024 01:10:21 +0900 Subject: [PATCH 06/18] =?UTF-8?q?volumes=E3=81=AE=E3=82=A4=E3=83=B3?= =?UTF-8?q?=E3=83=87=E3=83=B3=E3=83=88=E3=81=8C=E3=81=9A=E3=82=8C=E3=81=A6?= =?UTF-8?q?=E3=81=84=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - #228 --- web/infra/base/deployment.yaml | 10 +++++----- .../overlays/local/deployment.patch.yaml | 19 +++++++++---------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/web/infra/base/deployment.yaml b/web/infra/base/deployment.yaml index 7d4b44ac..f083aad7 100644 --- a/web/infra/base/deployment.yaml +++ b/web/infra/base/deployment.yaml @@ -28,8 +28,8 @@ spec: volumeMounts: - name: frontend mountPath: /usr/src/app/frontend - volumes: - - name: frontend - hostPath: - path: ../../../frontend - type: Directory + volumes: + - name: frontend + hostPath: + path: ../../../frontend + type: Directory diff --git a/web/infra/overlays/local/deployment.patch.yaml b/web/infra/overlays/local/deployment.patch.yaml index cc50cc35..8cdbc107 100644 --- a/web/infra/overlays/local/deployment.patch.yaml +++ b/web/infra/overlays/local/deployment.patch.yaml @@ -29,11 +29,6 @@ spec: volumeMounts: - name: backend mountPath: /usr/src/app/backend - volumes: - - name: backend - hostPath: - path: ../../../backend - type: Directory - name: db image: mysql:8.1.0 ports: @@ -45,11 +40,15 @@ spec: volumeMounts: - name: db mountPath: /var/lib/mysql - volumes: - - name: db - hostPath: - path: db_data - type: Directory + volumes: + - name: db + hostPath: + path: db_data + type: Directory + - name: backend + hostPath: + path: ../../../backend + type: Directory env: - name: MYSQL_ROOT_PASSWORD value: "password" From 1e23ddfe6465e60f3bd0ced2b33b801af678ffac Mon Sep 17 00:00:00 2001 From: Tatsumi0000 <19218690+Tatsumi0000@users.noreply.github.com> Date: Sun, 21 Apr 2024 01:14:18 +0900 Subject: [PATCH 07/18] =?UTF-8?q?db=E3=82=B3=E3=83=B3=E3=83=86=E3=83=8A?= =?UTF-8?q?=E3=81=AB=E7=92=B0=E5=A2=83=E5=A4=89=E6=95=B0=E3=82=92=E3=82=BB?= =?UTF-8?q?=E3=83=83=E3=83=88=E3=81=99=E3=82=8B=E3=81=AE=E3=81=A7=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - #229 --- web/infra/overlays/local/deployment.patch.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/infra/overlays/local/deployment.patch.yaml b/web/infra/overlays/local/deployment.patch.yaml index 8cdbc107..2f8fde55 100644 --- a/web/infra/overlays/local/deployment.patch.yaml +++ b/web/infra/overlays/local/deployment.patch.yaml @@ -15,6 +15,9 @@ spec: containers: - name: backend image: ghcr.io/tatsumi0000/starry-kids/backend:latest + env: + - name: MYSQL_ROOT_PASSWORD + value: "password" ports: - containerPort: 3000 resources: @@ -49,6 +52,3 @@ spec: hostPath: path: ../../../backend type: Directory - env: - - name: MYSQL_ROOT_PASSWORD - value: "password" From 289a2a91da83cbd4a53be518b3ebfb8831fad7d3 Mon Sep 17 00:00:00 2001 From: Tatsumi0000 <19218690+Tatsumi0000@users.noreply.github.com> Date: Sun, 21 Apr 2024 01:34:15 +0900 Subject: [PATCH 08/18] =?UTF-8?q?backend=E3=81=A8frontend=E3=81=8C?= =?UTF-8?q?=E8=A6=8B=E3=81=88=E3=81=AA=E3=81=84=E3=81=AE=E3=81=A7=E3=83=87?= =?UTF-8?q?=E3=82=A3=E3=83=AC=E3=82=AF=E3=83=88=E3=83=AA=E3=81=AE=E9=9A=8E?= =?UTF-8?q?=E5=B1=A4=E3=82=921=E5=80=8B=E6=B5=85=E3=81=8F=E3=81=99?= =?UTF-8?q?=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- {web/infra => infra}/.gitignore | 0 {web/infra => infra}/base/deployment.yaml | 0 {web/infra => infra}/base/kustomization.yaml | 0 {web/infra => infra}/overlays/local/deployment.patch.yaml | 0 {web/infra => infra}/overlays/local/kustomization.yaml | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename {web/infra => infra}/.gitignore (100%) rename {web/infra => infra}/base/deployment.yaml (100%) rename {web/infra => infra}/base/kustomization.yaml (100%) rename {web/infra => infra}/overlays/local/deployment.patch.yaml (100%) rename {web/infra => infra}/overlays/local/kustomization.yaml (100%) diff --git a/web/infra/.gitignore b/infra/.gitignore similarity index 100% rename from web/infra/.gitignore rename to infra/.gitignore diff --git a/web/infra/base/deployment.yaml b/infra/base/deployment.yaml similarity index 100% rename from web/infra/base/deployment.yaml rename to infra/base/deployment.yaml diff --git a/web/infra/base/kustomization.yaml b/infra/base/kustomization.yaml similarity index 100% rename from web/infra/base/kustomization.yaml rename to infra/base/kustomization.yaml diff --git a/web/infra/overlays/local/deployment.patch.yaml b/infra/overlays/local/deployment.patch.yaml similarity index 100% rename from web/infra/overlays/local/deployment.patch.yaml rename to infra/overlays/local/deployment.patch.yaml diff --git a/web/infra/overlays/local/kustomization.yaml b/infra/overlays/local/kustomization.yaml similarity index 100% rename from web/infra/overlays/local/kustomization.yaml rename to infra/overlays/local/kustomization.yaml From 368c4c4fb0e0c8b16a79e06d3167c6de092d66c8 Mon Sep 17 00:00:00 2001 From: Tatsumi0000 <19218690+Tatsumi0000@users.noreply.github.com> Date: Sun, 21 Apr 2024 01:53:24 +0900 Subject: [PATCH 09/18] =?UTF-8?q?backend=E3=81=A8frontend=E3=81=8C?= =?UTF-8?q?=E8=A6=8B=E3=81=88=E3=81=AA=E3=81=84=E3=81=AE=E3=81=A7=E3=83=87?= =?UTF-8?q?=E3=82=A3=E3=83=AC=E3=82=AF=E3=83=88=E3=83=AA=E3=81=AE=E9=9A=8E?= =?UTF-8?q?=E5=B1=A4=E3=82=921=E5=80=8B=E6=B5=85=E3=81=8F=E3=81=99?= =?UTF-8?q?=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- {infra => web}/.gitignore | 0 {infra/base => web}/deployment.yaml | 2 +- {infra/base => web}/kustomization.yaml | 0 {infra => web}/overlays/local/deployment.patch.yaml | 2 +- {infra => web}/overlays/local/kustomization.yaml | 0 5 files changed, 2 insertions(+), 2 deletions(-) rename {infra => web}/.gitignore (100%) rename {infra/base => web}/deployment.yaml (95%) rename {infra/base => web}/kustomization.yaml (100%) rename {infra => web}/overlays/local/deployment.patch.yaml (97%) rename {infra => web}/overlays/local/kustomization.yaml (100%) diff --git a/infra/.gitignore b/web/.gitignore similarity index 100% rename from infra/.gitignore rename to web/.gitignore diff --git a/infra/base/deployment.yaml b/web/deployment.yaml similarity index 95% rename from infra/base/deployment.yaml rename to web/deployment.yaml index f083aad7..82cd4fe9 100644 --- a/infra/base/deployment.yaml +++ b/web/deployment.yaml @@ -31,5 +31,5 @@ spec: volumes: - name: frontend hostPath: - path: ../../../frontend + path: ../../frontend type: Directory diff --git a/infra/base/kustomization.yaml b/web/kustomization.yaml similarity index 100% rename from infra/base/kustomization.yaml rename to web/kustomization.yaml diff --git a/infra/overlays/local/deployment.patch.yaml b/web/overlays/local/deployment.patch.yaml similarity index 97% rename from infra/overlays/local/deployment.patch.yaml rename to web/overlays/local/deployment.patch.yaml index 2f8fde55..cc0c8fa4 100644 --- a/infra/overlays/local/deployment.patch.yaml +++ b/web/overlays/local/deployment.patch.yaml @@ -50,5 +50,5 @@ spec: type: Directory - name: backend hostPath: - path: ../../../backend + path: ../../backend type: Directory diff --git a/infra/overlays/local/kustomization.yaml b/web/overlays/local/kustomization.yaml similarity index 100% rename from infra/overlays/local/kustomization.yaml rename to web/overlays/local/kustomization.yaml From 5a0ff35c83c5031e0ee5f04c5d4694d6bab1d11e Mon Sep 17 00:00:00 2001 From: Tatsumi0000 <19218690+Tatsumi0000@users.noreply.github.com> Date: Sun, 21 Apr 2024 02:04:00 +0900 Subject: [PATCH 10/18] =?UTF-8?q?Revert=20"backend=E3=81=A8frontend?= =?UTF-8?q?=E3=81=8C=E8=A6=8B=E3=81=88=E3=81=AA=E3=81=84=E3=81=AE=E3=81=A7?= =?UTF-8?q?=E3=83=87=E3=82=A3=E3=83=AC=E3=82=AF=E3=83=88=E3=83=AA=E3=81=AE?= =?UTF-8?q?=E9=9A=8E=E5=B1=A4=E3=82=921=E5=80=8B=E6=B5=85=E3=81=8F?= =?UTF-8?q?=E3=81=99=E3=82=8B"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 368c4c4fb0e0c8b16a79e06d3167c6de092d66c8. --- {web => infra}/.gitignore | 0 {web => infra/base}/deployment.yaml | 2 +- {web => infra/base}/kustomization.yaml | 0 {web => infra}/overlays/local/deployment.patch.yaml | 2 +- {web => infra}/overlays/local/kustomization.yaml | 0 5 files changed, 2 insertions(+), 2 deletions(-) rename {web => infra}/.gitignore (100%) rename {web => infra/base}/deployment.yaml (95%) rename {web => infra/base}/kustomization.yaml (100%) rename {web => infra}/overlays/local/deployment.patch.yaml (97%) rename {web => infra}/overlays/local/kustomization.yaml (100%) diff --git a/web/.gitignore b/infra/.gitignore similarity index 100% rename from web/.gitignore rename to infra/.gitignore diff --git a/web/deployment.yaml b/infra/base/deployment.yaml similarity index 95% rename from web/deployment.yaml rename to infra/base/deployment.yaml index 82cd4fe9..f083aad7 100644 --- a/web/deployment.yaml +++ b/infra/base/deployment.yaml @@ -31,5 +31,5 @@ spec: volumes: - name: frontend hostPath: - path: ../../frontend + path: ../../../frontend type: Directory diff --git a/web/kustomization.yaml b/infra/base/kustomization.yaml similarity index 100% rename from web/kustomization.yaml rename to infra/base/kustomization.yaml diff --git a/web/overlays/local/deployment.patch.yaml b/infra/overlays/local/deployment.patch.yaml similarity index 97% rename from web/overlays/local/deployment.patch.yaml rename to infra/overlays/local/deployment.patch.yaml index cc0c8fa4..2f8fde55 100644 --- a/web/overlays/local/deployment.patch.yaml +++ b/infra/overlays/local/deployment.patch.yaml @@ -50,5 +50,5 @@ spec: type: Directory - name: backend hostPath: - path: ../../backend + path: ../../../backend type: Directory diff --git a/web/overlays/local/kustomization.yaml b/infra/overlays/local/kustomization.yaml similarity index 100% rename from web/overlays/local/kustomization.yaml rename to infra/overlays/local/kustomization.yaml From 672ba2fe0a8d127ce88b3e8e4ba2830270c0cbe6 Mon Sep 17 00:00:00 2001 From: Tatsumi0000 <19218690+Tatsumi0000@users.noreply.github.com> Date: Sun, 21 Apr 2024 02:04:06 +0900 Subject: [PATCH 11/18] =?UTF-8?q?Revert=20"backend=E3=81=A8frontend?= =?UTF-8?q?=E3=81=8C=E8=A6=8B=E3=81=88=E3=81=AA=E3=81=84=E3=81=AE=E3=81=A7?= =?UTF-8?q?=E3=83=87=E3=82=A3=E3=83=AC=E3=82=AF=E3=83=88=E3=83=AA=E3=81=AE?= =?UTF-8?q?=E9=9A=8E=E5=B1=A4=E3=82=921=E5=80=8B=E6=B5=85=E3=81=8F?= =?UTF-8?q?=E3=81=99=E3=82=8B"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 289a2a91da83cbd4a53be518b3ebfb8831fad7d3. --- {infra => web/infra}/.gitignore | 0 {infra => web/infra}/base/deployment.yaml | 0 {infra => web/infra}/base/kustomization.yaml | 0 {infra => web/infra}/overlays/local/deployment.patch.yaml | 0 {infra => web/infra}/overlays/local/kustomization.yaml | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename {infra => web/infra}/.gitignore (100%) rename {infra => web/infra}/base/deployment.yaml (100%) rename {infra => web/infra}/base/kustomization.yaml (100%) rename {infra => web/infra}/overlays/local/deployment.patch.yaml (100%) rename {infra => web/infra}/overlays/local/kustomization.yaml (100%) diff --git a/infra/.gitignore b/web/infra/.gitignore similarity index 100% rename from infra/.gitignore rename to web/infra/.gitignore diff --git a/infra/base/deployment.yaml b/web/infra/base/deployment.yaml similarity index 100% rename from infra/base/deployment.yaml rename to web/infra/base/deployment.yaml diff --git a/infra/base/kustomization.yaml b/web/infra/base/kustomization.yaml similarity index 100% rename from infra/base/kustomization.yaml rename to web/infra/base/kustomization.yaml diff --git a/infra/overlays/local/deployment.patch.yaml b/web/infra/overlays/local/deployment.patch.yaml similarity index 100% rename from infra/overlays/local/deployment.patch.yaml rename to web/infra/overlays/local/deployment.patch.yaml diff --git a/infra/overlays/local/kustomization.yaml b/web/infra/overlays/local/kustomization.yaml similarity index 100% rename from infra/overlays/local/kustomization.yaml rename to web/infra/overlays/local/kustomization.yaml From 5bb25c3710b59ce8241997257ed1d6149af7851d Mon Sep 17 00:00:00 2001 From: Tatsumi0000 <19218690+Tatsumi0000@users.noreply.github.com> Date: Sun, 21 Apr 2024 02:11:52 +0900 Subject: [PATCH 12/18] =?UTF-8?q?=E6=99=AE=E9=80=9A=E3=81=AB=E3=83=AD?= =?UTF-8?q?=E3=83=BC=E3=82=AB=E3=83=AB=E3=81=AE=E3=83=9E=E3=82=A6=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=82=92=E3=81=97=E3=81=AA=E3=81=84=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/infra/base/deployment.yaml | 8 -------- web/infra/overlays/local/deployment.patch.yaml | 7 ------- 2 files changed, 15 deletions(-) diff --git a/web/infra/base/deployment.yaml b/web/infra/base/deployment.yaml index f083aad7..7bbe0ea2 100644 --- a/web/infra/base/deployment.yaml +++ b/web/infra/base/deployment.yaml @@ -25,11 +25,3 @@ spec: - "npm" - "run" - "dev" - volumeMounts: - - name: frontend - mountPath: /usr/src/app/frontend - volumes: - - name: frontend - hostPath: - path: ../../../frontend - type: Directory diff --git a/web/infra/overlays/local/deployment.patch.yaml b/web/infra/overlays/local/deployment.patch.yaml index 2f8fde55..fd87097e 100644 --- a/web/infra/overlays/local/deployment.patch.yaml +++ b/web/infra/overlays/local/deployment.patch.yaml @@ -29,9 +29,6 @@ spec: - "s" - "-b" - "0.0.0.0" - volumeMounts: - - name: backend - mountPath: /usr/src/app/backend - name: db image: mysql:8.1.0 ports: @@ -48,7 +45,3 @@ spec: hostPath: path: db_data type: Directory - - name: backend - hostPath: - path: ../../../backend - type: Directory From 626549231f43693fa319a9cc3ac32513d9b22792 Mon Sep 17 00:00:00 2001 From: Tatsumi0000 <19218690+Tatsumi0000@users.noreply.github.com> Date: Sun, 21 Apr 2024 02:41:58 +0900 Subject: [PATCH 13/18] =?UTF-8?q?=E3=83=A9=E3=82=A4=E3=83=96=E3=83=A9?= =?UTF-8?q?=E3=83=AA=E3=82=92=E3=82=A4=E3=83=A1=E3=83=BC=E3=82=B8=E3=81=AB?= =?UTF-8?q?=E5=90=AB=E3=82=81=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/backend/Dockerfile | 3 ++- web/frontend/Dockerfile | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/web/backend/Dockerfile b/web/backend/Dockerfile index 62992bfc..29052127 100644 --- a/web/backend/Dockerfile +++ b/web/backend/Dockerfile @@ -16,5 +16,6 @@ RUN rbenv install 3.3.0 && \ RUN gem update && \ bundle config set path vendor/bundle - WORKDIR /usr/src/app + +RUN bundle install \ No newline at end of file diff --git a/web/frontend/Dockerfile b/web/frontend/Dockerfile index f95ce5bd..db87eb04 100644 --- a/web/frontend/Dockerfile +++ b/web/frontend/Dockerfile @@ -5,3 +5,5 @@ RUN apt update && \ RUN npm install -g npm WORKDIR /usr/src/app + +RUN npm install \ No newline at end of file From ce54b124453b3aaab62b0e17498ea8bada9f8fa7 Mon Sep 17 00:00:00 2001 From: Tatsumi0000 <19218690+Tatsumi0000@users.noreply.github.com> Date: Sun, 21 Apr 2024 02:50:41 +0900 Subject: [PATCH 14/18] =?UTF-8?q?COPY=E3=81=97=E3=81=AA=E3=81=84=E3=81=A8?= =?UTF-8?q?=E3=83=A9=E3=82=A4=E3=83=96=E3=83=A9=E3=83=AA=E3=82=92=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E3=82=B9=E3=83=88=E3=83=BC=E3=83=AB=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=81=9F=E3=82=81=E3=81=AE=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E3=81=8C=E8=A6=8B=E3=82=8C=E3=81=AA=E3=81=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/backend/Dockerfile | 2 +- web/frontend/Dockerfile | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/web/backend/Dockerfile b/web/backend/Dockerfile index 29052127..eb4507b1 100644 --- a/web/backend/Dockerfile +++ b/web/backend/Dockerfile @@ -17,5 +17,5 @@ RUN gem update && \ bundle config set path vendor/bundle WORKDIR /usr/src/app - +COPY . /usr/src/app RUN bundle install \ No newline at end of file diff --git a/web/frontend/Dockerfile b/web/frontend/Dockerfile index db87eb04..40f3a289 100644 --- a/web/frontend/Dockerfile +++ b/web/frontend/Dockerfile @@ -6,4 +6,5 @@ RUN npm install -g npm WORKDIR /usr/src/app +COPY . /usr/src/app RUN npm install \ No newline at end of file From 24a52be2b426d98c21c5f18339bec8df3f4dc03f Mon Sep 17 00:00:00 2001 From: Tatsumi0000 <19218690+Tatsumi0000@users.noreply.github.com> Date: Sun, 21 Apr 2024 23:16:41 +0900 Subject: [PATCH 15/18] Add --- web/infra/base/deployment.yaml | 5 +++-- web/infra/overlays/local/deployment.patch.yaml | 11 ++++++----- web/infra/overlays/local/kustomization.yaml | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/web/infra/base/deployment.yaml b/web/infra/base/deployment.yaml index 7bbe0ea2..61a418d5 100644 --- a/web/infra/base/deployment.yaml +++ b/web/infra/base/deployment.yaml @@ -1,16 +1,17 @@ apiVersion: apps/v1 kind: Deployment metadata: + namespace: starry-kids name: starry-kids spec: replicas: 1 selector: matchLabels: - app: starry-kids + app: frontend template: metadata: labels: - app: starry-kids + app: frontend spec: containers: - name: frontend diff --git a/web/infra/overlays/local/deployment.patch.yaml b/web/infra/overlays/local/deployment.patch.yaml index fd87097e..b47824ec 100644 --- a/web/infra/overlays/local/deployment.patch.yaml +++ b/web/infra/overlays/local/deployment.patch.yaml @@ -1,16 +1,17 @@ apiVersion: apps/v1 kind: Deployment metadata: + namespace: starry-kids name: starry-kids spec: - replicas: 2 + replicas: 1 selector: matchLabels: - app: starry-kids + app: backend template: metadata: labels: - app: starry-kids + app: backend spec: containers: - name: backend @@ -43,5 +44,5 @@ spec: volumes: - name: db hostPath: - path: db_data - type: Directory + path: /db_data + type: DirectoryOrCreate diff --git a/web/infra/overlays/local/kustomization.yaml b/web/infra/overlays/local/kustomization.yaml index af7213e6..8b912a1a 100644 --- a/web/infra/overlays/local/kustomization.yaml +++ b/web/infra/overlays/local/kustomization.yaml @@ -1,9 +1,9 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: "starry-kids" +namespace: starry-kids resources: - "../../base" patches: - - path: deployment.patch.yaml \ No newline at end of file + - path: deployment.patch.yaml From 70ca2274b5bed39093334cec522acb1e57ac2699 Mon Sep 17 00:00:00 2001 From: Tatsumi0000 <19218690+Tatsumi0000@users.noreply.github.com> Date: Wed, 24 Apr 2024 23:57:54 +0900 Subject: [PATCH 16/18] =?UTF-8?q?=E3=83=A1=E3=83=A2=E3=83=AA=E3=81=8C?= =?UTF-8?q?=E8=B6=B3=E3=82=8A=E3=81=9A=E3=81=ABvite=E3=81=8C=E7=AB=8B?= =?UTF-8?q?=E3=81=A1=E4=B8=8A=E3=81=8C=E3=81=A3=E3=81=A6=E3=81=AA=E3=81=8B?= =?UTF-8?q?=E3=81=A3=E3=81=9F=E3=81=AE=E3=81=A7=E5=A2=97=E3=82=84=E3=81=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit k logsで見たところすぐkilledになってました。なのでメモリを増やしたところ動いてました。 --- web/infra/base/deployment.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/infra/base/deployment.yaml b/web/infra/base/deployment.yaml index 61a418d5..ac20d094 100644 --- a/web/infra/base/deployment.yaml +++ b/web/infra/base/deployment.yaml @@ -2,7 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: namespace: starry-kids - name: starry-kids + name: frontend spec: replicas: 1 selector: @@ -20,9 +20,9 @@ spec: - containerPort: 5173 resources: limits: - memory: "64Mi" + memory: "128Mi" cpu: "250m" - command: + command: - "npm" - "run" - "dev" From 94f04b33176880abfa8e1ae942c42c3fa97ca9c9 Mon Sep 17 00:00:00 2001 From: Tatsumi0000 <19218690+Tatsumi0000@users.noreply.github.com> Date: Thu, 25 Apr 2024 01:20:05 +0900 Subject: [PATCH 17/18] =?UTF-8?q?configMapGenerator=E7=B5=8C=E7=94=B1?= =?UTF-8?q?=E3=81=A7=E7=92=B0=E5=A2=83=E5=A4=89=E6=95=B0=E3=82=92=E3=82=BB?= =?UTF-8?q?=E3=83=83=E3=83=88=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/infra/overlays/local/config/.env | 1 + web/infra/overlays/local/kustomization.yaml | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 web/infra/overlays/local/config/.env diff --git a/web/infra/overlays/local/config/.env b/web/infra/overlays/local/config/.env new file mode 100644 index 00000000..096eb804 --- /dev/null +++ b/web/infra/overlays/local/config/.env @@ -0,0 +1 @@ +MYSQL_ROOT_PASSWORD=password \ No newline at end of file diff --git a/web/infra/overlays/local/kustomization.yaml b/web/infra/overlays/local/kustomization.yaml index 8b912a1a..14b7849d 100644 --- a/web/infra/overlays/local/kustomization.yaml +++ b/web/infra/overlays/local/kustomization.yaml @@ -7,3 +7,8 @@ resources: patches: - path: deployment.patch.yaml + +configMapGenerator: + - name: db-config + envs: + - config/.env \ No newline at end of file From 08cbb4f79374ffd623e301012d90fee0fdb0b116 Mon Sep 17 00:00:00 2001 From: Tatsumi0000 <19218690+Tatsumi0000@users.noreply.github.com> Date: Thu, 25 Apr 2024 01:21:29 +0900 Subject: [PATCH 18/18] =?UTF-8?q?=E5=90=8C=E4=B8=80deployment=E5=86=85?= =?UTF-8?q?=E3=81=AB=E3=81=84=E3=81=9F=E3=81=BB=E3=81=86=E3=81=8C=E9=80=9A?= =?UTF-8?q?=E4=BF=A1=E3=81=8C=E6=A5=BD=E3=81=AA=E3=81=AE=E3=81=A7=E3=81=BE?= =?UTF-8?q?=E3=81=A8=E3=82=81=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ついでにconfigMapGeneratorで環境変数を呼び出す - ただRailsのコンテナが立ち上がらない --- web/infra/base/deployment.yaml | 6 +++--- web/infra/overlays/local/deployment.patch.yaml | 18 ++++++++++++++---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/web/infra/base/deployment.yaml b/web/infra/base/deployment.yaml index ac20d094..e781dafa 100644 --- a/web/infra/base/deployment.yaml +++ b/web/infra/base/deployment.yaml @@ -2,16 +2,16 @@ apiVersion: apps/v1 kind: Deployment metadata: namespace: starry-kids - name: frontend + name: web spec: replicas: 1 selector: matchLabels: - app: frontend + app: web template: metadata: labels: - app: frontend + app: web spec: containers: - name: frontend diff --git a/web/infra/overlays/local/deployment.patch.yaml b/web/infra/overlays/local/deployment.patch.yaml index b47824ec..f381d3ac 100644 --- a/web/infra/overlays/local/deployment.patch.yaml +++ b/web/infra/overlays/local/deployment.patch.yaml @@ -2,23 +2,26 @@ apiVersion: apps/v1 kind: Deployment metadata: namespace: starry-kids - name: starry-kids + name: web spec: replicas: 1 selector: matchLabels: - app: backend + app: web template: metadata: labels: - app: backend + app: web spec: containers: - name: backend image: ghcr.io/tatsumi0000/starry-kids/backend:latest env: - name: MYSQL_ROOT_PASSWORD - value: "password" + valueFrom: + configMapKeyRef: + name: db-config + key: MYSQL_ROOT_PASSWORD ports: - containerPort: 3000 resources: @@ -26,12 +29,19 @@ spec: cpu: "250m" memory: "769Mi" command: + - "bundle exec db:prepare" - "bin/rails" - "s" - "-b" - "0.0.0.0" - name: db image: mysql:8.1.0 + env: + - name: MYSQL_ROOT_PASSWORD + valueFrom: + configMapKeyRef: + name: db-config + key: MYSQL_ROOT_PASSWORD ports: - containerPort: 3306 resources: