Deploy OpenRemote 3 stack on AWS with CloudFormation

Hello,

I’ve created a cloudformation template for AWS. It is now only for eu-west-1 region (Ireland) and I would like to extend it for all regions. For this I woud like a little help from people who would like to test it in other regions and send me the best matching AMI ids, so I can extend the template and make it more universal. For the eu-west-1 region I use ubuntu with preinstalled docker and docker-compose image, which is availably in community images. The stack takes about 7 min to full deploy, the most time takes booting the EC2 machine which fetch Docker images from the hub.docker.com. Anyone interested please check the link

1 Like

hi michal,

Is this project still live?

The ‘link’ isn’t working. :frowning:

cheers

Unfortunately this work was expunged from the main openremote repo. Nevertheless, it was a part of a bigger project of mine which is well and still alive. I’ve just run it and indeed it is deploying complete stack in few minutes. The project is called openremote-cli and it encapsulates the CF template itself. As i can see it is running Amazon Linux now and is fetching most recent AMI via SSM Parameter Store. Therefore it should be OK to deploy in any region out of the box.

Saying all that, I’m not doing any vanilla CloudFormation deployments anymore. In my work I’m focused on AWS CDK, which is much more powerful. Perhaps if there is interest from community I might release the latest tooling update, which contains CDKPipeline, which is quite nice self-mutating pipeline all in code. It is much more sophisticated than any static pipelines as offered by GitHub actions.

cheers for update michal … and will look into OR-cli …

thx

1 Like

ok … I’ve had a look at or-cli guide and I’m a little confused (complete newbie!) …

my present setup is that I’ve installed OR on my win10 laptop running docker desktop and all is aok and having fun trying out the various cool features …

do I now install or-cli on my laptop? … How?

pip install --upgrade openremote-cli
or
pip3 install --upgrade openremote-cli

thx for this and did try that but got the following error …

Did a windows restart but still no change … :frowning:

what am I doing wrong?

tried the deploy command and got following …

It continues like this for > 1hr … startup never completes as such …

have a nice w/end … pizza time.

best

Windows is unfortunately not my strongest part. Anyway installation seems to be without errors so I’m thinking that PATH isn’t set correctly. On macOS you can run following:

> which openremote-cli
/usr/local/bin/openremote-cli

Of course you can use -v or even -vvv parameters to get more feedback. Anyway, you are deploying through docker but haven’t configured any port forwarding (-p docker options). However, as this script is quite old (15 months when I check), I’m 100% sure that it works anymore for local deployment. I’m using it mostly for AWS deployment, which is still functional. Nevertheless, my advise here would try to run without docker (or add -p or -host networking options to docker). Without docker it deploys correctly on my machine:

> openremote-cli deploy -v                                   
If you need help go to https://forum.openremote.io/

Deploying OR... This usually takes less than 15 minutes.

> docker swarm init
> docker volume rm openremote_postgresql-data
> wget -nc https://github.com/openremote/openremote-cli/raw/main/cloudformation/mvp-docker-compose.yml
100% [................................................................................] 3539 / 3539> DOMAINNAME=localhost IDENTITY_NETWORK_HOST=localhost docker-compose -f mvp-docker-compose.yml -p openremote up -d

Stack deployed, waiting for startup to complete .......👍

Open https://localhost and login with admin:secret

Remove the stack when you are done:
> docker-compose -f mvp-docker-compose.yml -p openremote down
> rm mvp-docker-compose.yml

To remove docker resources:
> docker images --filter 'reference=openremote/*' -q | xargs docker rmi
> docker volume ls --filter 'dangling=true' -q | xargs docker volume rm

The command ‘where’ appears to be the win10 equiv. as follows …

… works fine for java, python etc. … but unfortunately no sign of or-cli :frowning:

I think I’ve localized where these files are on Windows.

> dir c:\Python310\Scripts\openremote*

    Directory: C:\Python310\Scripts

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---           10-7-2022    11:46         106330 openremote-cli.exe

However, I doubt that it would deploy the stack as we don’t provide Win docker images for Openremote. It should be run through wsl in which it is

$ which or
/home/michal/.local/bin/or

yip … eventually got to find or-cli.exe and try the deploy with the following error result …

Yes, this is because in the script I’m using Linux environment variables for settings. What you can do is to run it with -v switch, which will expose all commands which CLI uses internally and you can convert it to correct Windows equivalent. Command which fails in your example is: DOMAINNAME=localhost ... docker-compose ... up, which is in fact just docker-compose with env settings.

Of course you can run it through wsl without these issues. Maybe users more experienced with Windows than me can jump in @Don ?

I think that should be: set DOMAINNAME=localhost
Then afterwards do the docker-compose.

But to be honest I didn’t read the whole thread :grimacing:

OK, so the command for Windows should be changed to

set DOMAINNAME=localhost; set IDENTITY_NETWORK_HOST=localhost; docker-compose -f mvp-docker-compose.yml -p openremote up -d

I’ve tried it and it runs correctly, however I doubt that I’ll find resources to update openremote-cli tool for the Windows case. I’m using this tool mainly on cloud Linux machines to deploy whole stack with a single command.

What I would suggest on Windows is run or deploy -v --dry-run and see all required commands. I’m using this when I’m not using the stack for a while and forget related commands (I’m only human and forgetting not used stuff pretty fast :wink: )

 or deploy -v --dry-run
--dry-run active!
If you need help go to https://forum.openremote.io/

Deploying OR... This usually takes less than 15 minutes.

> docker swarm init
> docker volume rm openremote_postgresql-data
> wget -nc https://github.com/openremote/openremote-cli/raw/main/cloudformation/mvp-docker-compose.yml
> DOMAINNAME=localhost IDENTITY_NETWORK_HOST=localhost docker-compose -f mvp-docker-compose.yml -p openremote up -d
Open https://localhost and login with admin:secret

Remove the stack when you are done:
> docker-compose -f mvp-docker-compose.yml -p openremote down
> rm mvp-docker-compose.yml

To remove docker resources:
> docker images --filter 'reference=openremote/*' -q | xargs docker rmi
> docker volume ls --filter 'dangling=true' -q | xargs docker volume rm

A sort of tldr; man page.

Thanks for all the replies which I’ve only just read.

Decided to make the jump to aws ec2 linux as ultimately that’s where I want to be.

The good news is that I’ve got an instance type tg4.small up and running and able to putty ssh into it and even installed openremote-cli therein …

What steps would you recommend next to install the OR stack … follow the or-cli guide or?

Any additional hints and tips appreciated. :slight_smile:

thx

If you want to be on aws then do just

openremote-cli deploy --provider aws --dnsname  host.domain --region us-east-1

which uses aws-cli under the hood. I assume that you have route53 hostedzone for domain already. Also, you would need a keypair openremote and profile openremote-cli. Test it with --dry-run

openremote-cli deploy --provider aws --dnsname host.domain  --dry-run -v

This stack would create EC2 host and install Openremote stack on it.

ok … thx for this … I’ve created a new domain etc …

However, I’ve setup keypair for ‘openremote’ but I’m stumped on how to create a profile for ‘openremote-cli’ ?

Is this something to do with IAM Roles?

If yes … what service to use … EC2 … Cloudformation ?

Is there any tutorial for this or?

This is profile for aws-cli which openremote-cli is using under the hood. You should create IAM user which you will be using for deploying the stack. Then you need create credentials for programatic access, i.e. id and secret. Then you can run either aws configure --profile openremote-cli or openremote-cli configure_aws which will do the same.

When I look on Access Advisor of such user I see that following services are used: IAM, CloudFormation, CloudWatch, EC2, Route53, SNS, SSM, KMS, S3 and ECR. You can check yourself which policies you need by looking at Access Advisor. For different openremote-cli commands different services are needed.