To create an EHRBase deploy in AWS ECS you must follow these steps
- Launch an empty Linux 2 or Linux image
- Configure specs according the expected use (you can probably leave most of the options as is)
- edit: Don't forget to add 8080 to the instance firewall (keep port 22 for SSH)
- Generate key (and save it!)
- Run container
- Connect by SSH to the instance
- Url: instance IP
- User: ec2-user
- Password (empty, provide pem/ppk file)
- Install docker
- Update packages
- sudo yum update -y
- Install most recent docker version (for Linux 2 AMI)
sudo amazon-linux-extras install docker
- Install most recent docker version (for Linux AMI)
sudo yum install docker
- Open docker service
sudo service docker start
- Add ec2-user to docker group so it can execute docker commands without using sudo
sudo usermod -a -G docker ec2-user
- Close session so permissions are applied
- Test that ec2-user can indeed execute docker
docker info
- If a daemon error is thrown then you probably need to restart the instance (or the docker service is actually down)
- Run database docker image
- docker network create ehrbase-net
- docker run --name ehrdb --network ehrbase-net -e POSTGRES_PASSWORD=postgres -d -p 5432:5432 ehrbaseorg/ehrbase-postgres:latest
- Run ehrbase docker image
- docker run --name ehrbase --network ehrbase-net -p 8080:8080 ehrbaseorg/ehrbase
And that’s all. You can test EHRBase server with swagger, which is available at
{your IP}:8080/ehrbase/swagger-ui.html
PS: This AWS configuration is inside the free tier :)
Sources:
https://docs.aws.amazon.com/es_es/AmazonECS/latest/developerguide/docker-basics.html