-
Notifications
You must be signed in to change notification settings - Fork 172
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
Can a Fly.io
VM Connect to a DigitOcean
(Managed Postgres
) DB?
#93
Comments
I'm going to |
Will return to this once kids are in bed. ⏳ |
Attempting to run the 22:47:49.122 [warning] setting ssl: true on your database connection offers only limited protection,
as the server's certificate is not verified.
Set "ssl: [cacertfile: path/to/file]" instead
22:47:49.213 [error] Postgrex.Protocol (#PID<0.6035.0>) failed to connect:
** (DBConnection.ConnectionError) ssl connect: Options (or their values)
can not be combined: [{verify,verify_peer},
{cacerts,undefined}] - {:options, :incompatible, [verify: :verify_peer, cacerts: :undefined]} The answer appears to be: https://elixirforum.com/t/warning-setting-ssl-true-on-your-database-connection-offers-only-limited-protection-as-the-servers-certificate-is-not-verified-set-ssl-cacertfile-path-to-file-instead/65441/5 But need to have a certificate ... 🔒 Download it to Config: config :app, App.Repo,
ssl: [
verify: :verify_peer,
cacertfile: ".postgres-cert.crt"
] Currently hard-coded but I will wrap in an To run the Next error: 23:00:21.737 [error] Postgrex.Protocol (#PID<0.225.0>) failed to connect: ** (Postgrex.Error) FATAL 3D000 (invalid_catalog_name) database "postgres" does not exist
23:00:21.739 [error] :gen_statem #PID<0.225.0> terminating
** (Postgrex.Error) FATAL 3D000 (invalid_catalog_name) database "postgres" does not exist
(db_connection 2.7.0) lib/db_connection/connection.ex:104: DBConnection.Connection.handle_event/4
(stdlib 5.2.3) gen_statem.erl:1397: :gen_statem.loop_state_callback/11
(stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3
Queue: [internal: {:connect, :init}]
Postponed: []
State: Postgrex.Protocol
Callback mode: :handle_event_function, state_enter: false Searched for: https://www.google.com/search?q=phoenix+digitalocean+FATAL+3D000+%28invalid_catalog_name%29+database+%22postgres%22+does+not+exist Have to manually create the So in the # Configure DB for Digital Ocean via SSL
config :app, App.Repo,
ssl: [
verify: :verify_peer,
cacertfile: ".postgres-cert.crt"
],
maintenance_database: "defaultdb" From MIX_ENV=prod mix ecto.setup which is: That appears to have worked: But get the floowing error: 23:59:42.758 [error] Could not warm up static assets: could not find static manifest at "~/mvp/_build/prod/lib/app/priv/static/cache_manifest.json".
Run "mix phx.digest" after building your static files or remove the "cache_static_manifest"
configuration from your config files.
23:59:42.804 [debug] AUTH_API_KEY Environment Variable is not set
23:59:42.804 [debug] .env file path: ~/mvp/.env
|
MIX_ENV=prod mix phx.digest
MIX_ENV=prod mix ecto.setup
MIX_ENV=prod mix s Get the following error: 12:17:35.486 [error] Could not check origin for Phoenix.Socket transport.
Origin of the request: http://localhost:4000
This happens when you are attempting a socket connection to
a different host than the one configured in your config/
files. For example, in development the host is configured
to "localhost" but you may be trying to access it from
"127.0.0.1". To fix this issue, you may either:
1. update [url: [host: ...]] to your actual host in the
config file for your current environment (recommended)
2. pass the :check_origin option when configuring your
endpoint or when configuring the transport in your
UserSocket module, explicitly outlining which origins
are allowed:
check_origin: ["https://example.com",
"//another.com:888", "//other.com"] Googled for the exact error message: Read: https://elixirforum.com/t/check-origin-for-production-environment/53600 Added the following to config :app, AppWeb.Endpoint,
cache_static_manifest: "priv/static/cache_manifest.json",
check_origin: ["//localhost"] Works!!!!!! 😍 |
Next:
|
Using the answer to my SO question: export POSTGRES_CERT=`cat ./.postgres-cert.crt` Confirm it works: That works on Now to attempt it on Fly.io ... fly secrets set POSTGRES_CERT=$POSTGRES_CERT flyctl ssh console -a mvp -C "echo $POSTGRES_CERT" Sadly, stuck in a loop where the
So cannot "migrate" the |
So the problem appears to be that the ( |
|
Lame. |
Sadly that doesn't work. The outbound IP address on And
https://fly.io/docs/about/pricing/#anycast-ip-addresses
Sadly, all that does is add the IP Address to the But no change at the machine level which is where we need the update: We _could find a way to proxy the requests from the #96 + #97 Could be the "End Game" for Deployment! 💭 |
I've enjoyed the experience/workflow of working with Released the fly ips release 137.66.32.221 |
The
Fly.io
Postgres
is unmanaged i.e. a YOYO ("You're On Your Own") sometimes up, sometimes down. 😕But the stateless Virtual Machines (VMs) have decent uptime and the deployment is good.
So my question is this: can we connect a Fly.io VM to our Managed Postgres on
DigitalOcean
.Both the our
MVP
(Fly VM
) and theDB
are hosted in "London" which means "Docklands" (financial district).So the latency between the
Fly VM
andDB
should be low enough to be negligible for a small App where people don't expect sub200ms
latency.Where we might run into issues is on outbound bandwidth costs. ☁️ 💸
But the with
1TB
of outbound monthly bandwidth included with the base DB instance see:https://www.digitalocean.com/community/tools/bandwidth
I'm not concerned in the short term.
Going to try and get this setup now. Wish me Luck! 🤞
Relates to: #90 and dwyl/learn-analytics#3
Update: Answer:
No
😢Short version:
DigitalOcean Managed Postgres
can only whitelistIPv4
addresses.fly.io
machines can only haveIPv6
addresses for outbound requests.Therefore the
fly.io
machine cannot communicate with theDigitalOcean Managed Postgres
. 😢The text was updated successfully, but these errors were encountered: