Giter VIP home page Giter VIP logo

simplechat's Introduction

simplechat's People

Contributors

github-actions[bot] avatar shinjam avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

dojun1015

simplechat's Issues

git actions 개선

  • test가 너무 느림
    • 테스트 과정에서 docker를 띄워서 그런듯 하다 docker를 분리해서 테스트 해보자
  • go vet이 많이 느림
  • 중복된 코드가 있는데 composite으로 해결 가능한지 해보기

dependency 확인

Problem

  • sg가 삭제가 안된다.

  • 따로 수정한것이 없는데 Note: Objects have changed outside of Terraform 발생

    Show logs
    Note: Objects have changed outside of Terraform
            
            Terraform detected the following changes made outside of Terraform since the last "terraform apply":
            
              # module.alb.module.alb.aws_lb_listener.frontend_http_tcp[0] has changed
              ~ resource "aws_lb_listener" "frontend_http_tcp" {
                    id                = "arn:aws:elasticloadbalancing:ap-northeast-2:559121217486:listener/app/kuve-alb/351df469f5ef1d3e/8e19cff29c7b9e63"
                  + tags              = {}
                    # (5 unchanged attributes hidden)
            
                    # (1 unchanged block hidden)
                }
            
              # module.alb.module.alb.aws_lb_listener_rule.http_tcp_listener_rule[0] has changed
              ~ resource "aws_lb_listener_rule" "http_tcp_listener_rule" {
                    id           = "arn:aws:elasticloadbalancing:ap-northeast-2:559121217486:listener-rule/app/kuve-alb/351df469f5ef1d3e/8e19cff29c7b9e63/67d1f39a204a1684"
                  + tags         = {}
                    # (4 unchanged attributes hidden)
            
            
                    # (2 unchanged blocks hidden)
                }
            
              # module.bastion_server.module.bastion.aws_iam_role.default[0] has changed
              ~ resource "aws_iam_role" "default" {
                    id                    = "bastion"
                    name                  = "bastion"
                    tags                  = {
                        "Environment"      = "staging"
                        "Name"             = "bastion"
                        "Project"          = "kuve"
                        "TerraformManaged" = "true"
                    }
                    # (9 unchanged attributes hidden)
            
                  - inline_policy {}
                  + inline_policy {
                      + name   = "bastion"
                      + policy = jsonencode(
                            {
                              + Statement = [
                                  + {
                                      + Action   = [
                                          + "ssm:UpdateInstanceInformation",
                                          + "ssm:UpdateInstanceAssociationStatus",
                                          + "ssm:UpdateAssociationStatus",
                                          + "ssm:PutInventory",
                                          + "ssm:PutConfigurePackageResult",
                                          + "ssm:PutComplianceItems",
                                          + "ssm:ListInstanceAssociations",
                                          + "ssm:ListAssociations",
                                          + "ssm:GetParameters",
                                          + "ssm:GetParameter",
                                          + "ssm:GetManifest",
                                          + "ssm:GetDocument",
                                          + "ssm:GetDeployablePatchSnapshotForInstance",
                                          + "ssm:DescribeDocument",
                                          + "ssm:DescribeAssociation",
                                        ]
                                      + Effect   = "Allow"
                                      + Resource = "*"
                                      + Sid      = ""
                                    },
                                  + {
                                      + Action   = [
                                          + "ssmmessages:OpenDataChannel",
                                          + "ssmmessages:OpenControlChannel",
                                          + "ssmmessages:CreateDataChannel",
                                          + "ssmmessages:CreateControlChannel",
                                        ]
                                      + Effect   = "Allow"
                                      + Resource = "*"
                                      + Sid      = ""
                                    },
                                  + {
                                      + Action   = [
                                          + "ec2messages:SendReply",
                                          + "ec2messages:GetMessages",
                                          + "ec2messages:GetEndpoint",
                                          + "ec2messages:FailMessage",
                                          + "ec2messages:DeleteMessage",
                                          + "ec2messages:AcknowledgeMessage",
                                        ]
                                      + Effect   = "Allow"
                                      + Resource = "*"
                                      + Sid      = ""
                                    },
                                  + {
                                      + Action   = "s3:GetEncryptionConfiguration"
                                      + Effect   = "Allow"
                                      + Resource = "*"
                                      + Sid      = ""
                                    },
                                ]
                              + Version   = "2012-10-17"
                            }
                        )
                    }
                }
            
              # module.bastion_server.module.bastion.aws_instance.default[0] has changed
              ~ resource "aws_instance" "default" {
                    id                                   = "i-07c5c48039eb106c7"
                  ~ public_ip                            = "13.125.216.212" -> "3.38.227.164"
                    tags                                 = {
                        "Environment"      = "staging"
                        "Name"             = "bastion"
                        "Project"          = "kuve"
                        "TerraformManaged" = "true"
                    }
                    # (29 unchanged attributes hidden)
            
            
            
            
            
                  ~ root_block_device {
                      + tags                  = {}
                        # (9 unchanged attributes hidden)
                    }
                    # (4 unchanged blocks hidden)
                }
            
              # module.sg.module.ec2_sg.aws_security_group.this_name_prefix[0] has changed
              ~ resource "aws_security_group" "this_name_prefix" {
                  ~ egress                 = [
                      + {
                          + cidr_blocks      = [
                              + "0.0.0.0/0",
                            ]
                          + description      = "All protocols"
                          + from_port        = 0
                          + ipv6_cidr_blocks = [
                              + "::/0",
                            ]
                          + prefix_list_ids  = []
                          + protocol         = "-1"
                          + security_groups  = []
                          + self             = false
                          + to_port          = 0
                        },
                    ]
                    id                     = "sg-0ce87981bfe71c6b3"
                  ~ ingress                = [
                      + {
                          + cidr_blocks      = [
                              + "0.0.0.0/0",
                            ]
                          + description      = "HTTP"
                          + from_port        = 80
                          + ipv6_cidr_blocks = []
                          + prefix_list_ids  = []
                          + protocol         = "tcp"
                          + security_groups  = []
                          + self             = false
                          + to_port          = 80
                        },
                      + {
                          + cidr_blocks      = [
                              + "0.0.0.0/0",
                            ]
                          + description      = "HTTPS"
                          + from_port        = 443
                          + ipv6_cidr_blocks = []
                          + prefix_list_ids  = []
                          + protocol         = "tcp"
                          + security_groups  = []
                          + self             = false
                          + to_port          = 443
                        },
                      + {
                          + cidr_blocks      = [
                              + "0.0.0.0/0",
                            ]
                          + description      = "SSH"
                          + from_port        = 22
                          + ipv6_cidr_blocks = []
                          + prefix_list_ids  = []
                          + protocol         = "tcp"
                          + security_groups  = []
                          + self             = false
                          + to_port          = 22
                        },
                    ]
                    name                   = "ec2-sg-20220125172404459400000001"
                    tags                   = {
                        "Environment"      = "staging"
                        "Name"             = "ec2-sg"
                        "Project"          = "kuve"
                        "TerraformManaged" = "true"
                    }
                    # (7 unchanged attributes hidden)
            
                    # (1 unchanged block hidden)
                }
            
              # module.sg.module.ec2_sg.aws_security_group_rule.egress_rules[0] has changed
              ~ resource "aws_security_group_rule" "egress_rules" {
                  ~ from_port         = -1 -> 0
                    id                = "sgrule-1209946816"
                  ~ to_port           = -1 -> 0
                    # (8 unchanged attributes hidden)
                }
            
              # module.sg.module.jenkins_sg.aws_security_group.this_name_prefix[0] has changed
              ~ resource "aws_security_group" "this_name_prefix" {
                  ~ egress                 = [
                      + {
                          + cidr_blocks      = [
                              + "0.0.0.0/0",
                            ]
                          + description      = "All protocols"
                          + from_port        = 0
                          + ipv6_cidr_blocks = [
                              + "::/0",
                            ]
                          + prefix_list_ids  = []
                          + protocol         = "-1"
                          + security_groups  = []
                          + self             = false
                          + to_port          = 0
                        },
                    ]
                    id                     = "sg-0b832df8ab29a25dc"
                  ~ ingress                = [
                      + {
                          + cidr_blocks      = [
                              + "0.0.0.0/0",
                            ]
                          + description      = "HTTP"
                          + from_port        = 8080
                          + ipv6_cidr_blocks = []
                          + prefix_list_ids  = []
                          + protocol         = "tcp"
                          + security_groups  = []
                          + self             = false
                          + to_port          = 8080
                        },
                      + {
                          + cidr_blocks      = [
                              + "0.0.0.0/0",
                            ]
                          + description      = "SSH"
                          + from_port        = 22
                          + ipv6_cidr_blocks = []
                          + prefix_list_ids  = []
                          + protocol         = "tcp"
                          + security_groups  = []
                          + self             = false
                          + to_port          = 22
                        },
                    ]
                    name                   = "jenkins-sg-20220125172404459700000002"
                    tags                   = {
                        "Environment"      = "staging"
                        "Name"             = "jenkins-sg"
                        "Project"          = "kuve"
                        "TerraformManaged" = "true"
                    }
                    # (7 unchanged attributes hidden)
            
                    # (1 unchanged block hidden)
                }
            
              # module.sg.module.jenkins_sg.aws_security_group_rule.egress_rules[0] has changed
              ~ resource "aws_security_group_rule" "egress_rules" {
                  ~ from_port         = -1 -> 0
                    id                = "sgrule-772365271"
                  ~ to_port           = -1 -> 0
                    # (8 unchanged attributes hidden)
                }
            
              # module.vpc.module.vpc.aws_eip.nat[0] has changed
              ~ resource "aws_eip" "nat" {
                  + association_id       = "eipassoc-03a012bac3f194a26"
                    id                   = "eipalloc-08c066fdf1bdcbada"
                  + network_interface    = "eni-031b0635c4a0c8474"
                  + private_dns          = "ip-10-0-1-195.ap-northeast-2.compute.internal"
                  + private_ip           = "10.0.1.195"
                    tags                 = {
                        "Name" = "kuve-ap-northeast-2c"
                    }
                    # (8 unchanged attributes hidden)
                }
            
              # module.vpc.module.vpc.aws_route_table.private[0] has changed
              ~ resource "aws_route_table" "private" {
                    id               = "rtb-0f3f07d974d976257"
                  ~ route            = [
                      + {
                          + carrier_gateway_id         = ""
                          + cidr_block                 = "0.0.0.0/0"
                          + destination_prefix_list_id = ""
                          + egress_only_gateway_id     = ""
                          + gateway_id                 = ""
                          + instance_id                = ""
                          + ipv6_cidr_block            = ""
                          + local_gateway_id           = ""
                          + nat_gateway_id             = "nat-07b4f6b424a7677b2"
                          + network_interface_id       = ""
                          + transit_gateway_id         = ""
                          + vpc_endpoint_id            = ""
                          + vpc_peering_connection_id  = ""
                        },
                    ]
                    tags             = {
                        "Name" = "kuve-private"
                    }
                    # (5 unchanged attributes hidden)
                }
            
              # module.vpc.module.vpc.aws_route_table.public[0] has changed
              ~ resource "aws_route_table" "public" {
                    id               = "rtb-0ee6beb8caacbe037"
                  ~ route            = [
                      + {
                          + carrier_gateway_id         = ""
                          + cidr_block                 = "0.0.0.0/0"
                          + destination_prefix_list_id = ""
                          + egress_only_gateway_id     = ""
                          + gateway_id                 = "igw-04b2ada376bc10cc6"
                          + instance_id                = ""
                          + ipv6_cidr_block            = ""
                          + local_gateway_id           = ""
                          + nat_gateway_id             = ""
                          + network_interface_id       = ""
                          + transit_gateway_id         = ""
                          + vpc_endpoint_id            = ""
                          + vpc_peering_connection_id  = ""
                        },
                    ]
                    tags             = {
                        "Name" = "kuve-public"
                    }
                    # (5 unchanged attributes hidden)
                }
            
              # module.bastion_server.module.bastion.module.security_group.aws_security_group.default[0] has changed
              ~ resource "aws_security_group" "default" {
                  ~ egress                 = [
                      + {
                          + cidr_blocks      = [
                              + "0.0.0.0/0",
                            ]
                          + description      = "Managed by Terraform"
                          + from_port        = 0
                          + ipv6_cidr_blocks = []
                          + prefix_list_ids  = []
                          + protocol         = "-1"
                          + security_groups  = []
                          + self             = false
                          + to_port          = 0
                        },
                    ]
                    id                     = "sg-076f775e0b8f3dfe1"
                  ~ ingress                = [
                      + {
                          + cidr_blocks      = [
                              + "0.0.0.0/0",
                            ]
                          + description      = "Managed by Terraform"
                          + from_port        = 22
                          + ipv6_cidr_blocks = []
                          + prefix_list_ids  = []
                          + protocol         = "tcp"
                          + security_groups  = []
                          + self             = false
                          + to_port          = 22
                        },
                    ]
                    name                   = "bastion"
                    tags                   = {
                        "Environment"      = "staging"
                        "Name"             = "bastion"
                        "Project"          = "kuve"
                        "TerraformManaged" = "true"
                    }
                    # (6 unchanged attributes hidden)
                }
            
              # module.bastion_server.module.bastion.module.security_group.aws_security_group_rule.default["egress--1-0-0-cbd201ed3b6029e1f305a433350cb74e"] has changed
              ~ resource "aws_security_group_rule" "default" {
                    id                = "sgrule-761155502"
                  + ipv6_cidr_blocks  = []
                  + prefix_list_ids   = []
                    # (8 unchanged attributes hidden)
                }
            
              # module.bastion_server.module.bastion.module.security_group.aws_security_group_rule.default["ingress-tcp-22-22-ad14e77285fa34d18138f3cb8ab6043c"] has changed
              ~ resource "aws_security_group_rule" "default" {
                    id                = "sgrule-1327000466"
                  + ipv6_cidr_blocks  = []
                  + prefix_list_ids   = []
                    # (8 unchanged attributes hidden)
                }
            
            
            Unless you have made equivalent changes to your configuration, or ignored the relevant attributes using ignore_changes, the following
            plan may include actions to undo or respond to these changes.
            
            ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
            
            No changes. Your infrastructure matches the configuration.
            
    
  • eip 두개 생성

Solution

리소스간 먼저 생성되어야 하는 순서를 파악하자

시도 예정

  • depends_on 사용

Reference

테스트 추가

  • 촘촘한 테스트
    • 테스트 커버리지 높히기
  • dummy data

Jenkins 고도화

AS-IS

  1. Installed in EC2

TO-BE

  1. Dind or Dood
  2. agent 설정 및 master/slave 분리

접근 제한 및 보안 강화

AS-IS

  1. vue bucket incryption 없음
  2. cors 설정 현재 다 열려있음
  3. api alb 통해서 접근 바로 됨

TO-BE

  1. kms encryption 붙이기
  2. cors front에서 주는 요청으로 제한(s3 및 cloudfront)
  3. front resource만 가능하게 sg 설정

cloutfront 붙이기

AS-IS

s3로 바로 요청이 감

TO-BE

cloudfront에서 s3로 요청이 가도록

jwt 추출 변경

AS-IS

func ExtractTokenMetadata(c *fiber.Ctx) (*TokenMetadata, error) { 함수에서 token을 추출 하고 있다.

TO-BE

func JWTProtected() func(*fiber.Ctx) error { 에서
jwtware.New(config ...jwtware.Config) func(*fiber.Ctx) error 를 사용하고 있기 때문에
Locals에서 뽑을 수가 있다.

user := c.Locals("user").(*jwt.Token)
claims := user.Claims.(jwt.MapClaims)
name := claims["name"].(string)

Reference

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.