-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discussion - Guide to deploy an Elixir/Phoenix app to AWS ECS #20
Comments
Hello! Thanks for article.
|
Hey @tim2CF, thanks for the feedback. The Dockerfile is split into two stages, build and release. The build stage uses Distillery to compile the application into Erlang binaries which also includes the Erlang Runtime (I forgot to mention this detail in the article: rel/config.exs#L37). Then release starts with plain Alpine Linux. Nothing from the build phase (meaning Erlang, Elixir, Phoenix, Mix, Node) is carried. There's no Erlang in there until we copy the compiled files into the release image: Dockerfile#L102. In the end, the release image just has the Erlang runtime and our application binaries. I still didn't dive into distributed Erlang on AWS. I totally going to use this project to dive into it. |
Thanks! |
@joaquimadraz Thanks for the guide!
This command works without any errors. But
I am new in Docker, like that docker can not connect to the Postgres. |
Hey @Merff. Yes, what's probably happening is that docker is not able to connect to the host's Postgres.
There's a note regarding that issue on the guide. I guess it's not properly placed :) |
Hi @joaquimadraz. Thanks for the answer) But I don't use Mac, I use Ubuntu. And my project not an Umbrella, just standard Phoenix 1.3 project. How to correct change Dockerfile and may be other files? Thank you!) |
Hi! I get "no basic auth credentials" while
Login works fine with
|
Hi @joaquimadraz , I'm stuck on this step:
I have module |
@Merff sorry for the late reply. Did you figure out what was the problem with the database connection? Regarding the credentials problem, I'm not sure what can it be but I would say that it's a credentials problem. Make sure that the correct AWS keys are being used. Start by looking at |
@markdev Did you add the |
UPDATEI got it all working!! So I followed the steps and everything worked out in the end except... my app doesn't load. I'm completely new to AWS/any kind of devops stuff and am just an application developer. Here is my project URL: https://gitlab.com/project-bourbon/mash and here is my public url for the project: http://ec2-54-165-95-3.compute-1.amazonaws.com/ If there's anything glaringly obvious it'd be nice to know. I don't even know how to look at logs or anything :\ Here is my last deploy log as well: https://gitlab.com/project-bourbon/mash/-/jobs/62738365 Locally I can build production and provide the environment variables for my local db and it all works perfectly running from a docker container, so I know it's not that. |
@sean-clayton I'm glad that you were able to do it! I was checking you project's source code it has something to do with the connection with the database. Do you want to explain a bit the problem you faced? Regarding the logs, what I do for now is accessing the EC2 instance, grab the docker container logs.
This is not ideal but it's a good starting point to check if something went wrong on boot. I'm working on logging everything to AWS CloudWatch. Would that be interesting for you? |
@joaquimadraz Yup, I dug a little bit and forgot that I had ssh access to my EC2 instance 😅 Quickly got access to logs after that. And about CloudWatch: That would definitely interest me. I'm kinda surprised there isn't a step on that in the wizard. And about the problem I had... I'm not 100% sure why it started working. I think it was because I wasn't passing the My next steps that I'm going to try learning (as I said, completely new to this side of development):
Are these things "good practice" with AWS? Namely wondering about nginx there. I have no idea what the norm is on this field. UpdateGot an elastic load balancer with SSL support working :D |
@joaquimadraz I have the trouble to deploy the Elixir to AWS. Can you help me, please? |
@joaquimadraz Do you have any thoughts on adjusting the deploy.sh to not have the slight downtime between the the old service going down and the new one finishing starting up? |
Hey @KalvinHom. I didn’t have a change to play with it but you can accomplish that using AWS ALB (Application Load Balancer). |
Some minor issues. What you'll need
Now in order for the files under priv/tasks to be compiled and available on the pre_hook_script we need to add the path to elixirc_paths on mix.exs: Great job with the commits on deployment branch. Made following along slight ambiguities like this much easier just noticed oddness |
Hello, Great article, seems pre_start_hook has been deprecated in favour of pre_start_hooks. In your blog post Hope the future readers benefit from this. |
Also one other change in the release_tasks.ex
|
Hi @joaquimadraz, |
@siyomai you can consider using the latest version of |
@sean-clayton were you able to setup nginx with ssl? |
how i can do it with multiple images in this project https://github.com/aviacommerce/avia can you give me a explanation on how to deploy it on aws |
Using all the steps followed, i am now able to start my app in EC2 which is having an RDS database. the phoenix endpoint is now my EC2 instance running on 4000 port. I have linked ports 4000 in my docker-compose file and then exposed 4000 port from my container. but still i am not able to connect to the application. |
@chaitanyapi I've just run in the same issue. Adding the port 4000 for incoming traffic on my ECS Allowed Ports security group fixed the issue. |
I'm opening this issue for a possible discussion of my blog post:
https://joaquimadraz.com/guide-to-deploy-an-elixir-phoenix-app-to-aws-ecs
The text was updated successfully, but these errors were encountered: