I had a Rails app running on V1 and working just fine. I decided to try and move it to V2 to see how hard it is to work with machines (spoiler: not hard at all) but I’m getting an erratic behavior from the app from different directions
- deployments usually don’t work the first time:
here is myMakefile
for machine deployment
uid := $(shell openssl rand -base64 12)
machine:
flyctl deploy --image-label $(uid) --build-only --push --auto-confirm -c infrastructure/web.toml
flyctl image update --image registry.fly.io/sumiu-machine:$(uid) -y
rarely this works in the first try, I get the following error usually twice before it works:
Sending build context to Docker daemon 237.3kB
Error failed to fetch an image or build from source: error building: Error response from daemon: invalid reference format
- Cert is not being issued and complains about IPs that don’t match:
I deleted the former V1 app and issue a new cert for the same domain for V2 but the cert is not issued. This is what I see when I list the cert:
The certificate for sumiu.link has not been issued yet.
Hostname = sumiu.link
DNS Provider = cloudflare
Certificate Authority = Let's Encrypt
Issued =
Added to App = 18 hours ago
Source = fly
A Record (104.21.6.27) does not match app's IP (66.241.125.146)
AAAA Record (2606:4700:3033::6815:61b) does not match app's IP (2a09:8280:1::a:bea1)
Address resolution (104.21.6.27) does not match app's IP (66.241.125.146/2a09:8280:1::a:bea1)
Address resolution (172.67.154.153) does not match app's IP (66.241.125.146/2a09:8280:1::a:bea1)
Address resolution (2606:4700:3033::6815:61b) does not match app's IP (66.241.125.146/2a09:8280:1::a:bea1)
Address resolution (2606:4700:3030::ac43:9a99) does not match app's IP (66.241.125.146/2a09:8280:1::a:bea1)
You are creating a certificate for sumiu.link
We are using lets_encrypt for this certificate.
I don’t really remember but I believe the IPs listed here are from the V1.
When I disable CF proxy, the certificate is issued but the RSA
is marked with the red
- Random
SSL handshake failed Error: code 525
:
more often than I would’ve expected, I get this error when I load the app. AFAIK there is not much I can do.
here is my CF configuration:
- Disabling CF proxy causes all kind of
http
vshttps
errors
When I disable the CF proxy, the css is not loaded and returns this error in the console:
Mixed Content: The page at 'https://sumiu.link/' was loaded over HTTPS, but requested an insecure stylesheet 'http://d54mowbuhi4an.cloudfront.net/assets/application-a3ef288bedebdf6e94b2c3bbdab80379fcfbcb5e297f30c6f993aaafa421af3e.css'. This request has been blocked; the content must be served over HTTPS.
trying to interact with the app is even worse. I get this error:
2023-01-02T14:20:08.684 app[6e82577b4d6287] fra [info] [b3636863-20c2-4197-acad-3fdad91635e0] ActionController::InvalidAuthenticityToken (HTTP Origin header (https://sumiu.link) didn't match request.base_url (http://sumiu.link)):
I’ve already tried a number of things, like updated my production.rb
like this:
config.force_ssl = true
config.ssl_options = { redirect: { exclude: lambda { |request|
request.headers["X-Forwarded-Ssl"] != "on"
} } }
to no success