private createService()

in lib/proxy.ts [41:77]


    private createService(): ecsPatterns.NetworkLoadBalancedFargateService {
        let dockerImage = new DockerImageAsset(this, 'ProxyDockerImage', {
            directory: "proxy"
        });

        let service = new ecsPatterns.NetworkLoadBalancedFargateService(this, 'ProxyService', {
            cluster: this.cluster,
            listenerPort: 443,
            cpu: 256,
            memoryLimitMiB: 512,
            healthCheckGracePeriod: cdk.Duration.seconds(10),
            taskImageOptions: {
                image: ecs.ContainerImage.fromDockerImageAsset(dockerImage),
                containerPort: 443,
                environment: {
                    "VERSION": this.props.apis.version,
                    "COMMON_API": this.props.apis.getUrl(this.props.apis.commonsApi),
                    "CHANNELS_API": this.props.apis.getUrl(this.props.apis.channelsApi),
                    "PRODUCTS_SERVICES_API": this.props.apis.getUrl(this.props.apis.productsServicesApi),
                    "ADMIN_API": this.props.apis.getUrl(this.props.apis.adminApi)
                }
            }
        });

        service.targetGroup.configureHealthCheck({
            path: "/health",
            port: "80",
            protocol: Protocol.HTTP
        });

        service.targetGroup.setAttribute('deregistration_delay.timeout_seconds', '0');
        
        service.service.connections.allowFromAnyIpv4(ec2.Port.tcp(443));
        service.service.connections.allowFrom(ec2.Peer.ipv4(this.props.networking.vpc.vpcCidrBlock), ec2.Port.tcp(80));

        return service;
    }