Error encountered in deploying ruby on rails web app to Fly.io

108 views Asked by At

I'm new to ruby on rails and app deployment, and I was trying to deploy a ruby on rails app to fly.io but kept on encountering an error. Bellow is the whole response after running fly launch in the app directory I was trying to deploy(the error is in bold letters):

C:\User\Desktop\deploy\DancEClass>flyctl launch
Scanning source code
Detected a Rails app
Creating app in C:\User\Desktop\deploy\DancEClass
We're about to launch your Rails app on Fly.io. Here's what you're getting:

Organization: User                    (fly launch defaults to the personal org)
Name:         danceclass              (derived from your directory name)
Region:       Singapore, Singapore    (this is the fastest region for you)
App Machines: shared-cpu-1x, 1GB RAM  (most apps need about 1GB of RAM)
Postgres:     <none>                  (determined from app source)
Redis:        <none>                  (not requested)

? Do you want to tweak these settings before proceeding? No
Created app 'danceclass' in organization 'personal'
Admin URL: https://fly.io/apps/danceclass
Hostname: danceclass.fly.dev
Creating postgres cluster in organization personal
Creating app...
Setting secrets on app danceclass-db...
Provisioning 1 of 1 machines with image flyio/postgres-flex:15.3@sha256:44b698752cf113110f2fa72443d7fe452b48228aafbb0d93045ef1e3282360a6
Waiting for machine to start...
Machine 32874971ae07d8 is created
==> Monitoring health checks
  Waiting for 32874971ae07d8 to become healthy (started, 3/3)

Postgres cluster danceclass-db created
  Username:    postgres
  Password:    <redacted>
  Hostname:    danceclass-db.internal
  Flycast:     fdaa:3:c375:0:1::5
  Proxy port:  5432
  Postgres port:  5433
  Connection string: postgres://postgres:<redacted>.<redacted>:5432

Save your credentials in a secure place -- you won't be able to see them again!

Connect to postgres
Any app within the User organization can connect to this Postgres using the above connection string

Now that you've set up Postgres, here's what you need to understand: https://fly.io/docs/postgres/getting-started/what-you-should-know/
**Failed attaching danceclass to the Postgres cluster danceclass-db: can't build tunnel for personal: You must be authenticated to view this..
Try attaching manually with 'fly postgres attach --app danceclass danceclass-db'
Error creating Postgresql database. Be warned that this may affect deploys
Error creating Postgres cluster: can't build tunnel for personal: You must be authenticated to view this.**
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies....
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies.......
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies.........
      create  Dockerfile
      create  .dockerignore
      create  bin/docker-entrypoint
      create  config/initializers/sentry.rb
      create  config/dockerfile.yml
Wrote config file fly.toml
Validating C:\User\Desktop\deploy\DancEClass\fly.toml
Platform: machines
✓ Configuration is valid

Your Rails app is prepared for deployment.

Before proceeding, please review the posted Rails FAQ:
https://fly.io/docs/rails/getting-started/dockerfiles/.

Once ready: run 'fly deploy' to deploy your Rails app.

I tried mannually attaching the database to my app as instructed in the error by running "fly postgres attach --app danceclass danceclass-db". It'll prompt the system to check for existing attachments but after a while it will just return an operation time out notice as shown bellow.

C:\Users\Desktop\deploy\DancEClass>fly postgres attach --app danceclass danceclass-db
Checking for existing attachments
Error: Get "http://fdaa:3:c375:a7b:185:ab7:23e:2:5500/commands/databases/danceclass": connect tcp [fdaa:3:c375:a7b:185:ab7:23e:2]:5500: operation timed out
0

There are 0 answers