diff --git a/.gitignore b/.gitignore index d16dcd4..4c3f589 100644 --- a/.gitignore +++ b/.gitignore @@ -5,20 +5,20 @@ # git config --global core.excludesfile '~/.gitignore_global' # Ignore bundler config. -/.bundle +application/.bundle # Ignore all logfiles and tempfiles. -/log/* -/tmp/* -!/log/.keep -!/tmp/.keep +application/log/* +application/tmp/* +!application/log/.keep +!application/tmp/.keep # Ignore Byebug command history file. .byebug_history -config/settings.local.yml -config/settings/*.local.yml -config/environments/*.local.yml +application/config/settings.local.yml +application/config/settings/*.local.yml +application/config/environments/*.local.yml # Ignore envrc /.envrc diff --git a/.rspec b/application/.rspec similarity index 100% rename from .rspec rename to application/.rspec diff --git a/.ruby-version b/application/.ruby-version similarity index 100% rename from .ruby-version rename to application/.ruby-version diff --git a/Gemfile b/application/Gemfile similarity index 100% rename from Gemfile rename to application/Gemfile diff --git a/Gemfile.lock b/application/Gemfile.lock similarity index 100% rename from Gemfile.lock rename to application/Gemfile.lock diff --git a/Rakefile b/application/Rakefile similarity index 100% rename from Rakefile rename to application/Rakefile diff --git a/app/assets/config/manifest.js b/application/app/assets/config/manifest.js similarity index 100% rename from app/assets/config/manifest.js rename to application/app/assets/config/manifest.js diff --git a/app/assets/images/.keep b/application/app/assets/images/.keep similarity index 100% rename from app/assets/images/.keep rename to application/app/assets/images/.keep diff --git a/app/assets/javascripts/application.js b/application/app/assets/javascripts/application.js similarity index 100% rename from app/assets/javascripts/application.js rename to application/app/assets/javascripts/application.js diff --git a/app/assets/javascripts/cable.js b/application/app/assets/javascripts/cable.js similarity index 100% rename from app/assets/javascripts/cable.js rename to application/app/assets/javascripts/cable.js diff --git a/app/assets/javascripts/channels/.keep b/application/app/assets/javascripts/channels/.keep similarity index 100% rename from app/assets/javascripts/channels/.keep rename to application/app/assets/javascripts/channels/.keep diff --git a/app/assets/stylesheets/application.css b/application/app/assets/stylesheets/application.css similarity index 100% rename from app/assets/stylesheets/application.css rename to application/app/assets/stylesheets/application.css diff --git a/app/channels/application_cable/channel.rb b/application/app/channels/application_cable/channel.rb similarity index 100% rename from app/channels/application_cable/channel.rb rename to application/app/channels/application_cable/channel.rb diff --git a/app/channels/application_cable/connection.rb b/application/app/channels/application_cable/connection.rb similarity index 100% rename from app/channels/application_cable/connection.rb rename to application/app/channels/application_cable/connection.rb diff --git a/app/controllers/api/application_controller.rb b/application/app/controllers/api/application_controller.rb similarity index 100% rename from app/controllers/api/application_controller.rb rename to application/app/controllers/api/application_controller.rb diff --git a/app/controllers/api/webhooks_controller.rb b/application/app/controllers/api/webhooks_controller.rb similarity index 100% rename from app/controllers/api/webhooks_controller.rb rename to application/app/controllers/api/webhooks_controller.rb diff --git a/app/controllers/application_controller.rb b/application/app/controllers/application_controller.rb similarity index 100% rename from app/controllers/application_controller.rb rename to application/app/controllers/application_controller.rb diff --git a/app/controllers/concerns/.keep b/application/app/controllers/concerns/.keep similarity index 100% rename from app/controllers/concerns/.keep rename to application/app/controllers/concerns/.keep diff --git a/app/helpers/application_helper.rb b/application/app/helpers/application_helper.rb similarity index 100% rename from app/helpers/application_helper.rb rename to application/app/helpers/application_helper.rb diff --git a/app/jobs/application_job.rb b/application/app/jobs/application_job.rb similarity index 100% rename from app/jobs/application_job.rb rename to application/app/jobs/application_job.rb diff --git a/app/mailers/application_mailer.rb b/application/app/mailers/application_mailer.rb similarity index 100% rename from app/mailers/application_mailer.rb rename to application/app/mailers/application_mailer.rb diff --git a/app/models/application_record.rb b/application/app/models/application_record.rb similarity index 100% rename from app/models/application_record.rb rename to application/app/models/application_record.rb diff --git a/app/models/concerns/.keep b/application/app/models/concerns/.keep similarity index 100% rename from app/models/concerns/.keep rename to application/app/models/concerns/.keep diff --git a/app/models/concerns/aws_accessible.rb b/application/app/models/concerns/aws_accessible.rb similarity index 100% rename from app/models/concerns/aws_accessible.rb rename to application/app/models/concerns/aws_accessible.rb diff --git a/app/models/ecr/iam_group.rb b/application/app/models/ecr/iam_group.rb similarity index 100% rename from app/models/ecr/iam_group.rb rename to application/app/models/ecr/iam_group.rb diff --git a/app/models/ecr/iam_user.rb b/application/app/models/ecr/iam_user.rb similarity index 100% rename from app/models/ecr/iam_user.rb rename to application/app/models/ecr/iam_user.rb diff --git a/app/models/ecr/repository.rb b/application/app/models/ecr/repository.rb similarity index 100% rename from app/models/ecr/repository.rb rename to application/app/models/ecr/repository.rb diff --git a/app/models/endpoint.rb b/application/app/models/endpoint.rb similarity index 100% rename from app/models/endpoint.rb rename to application/app/models/endpoint.rb diff --git a/app/models/pull_request/actions.rb b/application/app/models/pull_request/actions.rb similarity index 100% rename from app/models/pull_request/actions.rb rename to application/app/models/pull_request/actions.rb diff --git a/app/models/pull_request/actions/close.rb b/application/app/models/pull_request/actions/close.rb similarity index 100% rename from app/models/pull_request/actions/close.rb rename to application/app/models/pull_request/actions/close.rb diff --git a/app/models/pull_request/actions/open.rb b/application/app/models/pull_request/actions/open.rb similarity index 100% rename from app/models/pull_request/actions/open.rb rename to application/app/models/pull_request/actions/open.rb diff --git a/app/models/pull_request/actions/synchronized.rb b/application/app/models/pull_request/actions/synchronized.rb similarity index 100% rename from app/models/pull_request/actions/synchronized.rb rename to application/app/models/pull_request/actions/synchronized.rb diff --git a/app/models/pull_request/comment.rb b/application/app/models/pull_request/comment.rb similarity index 100% rename from app/models/pull_request/comment.rb rename to application/app/models/pull_request/comment.rb diff --git a/app/models/pull_request/payload.rb b/application/app/models/pull_request/payload.rb similarity index 100% rename from app/models/pull_request/payload.rb rename to application/app/models/pull_request/payload.rb diff --git a/app/models/revieee_target.rb b/application/app/models/revieee_target.rb similarity index 100% rename from app/models/revieee_target.rb rename to application/app/models/revieee_target.rb diff --git a/app/models/spot_fleet_request/client.rb b/application/app/models/spot_fleet_request/client.rb similarity index 100% rename from app/models/spot_fleet_request/client.rb rename to application/app/models/spot_fleet_request/client.rb diff --git a/app/models/spot_fleet_request/request_config.rb b/application/app/models/spot_fleet_request/request_config.rb similarity index 100% rename from app/models/spot_fleet_request/request_config.rb rename to application/app/models/spot_fleet_request/request_config.rb diff --git a/app/models/spot_fleet_request/spot_instance.rb b/application/app/models/spot_fleet_request/spot_instance.rb similarity index 100% rename from app/models/spot_fleet_request/spot_instance.rb rename to application/app/models/spot_fleet_request/spot_instance.rb diff --git a/app/models/task.rb b/application/app/models/task.rb similarity index 100% rename from app/models/task.rb rename to application/app/models/task.rb diff --git a/app/models/task_definition.rb b/application/app/models/task_definition.rb similarity index 100% rename from app/models/task_definition.rb rename to application/app/models/task_definition.rb diff --git a/app/models/task_definition_loader.rb b/application/app/models/task_definition_loader.rb similarity index 100% rename from app/models/task_definition_loader.rb rename to application/app/models/task_definition_loader.rb diff --git a/app/views/layouts/application.html.erb b/application/app/views/layouts/application.html.erb similarity index 100% rename from app/views/layouts/application.html.erb rename to application/app/views/layouts/application.html.erb diff --git a/app/views/layouts/mailer.html.erb b/application/app/views/layouts/mailer.html.erb similarity index 100% rename from app/views/layouts/mailer.html.erb rename to application/app/views/layouts/mailer.html.erb diff --git a/app/views/layouts/mailer.text.erb b/application/app/views/layouts/mailer.text.erb similarity index 100% rename from app/views/layouts/mailer.text.erb rename to application/app/views/layouts/mailer.text.erb diff --git a/bin/bundle b/application/bin/bundle similarity index 100% rename from bin/bundle rename to application/bin/bundle diff --git a/bin/rails b/application/bin/rails similarity index 100% rename from bin/rails rename to application/bin/rails diff --git a/bin/rake b/application/bin/rake similarity index 100% rename from bin/rake rename to application/bin/rake diff --git a/bin/setup b/application/bin/setup similarity index 100% rename from bin/setup rename to application/bin/setup diff --git a/bin/update b/application/bin/update similarity index 100% rename from bin/update rename to application/bin/update diff --git a/config.ru b/application/config.ru similarity index 100% rename from config.ru rename to application/config.ru diff --git a/config/application.rb b/application/config/application.rb similarity index 100% rename from config/application.rb rename to application/config/application.rb diff --git a/config/boot.rb b/application/config/boot.rb similarity index 100% rename from config/boot.rb rename to application/config/boot.rb diff --git a/config/cable.yml b/application/config/cable.yml similarity index 100% rename from config/cable.yml rename to application/config/cable.yml diff --git a/config/database.yml b/application/config/database.yml similarity index 100% rename from config/database.yml rename to application/config/database.yml diff --git a/config/environment.rb b/application/config/environment.rb similarity index 100% rename from config/environment.rb rename to application/config/environment.rb diff --git a/config/environments/development.rb b/application/config/environments/development.rb similarity index 100% rename from config/environments/development.rb rename to application/config/environments/development.rb diff --git a/config/environments/production.rb b/application/config/environments/production.rb similarity index 100% rename from config/environments/production.rb rename to application/config/environments/production.rb diff --git a/config/environments/test.rb b/application/config/environments/test.rb similarity index 100% rename from config/environments/test.rb rename to application/config/environments/test.rb diff --git a/config/initializers/application_controller_renderer.rb b/application/config/initializers/application_controller_renderer.rb similarity index 100% rename from config/initializers/application_controller_renderer.rb rename to application/config/initializers/application_controller_renderer.rb diff --git a/config/initializers/assets.rb b/application/config/initializers/assets.rb similarity index 100% rename from config/initializers/assets.rb rename to application/config/initializers/assets.rb diff --git a/config/initializers/backtrace_silencers.rb b/application/config/initializers/backtrace_silencers.rb similarity index 100% rename from config/initializers/backtrace_silencers.rb rename to application/config/initializers/backtrace_silencers.rb diff --git a/config/initializers/config.rb b/application/config/initializers/config.rb similarity index 100% rename from config/initializers/config.rb rename to application/config/initializers/config.rb diff --git a/config/initializers/cookies_serializer.rb b/application/config/initializers/cookies_serializer.rb similarity index 100% rename from config/initializers/cookies_serializer.rb rename to application/config/initializers/cookies_serializer.rb diff --git a/config/initializers/filter_parameter_logging.rb b/application/config/initializers/filter_parameter_logging.rb similarity index 100% rename from config/initializers/filter_parameter_logging.rb rename to application/config/initializers/filter_parameter_logging.rb diff --git a/config/initializers/inflections.rb b/application/config/initializers/inflections.rb similarity index 100% rename from config/initializers/inflections.rb rename to application/config/initializers/inflections.rb diff --git a/config/initializers/mime_types.rb b/application/config/initializers/mime_types.rb similarity index 100% rename from config/initializers/mime_types.rb rename to application/config/initializers/mime_types.rb diff --git a/config/initializers/new_framework_defaults.rb b/application/config/initializers/new_framework_defaults.rb similarity index 100% rename from config/initializers/new_framework_defaults.rb rename to application/config/initializers/new_framework_defaults.rb diff --git a/config/initializers/session_store.rb b/application/config/initializers/session_store.rb similarity index 100% rename from config/initializers/session_store.rb rename to application/config/initializers/session_store.rb diff --git a/config/initializers/wrap_parameters.rb b/application/config/initializers/wrap_parameters.rb similarity index 100% rename from config/initializers/wrap_parameters.rb rename to application/config/initializers/wrap_parameters.rb diff --git a/config/locales/en.yml b/application/config/locales/en.yml similarity index 100% rename from config/locales/en.yml rename to application/config/locales/en.yml diff --git a/config/puma.rb b/application/config/puma.rb similarity index 100% rename from config/puma.rb rename to application/config/puma.rb diff --git a/config/routes.rb b/application/config/routes.rb similarity index 100% rename from config/routes.rb rename to application/config/routes.rb diff --git a/config/secrets.yml b/application/config/secrets.yml similarity index 100% rename from config/secrets.yml rename to application/config/secrets.yml diff --git a/config/settings.local.yml.sample b/application/config/settings.local.yml.sample similarity index 100% rename from config/settings.local.yml.sample rename to application/config/settings.local.yml.sample diff --git a/config/settings.yml b/application/config/settings.yml similarity index 100% rename from config/settings.yml rename to application/config/settings.yml diff --git a/config/settings/development.yml b/application/config/settings/development.yml similarity index 100% rename from config/settings/development.yml rename to application/config/settings/development.yml diff --git a/config/settings/production.yml b/application/config/settings/production.yml similarity index 100% rename from config/settings/production.yml rename to application/config/settings/production.yml diff --git a/config/settings/test.yml b/application/config/settings/test.yml similarity index 100% rename from config/settings/test.yml rename to application/config/settings/test.yml diff --git a/config/spring.rb b/application/config/spring.rb similarity index 100% rename from config/spring.rb rename to application/config/spring.rb diff --git a/db/migrate/20170201065127_create_tasks.rb b/application/db/migrate/20170201065127_create_tasks.rb similarity index 100% rename from db/migrate/20170201065127_create_tasks.rb rename to application/db/migrate/20170201065127_create_tasks.rb diff --git a/db/migrate/20170201065237_create_endpoints.rb b/application/db/migrate/20170201065237_create_endpoints.rb similarity index 100% rename from db/migrate/20170201065237_create_endpoints.rb rename to application/db/migrate/20170201065237_create_endpoints.rb diff --git a/db/migrate/20170222095544_create_task_definitions.rb b/application/db/migrate/20170222095544_create_task_definitions.rb similarity index 100% rename from db/migrate/20170222095544_create_task_definitions.rb rename to application/db/migrate/20170222095544_create_task_definitions.rb diff --git a/db/migrate/20170222112917_add_task_definition_id_to_and_remove_repository_from_tasks.rb b/application/db/migrate/20170222112917_add_task_definition_id_to_and_remove_repository_from_tasks.rb similarity index 100% rename from db/migrate/20170222112917_add_task_definition_id_to_and_remove_repository_from_tasks.rb rename to application/db/migrate/20170222112917_add_task_definition_id_to_and_remove_repository_from_tasks.rb diff --git a/db/schema.rb b/application/db/schema.rb similarity index 100% rename from db/schema.rb rename to application/db/schema.rb diff --git a/db/seeds.rb b/application/db/seeds.rb similarity index 100% rename from db/seeds.rb rename to application/db/seeds.rb diff --git a/lib/assets/.keep b/application/lib/assets/.keep similarity index 100% rename from lib/assets/.keep rename to application/lib/assets/.keep diff --git a/lib/tasks/.keep b/application/lib/tasks/.keep similarity index 100% rename from lib/tasks/.keep rename to application/lib/tasks/.keep diff --git a/lib/tasks/ecr.rake b/application/lib/tasks/ecr.rake similarity index 100% rename from lib/tasks/ecr.rake rename to application/lib/tasks/ecr.rake diff --git a/lib/tasks/spot_fleet_request.rake b/application/lib/tasks/spot_fleet_request.rake similarity index 100% rename from lib/tasks/spot_fleet_request.rake rename to application/lib/tasks/spot_fleet_request.rake diff --git a/log/.keep b/application/log/.keep similarity index 100% rename from log/.keep rename to application/log/.keep diff --git a/public/404.html b/application/public/404.html similarity index 100% rename from public/404.html rename to application/public/404.html diff --git a/public/422.html b/application/public/422.html similarity index 100% rename from public/422.html rename to application/public/422.html diff --git a/public/500.html b/application/public/500.html similarity index 100% rename from public/500.html rename to application/public/500.html diff --git a/public/apple-touch-icon-precomposed.png b/application/public/apple-touch-icon-precomposed.png similarity index 100% rename from public/apple-touch-icon-precomposed.png rename to application/public/apple-touch-icon-precomposed.png diff --git a/public/apple-touch-icon.png b/application/public/apple-touch-icon.png similarity index 100% rename from public/apple-touch-icon.png rename to application/public/apple-touch-icon.png diff --git a/public/favicon.ico b/application/public/favicon.ico similarity index 100% rename from public/favicon.ico rename to application/public/favicon.ico diff --git a/public/robots.txt b/application/public/robots.txt similarity index 100% rename from public/robots.txt rename to application/public/robots.txt diff --git a/spec/controllers/api/webhooks_controller_spec.rb b/application/spec/controllers/api/webhooks_controller_spec.rb similarity index 100% rename from spec/controllers/api/webhooks_controller_spec.rb rename to application/spec/controllers/api/webhooks_controller_spec.rb diff --git a/spec/factories/task_definitions.rb b/application/spec/factories/task_definitions.rb similarity index 100% rename from spec/factories/task_definitions.rb rename to application/spec/factories/task_definitions.rb diff --git a/spec/models/spot_instance_spec.rb b/application/spec/models/spot_instance_spec.rb similarity index 100% rename from spec/models/spot_instance_spec.rb rename to application/spec/models/spot_instance_spec.rb diff --git a/spec/models/task_definition_loader_spec.rb b/application/spec/models/task_definition_loader_spec.rb similarity index 100% rename from spec/models/task_definition_loader_spec.rb rename to application/spec/models/task_definition_loader_spec.rb diff --git a/spec/models/task_definition_spec.rb b/application/spec/models/task_definition_spec.rb similarity index 100% rename from spec/models/task_definition_spec.rb rename to application/spec/models/task_definition_spec.rb diff --git a/spec/rails_helper.rb b/application/spec/rails_helper.rb similarity index 100% rename from spec/rails_helper.rb rename to application/spec/rails_helper.rb diff --git a/spec/spec_helper.rb b/application/spec/spec_helper.rb similarity index 100% rename from spec/spec_helper.rb rename to application/spec/spec_helper.rb diff --git a/spec/support/factory_girl.rb b/application/spec/support/factory_girl.rb similarity index 100% rename from spec/support/factory_girl.rb rename to application/spec/support/factory_girl.rb diff --git a/tmp/.keep b/application/tmp/.keep similarity index 100% rename from tmp/.keep rename to application/tmp/.keep diff --git a/vendor/assets/javascripts/.keep b/application/tmp/restart.txt similarity index 100% rename from vendor/assets/javascripts/.keep rename to application/tmp/restart.txt diff --git a/vendor/assets/stylesheets/.keep b/application/vendor/assets/javascripts/.keep similarity index 100% rename from vendor/assets/stylesheets/.keep rename to application/vendor/assets/javascripts/.keep diff --git a/infrastructure/cloudformation.yml b/infrastructure/cloudformation.yml new file mode 100644 index 0000000..a6ab1ed --- /dev/null +++ b/infrastructure/cloudformation.yml @@ -0,0 +1,219 @@ +AWSTemplateFormatVersion: "2010-09-09" +Description: revieee development settings +Resources: + +# VPC +## VPC Base + RevieeeVPC: + Type: AWS::EC2::VPC + Properties: + CidrBlock: 10.1.0.0/16 + EnableDnsSupport: "true" + EnableDnsHostnames: "true" + InstanceTenancy: default + Tags: + - Key: Name + Value: RevieeeDevelopmentVPC +## Revieee Internet Gateway + RevieeeIGW: + Type: AWS::EC2::InternetGateway + Properties: + Tags: + - Key: Name + Value: RevieeeIGW +## Attach Internet Gateway To VPC + AttachIGWtoVPC: + Type: AWS::EC2::VPCGatewayAttachment + Properties: + InternetGatewayId: !Ref RevieeeIGW + VpcId: !Ref RevieeeVPC + +# Subnet +## Webhook Server +### Subnet 1a + RevieeeAppSubnet1a: + Type: AWS::EC2::Subnet + Properties: + VpcId: !Ref RevieeeVPC + AvailabilityZone: ap-northeast-1a + CidrBlock: 10.1.192.0/26 + MapPublicIpOnLaunch: true + Tags: + - Key: Name + Value: RevieeeAppSubnet1a +### Subnet 1c + RevieeeAppSubnet1c: + Type: AWS::EC2::Subnet + Properties: + VpcId: !Ref RevieeeVPC + AvailabilityZone: ap-northeast-1c + CidrBlock: 10.1.192.64/26 + MapPublicIpOnLaunch: true + Tags: + - Key: Name + Value: RevieeeAppSubnet1c +## ECS Container Instance +### Subnet1a + ContainerInstanceSubnet1a: + Type: AWS::EC2::Subnet + Properties: + VpcId: !Ref RevieeeVPC + AvailabilityZone: ap-northeast-1a + CidrBlock: 10.1.194.0/26 + MapPublicIpOnLaunch: true + Tags: + - Key: Name + Value: ContainerInstanceSubnet1a +### Subnet1c + ContainerInstanceSubnet1c: + Type: AWS::EC2::Subnet + Properties: + VpcId: !Ref RevieeeVPC + AvailabilityZone: ap-northeast-1c + CidrBlock: 10.1.194.64/26 + MapPublicIpOnLaunch: true + Tags: + - Key: Name + Value: ContainerInstanceSubnet1c +# Route Table +## Public Route Table + PublicRouteTable: + Type: AWS::EC2::RouteTable + Properties: + VpcId: !Ref RevieeeVPC + Tags: + - Key: Name + Value: PublicRouteTable + RouteAddInternet: + Type: AWS::EC2::Route + Properties: + DestinationCidrBlock: "0.0.0.0/0" + GatewayId: !Ref RevieeeIGW + RouteTableId: !Ref PublicRouteTable +### App Server Route Table Association + AssociateAppSubnet1aToPublicRouteTable: + Type: AWS::EC2::SubnetRouteTableAssociation + Properties: + RouteTableId: !Ref PublicRouteTable + SubnetId: !Ref RevieeeAppSubnet1a + AssociateAppSubnet1cToPublicRouteTable: + Type: AWS::EC2::SubnetRouteTableAssociation + Properties: + RouteTableId: !Ref PublicRouteTable + SubnetId: !Ref RevieeeAppSubnet1c +### Container Instance Route Table Association + AssociateContainerInstanceSubnet1aToPublicRouteTable: + Type: AWS::EC2::SubnetRouteTableAssociation + Properties: + RouteTableId: !Ref PublicRouteTable + SubnetId: !Ref ContainerInstanceSubnet1a + AssociateContainerInstanceSubnet1cToPublicRouteTable: + Type: AWS::EC2::SubnetRouteTableAssociation + Properties: + RouteTableId: !Ref PublicRouteTable + SubnetId: !Ref ContainerInstanceSubnet1c + +# SecurityGroup +## AppServer Security Group + RevieeeAppServerSecurityGroup: + Type: AWS::EC2::SecurityGroup + Properties: + VpcId: !Ref RevieeeVPC + GroupDescription: "Security Group for Revieee App Server" + SecurityGroupIngress: + - IpProtocol: tcp + FromPort: 80 + ToPort: 80 + CidrIp: !Ref AcceptCidrIp + - IpProtocol: tcp + FromPort: 443 + ToPort: 443 + CidrIp: !Ref AcceptCidrIp + - IpProtocol: tcp + FromPort: !Ref SSHPort + ToPort: !Ref SSHPort + CidrIp: !Ref AcceptCidrIp + GroupName: !Join [ "-", [ !Ref "AWS::StackName", RevieeeAppServerSecurityGroup ] ] + Tags: + - Key: Name + Value: RevieeeAppServerSecurityGroup + +## ECS Container Instance + ContainerInstanceSecurityGroup: + Type: AWS::EC2::SecurityGroup + Properties: + VpcId: !Ref RevieeeVPC + GroupDescription: "Security Group for Revieee Container Instance" + SecurityGroupIngress: + - IpProtocol: tcp + FromPort: 32768 + ToPort: 61000 + SourceSecurityGroupId: !Ref RevieeeAppServerSecurityGroup + - IpProtocol: tcp + FromPort: !Ref SSHPort + ToPort: !Ref SSHPort + CidrIp: !Ref AcceptCidrIp + GroupName: !Join [ "-", [ !Ref "AWS::StackName", RevieeeContainerInstanceSecurityGroup ] ] + Tags: + - Key: Name + Value: RevieeeContainerInstanceSecurityGroup + + EcsCluster: + Type: AWS::ECS::Cluster + Properties: + ClusterName: !Join [ "-", [ !Ref "AWS::StackName", RevieeeCluster ] ] + + EndpointInstanceIamRole: + Type: AWS::IAM::Role + Properties: + AssumeRolePolicyDocument: + Version: 2012-10-17 + Statement: + - + Effect: Allow + Principal: + Service: + - ec2.amazonaws.com + Action: + - sts:AssumeRole + RoleName: !Join [ "-", [ !Ref "AWS::StackName", RevieeeEndpointInstanceIamRole ] ] + + EndpointInstanceProfile: + Type: AWS::IAM::InstanceProfile + Properties: + Roles: + - !Ref EndpointInstanceIamRole + + EndpointInstance: + Type: AWS::EC2::Instance + Properties: + IamInstanceProfile: !Ref EndpointInstanceProfile + ImageId: ami-923d12f5 + InstanceType: t2.micro + KeyName: !If [ SSHKeySpecified, !Ref SSHKey, !Ref "AWS::NoValue" ] + SecurityGroupIds: + - !GetAtt RevieeeAppServerSecurityGroup.GroupId + SubnetId: !Ref RevieeeAppSubnet1c + Tags: + - Key: Name + Value: RevieeeEndpointInstance + # UserData: [TODO] run itamae + +# Parameter +Parameters: + SSHPort: + Default: 22 + Type: Number + SSHKey: + Default: "" + Type: String + AcceptCidrIp: + Type: String + +Conditions: + SSHKeySpecified: + !Not [ !Equals [ !Ref SSHKey, "" ] ] + +Outputs: + EcsClusterName: + Value: !Ref EcsCluster