Skip to content

Commit

Permalink
Merge pull request #614 from osushi-academy/TOMOFUMI-KONDO/fix-deploy…
Browse files Browse the repository at this point in the history
…-command

デプロイ設定の修正
  • Loading branch information
TOMOFUMI-KONDO authored Dec 13, 2021
2 parents 22dfd7c + d901d06 commit d516d3a
Show file tree
Hide file tree
Showing 18 changed files with 11 additions and 109 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/deploy-aws.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- main
- TOMOFUMI-KONDO/fix-deploy-command

jobs:
deploy:
Expand All @@ -27,6 +26,6 @@ jobs:
--deployment-group-name ${{ env.PROJECT }}-deploy-group \
--description "Deployment for ${{ env.PROJECT }}" \
--github-location repository=$GITHUB_REPOSITORY,commitId="${{ github.sha }}" \
--file-exists-behavior RETAIN \
--file-exists-behavior OVERWRITE \
env:
PROJECT: sushi-chat
8 changes: 0 additions & 8 deletions .idea/.gitignore

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/dataSources.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/inspectionProfiles/Project_Default.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/jsLinters/eslint.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/prettier.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/sqldialects.xml

This file was deleted.

14 changes: 0 additions & 14 deletions .idea/sushi-chat.iml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/watcherTasks.xml

This file was deleted.

8 changes: 1 addition & 7 deletions scripts/build_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,4 @@
cd /app || exit 1

yarn build:shared

mkdir -p /out/app/server
cp -r node_modules /out
cp -r app/server/node_modules /out/app/server
yarn build:server --outDir /out/app/server/dist

cp app/server/.env /out/app/server/.env
yarn build:server
2 changes: 1 addition & 1 deletion scripts/mod_permission.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

chmod -R 700 /out && chown -R app:app /out
chmod -R 700 /app && chown -R app:app /app
2 changes: 1 addition & 1 deletion scripts/start_app.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

cd /out/app/server || exit 1
cd /app/app/server || exit 1
NODE_ENV=production node --require dotenv/config ./dist/src/app.js >/var/log/app/info.log 2>/var/log/app/error.log </dev/null &
3 changes: 2 additions & 1 deletion terraform/deploy.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ resource "aws_codedeploy_deployment_group" "deploy-group" {
}

resource "aws_iam_role" "deploy-service-role" {
name = "${var.project}-deploy-service-role"

assume_role_policy = jsonencode({
"Version" : "2012-10-17",
"Statement" : [
Expand All @@ -37,7 +39,6 @@ resource "aws_iam_role" "deploy-service-role" {
})

tags = {
Name = "${var.project}-deploy-service-role"
Project = var.project
}
}
Expand Down
9 changes: 4 additions & 5 deletions terraform/ec2.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,18 @@ resource "aws_launch_template" "main" {
}

tags = {
Name = "${var.project}-launch-template"
Project = var.project
}
}

resource "aws_iam_instance_profile" "write_cloud_watch_logs" {
name = "write_cloud_watch_logs"
name = "${var.project}-write_cloud_watch_logs"
role = aws_iam_role.write_cloud_watch_logs.name
}

resource "aws_iam_role" "write_cloud_watch_logs" {
name = "write_cloud_watch_logs"
name = "${var.project}-write_cloud_watch_logs"

assume_role_policy = jsonencode({
Version = "2012-10-17",
Statement = {
Expand All @@ -76,7 +76,6 @@ resource "aws_iam_role" "write_cloud_watch_logs" {
})

tags = {
Name = "${var.project}-write_cloud_watch_logs"
project = var.project
}
}
Expand All @@ -92,6 +91,7 @@ data "aws_iam_policy" "cloud_watch_agent_server_policy" {

// TODO: 手動デプロイする必要がなくなったらprivateサブネットに配置する。ただその場合はNat Gatewayが必要になるので注意
resource "aws_security_group" "public_instance" {
name = "${var.project}-sg-public-instance"
description = "This is a security group for API server for sushi-chat app. It allows http and https from alb, and ssh from admin."
vpc_id = aws_vpc.main.id

Expand All @@ -104,7 +104,6 @@ resource "aws_security_group" "public_instance" {
}

tags = {
Name = "${var.project}-sg-public-instance"
project = var.project
}
}
Expand Down
4 changes: 1 addition & 3 deletions terraform/lb.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ resource "aws_lb" "main" {
name = "${var.project}-alb"
security_groups = [aws_security_group.public_alb.id]
subnets = [aws_subnet.public_a.id, aws_subnet.public_c.id]
enable_http2 = false

tags = {
Name = "${var.project}-alb"
project = var.project
}
}
Expand All @@ -25,7 +25,6 @@ resource "aws_security_group" "public_alb" {
}

tags = {
Name = "${var.project}-sg-alb"
project = var.project
}
}
Expand Down Expand Up @@ -69,7 +68,6 @@ resource "aws_lb_target_group" "main" {
}

tags = {
Name = "${var.project}-target-group"
project = var.project
}
}
Expand Down

0 comments on commit d516d3a

Please sign in to comment.