Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Added IDENTITY_NETWORK_HOST for AWS template

Michal Rutka495acef28374
diff --git a/gitlab-ci/README.md b/gitlab-ci/README.md
new file mode 100644
index 000000000..7fa4a0fe8
--- /dev/null
+++ b/gitlab-ci/README.md
@@ -0,0 +1,77 @@
+# Deploing OpenRemote stack
+
+## Deployment on AWS
+
+We will use the [AWS CLI](https://aws.amazon.com/cli/) to create the necessary resources on AWS side.
+Following commands should be executed from openremote/gitlab-ci subdirectory.
+
+### Prepare the environment
+
+You will need to do this only once per AWS account.
+
+Enter the following commands in your terminal:
+
+```bash
+# Configure the AWS CLI with your AWS region (supported eu-west-1<Ireland>)
+aws configure
+
+# Create SSH keys (it's a pity but AWS EC2 does not accept other type than rsa keys here)
+ssh-keygen -f openremote -t rsa -b 4096 -C "[email protected]"
+
+# Import key pair to AWS
+aws ec2 import-key-pair --key-name openremote --public-key-material fileb://openremote.pub
+
+```
+
+### Deploy EC2 instance with Openremote stack
+
+After this command it will take some time till the stack is created and initialized (about 10-30 mins).
+
+```bash
+# Create stack
+aws cloudformation create-stack --stack-name openremote --template-body file://aws-cloudformation.template.yml
+
+# Get stack endpoint
+aws cloudformation describe-stacks --stack-name openremote --query "Stacks[0].Outputs[?OutputKey=='InstanceIP'].OutputValue" --output text
+export OR_ENDPOINT=$(aws cloudformation describe-stacks --stack-name openremote --query "Stacks[0].Outputs[?OutputKey=='InstanceIP'].OutputValue" --output text)
+```
+
+Now you should be able to access the openremote v3 server at the URL $OR_ENDPOINT environment variable.
+
+### Assing custom domain to the endpoint
+
+TODO
+
+### Test the deployment (optional)
+
+```bash
+curl --insecure -L https://$OR_ENDPOINT/api/master/model/asset/descriptors
+```
+
+### Add/remove assets (optional)
+
+TODO
+
+### Delete EC2 instance
+
+The openremote stack costs money. You can delete is with
+
+```bash
+aws cloudformation delete-stack --stack-name openremote
+```
+
+## Deployment on Alibaba
+
+TODO
+
+## Deployment on Azure
+
+TODO
+
+## Deployment on GCP
+
+TODO
+
+## Deployment on OVH
+
+TODO
diff --git a/gitlab-ci/aws-cloudformation.template.yml b/gitlab-ci/aws-cloudformation.template.yml
index c3fa47213..d2eb6c6d4 100644
--- a/gitlab-ci/aws-cloudformation.template.yml
+++ b/gitlab-ci/aws-cloudformation.template.yml
@@ -18,10 +18,12 @@ Parameters:
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
@@ -42,7 +44,7 @@ Resources:
#!/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
+ IDENTITY_NETWORK_HOST=$(curl http://169.254.169.254/latest/meta-data/public-ipv4) docker stack deploy --compose-file swarm-docker-compose.yml openremote
InstanceSecurityGroup:
Type: AWS::EC2::SecurityGroup