Testing authentication token... PASSED
Testing flyctl agent... PASSED
Testing local Docker instance... Nope
Pinging WireGuard gateway (give us a sec)... PASSED
Testing WireGuard DNS... PASSED
Testing WireGuard Flaps... PASSED
App specific checks for metrak:
Checking that app has ip addresses allocated... PASSED
Checking A record for metrak.fly.dev... PASSED
Checking AAAA record for metrak.fly.dev... PASSED
Build checks for metrak:
Checking docker context size (this may take little bit)... PASSED (47 kB)
Checking for .dockerignore... PASSED
Do you perhaps have a tailwind.config.js? Or other file that references flowbite/plugin?
Here’s the theory: what appears to be going on here is that there are two types of Rails applications: those that make use of node, and those that don’t. Your app started out as one of the latter, but now depends on node, but that’s OK on your machine because you have node installed.
If that theory is correct, we may need to modify your Dockerfile to install node just for the duration of the build step, then install the necessary plugins, then run assets:precompile. I can talk you through that process.
Yep, I think your theory is correct.
I have Tailwind and Flowbite installed. And tailwind.config.js in the config directory and flowbite referenced a couple of times and some JS here and there.
So, I guess your solution sounds like the right way to go, and it would be great if you could guide me through that. Thank you very much.
Currently, those lines in the Dockerfile looks like this:
# Copy application code
COPY --link . .
# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile app/ lib/
It might be due to the fact that I’ve already run bin/rails generate dockerfile --precompile=defer ?
Before that (I haven’t pushed local changes yet) they looked like this:
# Copy application code
COPY . .
# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile app/ lib/
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
Wondering if I should proceed as you suggested anyway?
Moreover,
Flowbite needs Tailwind to work as well. Does it mean I should npm i that first?
Yes, before that COPY statement would be where you insert your changes.
Add as many npm i statements as you need. It won’t hurt if you install too much. If you miss something, you will see what you need to install next in your logs.
I tried with both my current node versione (22.0.0) and the one recommended on the official website (20.14.0).
Either way, fly deploy exits with this error:
Error: failed to fetch an image or build from source: error building: failed to solve: process "/bin/sh -c curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && /tmp/node-build-master/bin/node-build \"${NODE_VERSION}\" /usr/local/node && rm -rf /tmp/node-build-master" did not complete successfully: exit code: 2
I’m not sure what you’re asking me to do here and what that command does.
Can you elaborate on that?
However, you made me realise that I was missing curl from my Dockerfile, which I added, and that let deployment complete.
However, as per original post, even though the app is saying it’s deployed, it still doesn’t load and in the logs I can see the same errors.
Just to verify, your current Dockerfile only has one FROM line?
If you have installed node and from there installed flowbite you should, at the very least, get a different error message. If you haven’t tried it yet, make sure you try specifying -gor --global on the install.
Both fly ssh console and fly console are handy commands to get to know. The first will create a secure shell into your running instance. The second will create an ephemeral machine that lasts until you exit the shell. You can override the Dockerfile and command to be run on each.
Both are great for exploring… you can run commands interactively and see the results. Once you find a sequence of commands that do what you need, modify your Dockerfile and redeploy.
It did not work, but at least the error has changed:
2024-05-31T06:48:44Z runner[9185e647c107d8] ams [info]Machine started in 553ms
2024-05-31T06:48:44Z app[e824121a7511e8] bos [info][Error: EACCES: permission denied, open '/rails/app/assets/builds/tailwind.css'] {
2024-05-31T06:48:44Z app[e824121a7511e8] bos [info] errno: -13,
2024-05-31T06:48:44Z app[e824121a7511e8] bos [info] code: 'EACCES',
2024-05-31T06:48:44Z app[e824121a7511e8] bos [info] syscall: 'open',
2024-05-31T06:48:44Z app[e824121a7511e8] bos [info] path: '/rails/app/assets/builds/tailwind.css'
2024-05-31T06:48:44Z app[e824121a7511e8] bos [info]}
2024-05-31T06:48:44Z app[e824121a7511e8] bos [info]bin/rails aborted!
2024-05-31T06:48:44Z app[e824121a7511e8] bos [info]Command failed with exit 1: /usr/local/bundle/ruby/3.3.0/gems/tailwindcss-rails-2.5.0-x86_64-linux/exe/x86_64-linux/tailwindcss
2024-05-31T06:48:44Z app[e824121a7511e8] bos [info]Tasks: TOP => assets:precompile => tailwindcss:build
2024-05-31T06:48:44Z app[e824121a7511e8] bos [info](See full trace by running task with --trace)
2024-05-31T06:48:45Z app[e824121a7511e8] bos [info] INFO Main child exited normally with code: 1
2024-05-31T06:48:45Z app[e824121a7511e8] bos [info] INFO Starting clean up.
2024-05-31T06:48:45Z app[e824121a7511e8] bos [info] INFO Umounting /dev/vdc from /data
2024-05-31T06:48:45Z app[e824121a7511e8] bos [info] WARN could not unmount /rootfs: EINVAL: Invalid argument
2024-05-31T06:48:45Z app[e824121a7511e8] bos [info][ 6.391956] reboot: Restarting system
If you don’t have any more advice, can you just help me understand what this person did, so I can try to replicate it?
If also that doesn’t work, I might just remove Flowbite altogether.
Thank you very much and apologies for taking so much of your time. I truly appreciate your support.
Adding app/assets or public give similar results. If I add app, the machines just don’t start. assets by itself is not found as a directory.
When I do this:
The app is actually deploy and the URL loads. However, it doesn’t seem to access the database, so all the files I created, as well as the user to login, are not there.
I thought that Rails had a built-in db, did I get that wrong?
Rails doesn’t have a built-in db, but rails can create and update dbs on the machine it is running on.
At the moment, you likely are using either a sqlite3 or postgresql db. If you don’t know which, it probably is sqlite3. On your machine the db is in the db directory. On the fly machine it is in the /data directory. You likely are running in development mode on your machine and in production on fly, so the names of the dbs may be different.
Your command work, although I had to take development.sqlite3 from storage rather than data, and had to delete /data/production.sqlite3 using fly ssh console because the put command wouldn’t overwrite the file.
There are still some issues in the CSS rendering, but I feel like I can deal with this by myself now.
The app is deployed and fully functional.
Thank you very much for your help and patience. I truly appreciate it.