loading...

Discussion on: Deploy Rails in Amazon ECS: Part 3 - Create the RDS database, Task Definition, and Load Balancer

Collapse
lamphanqg profile image
Phan Quang Lam

Thank you for your detailed guide. It helped me a lot with ECR/ECS operations.
I think when you package your code into the Docker image, master.key file is included, so you don't need to set RAILS_MASTER_KEY.
And I'm also thinking that we should only deploy code committed to git, instead of packaging all code in current PC into the image. Maybe using git clone inside Dockerfile instead of COPY .?

Collapse
raphael_jambalos profile image
Raphael Jambalos Author

Hi Phan, I'm glad you found the article useful. :D For the master.key, I explicitly added RAILS_MASTER_KEY to make sure this works for people who would be cloning my GitHub repository instead of rails new and starting their own project from scratch. I also think it would be one less step to worry about for people who would want to set up a dedicated build server for building their docker images. But point take that if you already have master.key on your local, then this step will be redundant (not to mention master.key and RAILS_MASTER_KEY would have different values)

I haven't considered using git clone for a project like this. I think that could work but my problem with that is you would have to fetch the entire repository every time you build your Docker image. This could take long for big projects. Also, most projects are private so you would have to find a way to pass your SSH credentials to docker while it is building your image.