prisma / prisma-templates

Prisma templates for major cloud providers
MIT License
52 stars 41 forks source link

503 Service Temporarily Unavailable when using Fargate #28

Open chrisbull opened 5 years ago

chrisbull commented 5 years ago

So I keep following all the instructions here ... it gets created successfully, but whenever I access the externalUrl I get a 503 service temp unavail error.

I'm using an already existing Postgres database hosted on AWS, instead of using the templates. The logs show a connection error with the db. Is there a reason you guys haven't created a aws/postgres.yml version yet? I'm not too familiar with Fargate (yet), so any help with how to connect Prisma to my existing db while using Fargate would be very appreciated.

Thanks in advance for the help!

Btw - would be really great if you guys (the Prisma team) could create a more simple way to deploy Prisma Server on AWS. Maybe could add something to the cli?

dan003400 commented 5 years ago

I am having this same issue with MongoDB, we are using Atlas to host our MongoDB clusters. Any support here @prisma???

haruska commented 5 years ago

Couple of things that have killed my day but hopefully will help someone else that comes across this:

1) You need to set the SSL flag to true. This isn't in the database connector for some reason, but the top level prisma config... jesus. It's a postgres specific flag. anyway. I also added the connectionLimit but i'm guessing that's optional?

          Environment:
            - Name: PRISMA_CONFIG
              Value: !Sub 
                - |
                  port: 60000
                  managementApiSecret: ${ManagementApiSecret}
                  databases:
                    default:
                      connector: ${DbConnector}
                      host: ${DbHost}
                      port: ${DbPort}
                      user: ${DbUser}
                      password: ${DbPassword}
                      connectionLimit: ${DbConnectionLimit}
                      migrations: true
                      ssl: true
                  ssl: true

2) This template sets up a non-SSL public endpoint to your prisma server. I would convert that to SSL. It involves having a cert and a CNAME but you should certainly protect the traffic on the public net side of things.

sirojinadias commented 5 years ago

@haruska First time with AWS Fargate and my deployment fail with a "ROLLBACK_COMPLETE" status, without more detail. Is this because I didn't set up any SSL cert ?

tafelito commented 5 years ago

Having the same issue with mySQL, I tried adding the ssl param but nothing changed? Anyone found a solution to this?

ncbinh98 commented 5 years ago

I have the same issues and this is the way how I to solve it:

I used PostgreSQL on RDS, for the first deploy, I forgot to allow IP of Fargate to connect that database. Then I check my security group of that RDS, make sure security group allow any IP to connect that database(just for testing, I have changed to Fargate ip created for security ) image And this is my fargate.yml for PostgreSQL fargate.zip

Now everything is working fine. This is result: image

tonyfromundefined commented 5 years ago

adding HealthCheckGracePeriodSeconds: 30 in AWS::ECS::Service will be the solution. Check my template.

https://github.com/tonyfromundefined/prisma-aws-cloudformation

Dev-Dipesh commented 5 years ago

I am having this same issue with MongoDB, we are using Atlas to host our MongoDB clusters. Any support here @prisma???

@dan003400 I'm also in the same situation. We also have MongoDB hosted on Atlas. Did you ever figure out the right config?

sumitra19jha commented 3 years ago

For mongodb atlas you need to perform few changes in template. ` Environment:

sumitra19jha commented 3 years ago

This has worked fine for me.