Update yml conf in production server AWS-EC2

Hello, first of all congratulations to the developers for the great job they have done.

I uploaded the platform to an AWS domain with EC2, all good with the provided stack. Use or deploy with --dns parameter

When I make for example a change in the jsons of my deployment folder it seems to apply. But now I want to make a change to my mvp-docker-compose.yml

keycloak:
image: openremote/keycloak:${KEYCLOAK_VERSION:-12.0.1.1}
networks:
  - public
  - private
depends_on:
  - postgresql
healthcheck:
  test: ["CMD", "curl", "--fail", "--silent", "http://xxx.es:8080/auth"]
  interval: 3s
  timeout: 3s
  start_period: 60s
  retries: 30
deploy:
  replicas: 1
  update_config:
    failure_action: rollback
    order: start-first
    delay: 10m
volumes:
  - ./deployment:/deployment
environment:
  KEYCLOAK_PASSWORD: ${PASSWORD:-secret}
  KEYCLOAK_FRONTEND_URL: "https://${IDENTITY_NETWORK_HOST:-myiot.es}/auth"

I have changed my volume from keycloack to custom folder - ./deployment:/deployment
How could I indicate to the platform that there is a change in this yml?
Downloading the docker containers doesn’t seem to work. I want to apply the change without affecting the data.

Thank you very much and I reiterate the congratulations

1 Like

Congratulations for finding openremote-cli, this is my personal small project to ease your life. It is used by us to deploy our infrastructure in CI/CD pipelines therefore some defaults reflect directly our situation. E.g. the yml templates are always fetched from GitHub. If you want customise deployment you need do it manually or create a pull request for openremote-cli which is as OpenRemote 100% open source. Anyway, the fastest way is do this manually. Here are the steps:

  1. Get the necessary commands for deployment without actual deployment:
% or deploy --dnsname host.myiot.com --provider aws --dry-run --verbose | grep '> '
> aws configure list-profiles
> aws ec2 describe-key-pairs --key-names openremote --profile openremote-cli
> wget -nc https://github.com/openremote/openremote/raw/master/mvp/aws-cloudformation.template.yml
> aws cloudformation create-stack --stack-name host-668f8134-f62f-422b-928b-252cbbefb5be --template-body file://aws-cloudformation.template.yml --parameters ParameterKey=DomainName,ParameterValue=myiot.com ParameterKey=HostName,ParameterValue=host ParameterKey=HostedZone,ParameterValue=true ParameterKey=OpenRemotePassword,ParameterValue=K94al84Wv0XuyzF ParameterKey=InstanceType,ParameterValue=t3a.small ParameterKey=KeyName,ParameterValue=openremote --capabilities CAPABILITY_NAMED_IAM --profile=openremote-cli
> aws cloudformation wait stack-create-complete --stack-name host-668f8134-f62f-422b-928b-252cbbefb5be --profile openremote-cli

Note that --dnsname includes also host name, so you should have myiot.com hosting zone already defined in Route 53 and CloudFormation will create an entry with host.

  1. Edit the CloudFormation template aws-cloudformation.template.yml and go to section UserData.

  2. There you have initialisation script where the stack is run. Localise the line
    docker-compose -f mvp-docker-compose.yml -p openremote up -d
    and customise it to your liking. You can use any docker-compose.yml file instead of mvp-docker-compose.yml.

  3. Execute aws cloudformation... command with --template-body pointing to your customised template.

2 Likes

Thank you very much for your support. Great job. :raised_hands: