100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Added AWS cloudformation template
Michal Rutka69c933aef3fa
diff --git a/.gitlab-ci.yml b/.gitlab-ci.ymlindex b352ed2f7..a5e191e5d 100644--- a/.gitlab-ci.yml+++ b/.gitlab-ci.yml@@ -11,6 +11,7 @@ stages:- test- deploy- dast+ - cleanuplint-Dockerfile:stage: build@@ -86,7 +87,7 @@ email failed pipeline:-e "REPO=$REPO"-e "SMTP_USERNAME=$SMTP_USERNAME"-e "SMTP_PASSWORD=$SMTP_PASSWORD"- --rm python:3 python deployment/aws-mail.py+ --rm python:3 python gitlab-ci/aws-mail.pywhen: on_failureonly:- master@@ -108,8 +109,26 @@ test-master:- masterdeploy-master:+ image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:lateststage: deployscript:- - echo Continous deploy TODO+ - aws cloudformation create-stack --stack-name $AWS_STACK_NAME --template-body file://gitlab-ci/aws-cloudformation.template.yml+ after_script:+ - aws cloudformation wait stack-create-complete --stack-name $AWS_STACK_NAME+ - aws cloudformation describe-stacks --stack-name $AWS_STACK_NAME+ allow_failure: true # set when:manual optional and not blocking+ when: manualonly:- - master\ No newline at end of file+ - master++delete aws cloudformation stack:+ image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest+ stage: cleanup+ script:+ - aws cloudformation delete-stack --stack-name $AWS_STACK_NAME+ - aws cloudformation wait stack-delete-complete --stack-name $AWS_STACK_NAME+ allow_failure: true # set when:manual optional and not blocking+ rules:+ - when: delayed+ start_in: '8 hours'+ - when: manualdiff --git a/gitlab-ci/aws-cloudformation.template.yml b/gitlab-ci/aws-cloudformation.template.ymlnew file mode 100644index 000000000..c3fa47213--- /dev/null+++ b/gitlab-ci/aws-cloudformation.template.yml@@ -0,0 +1,63 @@+---+AWSTemplateFormatVersion: '2010-09-09'+Description: 'Template to install OpenRemote 3 stack on AWS environment including CloudWatchAgent memory on ubuntu'+Parameters:+ KeyName:+ Description: Name of an existing EC2 KeyPair to enable SSH access to the instance+ Type: AWS::EC2::KeyPair::KeyName+ Default: openremote+ ConstraintDescription: must be the name of an existing EC2 KeyPair.+ InstanceType:+ Description: EC2 instance type+ Type: String+ # AWS Compute Optimizer reports that this instance type is under-provisioned and advise to use+ # more than double the price instance. However, it works in our test setup.+ Default: t3a.medium+ ConstraintDescription: must be a valid EC2 instance type.+ InstanceAMI:+ Description: Managed AMI ID for EC2 Instance+ Type : String+ Default: ami-021696e054a27b3e8+Outputs:+ InstanceIP:+ Description: The Instance public IP+ Value: !GetAtt EC2Instance.PublicIp+Resources:+ EC2Instance:+ Type: AWS::EC2::Instance+ Properties:+ InstanceType:+ Ref: InstanceType+ KeyName:+ Ref: KeyName+ ImageId:+ Ref: InstanceAMI+ SecurityGroups:+ - Ref: InstanceSecurityGroup+ Tags:+ - Key: "Name"+ Value: "Openremote v3"+ UserData:+ Fn::Base64: !Sub |+ #!/bin/bash+ wget https://github.com/openremote/openremote/raw/master/swarm/swarm-docker-compose.yml+ docker swarm init+ docker stack deploy --compose-file swarm-docker-compose.yml openremote++ InstanceSecurityGroup:+ Type: AWS::EC2::SecurityGroup+ Properties:+ GroupDescription: OR manager ports + SSH+ SecurityGroupIngress:+ - IpProtocol: tcp+ FromPort: '22'+ ToPort: '22'+ CidrIp: 0.0.0.0/0+ - IpProtocol: tcp+ FromPort: '80'+ ToPort: '80'+ CidrIp: 0.0.0.0/0+ - IpProtocol: tcp+ FromPort: '443'+ ToPort: '443'+ CidrIp: 0.0.0.0/0diff --git a/deployment/aws-mail.py b/gitlab-ci/aws-mail.pysimilarity index 100%rename from deployment/aws-mail.pyrename to gitlab-ci/aws-mail.py