The reason for running update and nodejs parts was because I was getting an ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime error without them.
I just updated my rails/ruby version and the above doesn’t work anymore. When I run the node command, it runs and then quits the fly console (i.e. I’m unable to enter the subsequent migrate command).
This should also address the ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime problem. You also shouldn’t need to run migrate yourself as db:prepare will be run by the release command (in fly.toml) if you are running with postgresql or in the dockerfile-entrypoint (if you are running sqlite3).
I did update the dockerfile using that command right after I had updated rails. The exec error has been there for a while (even before I upgraded rails). Is there a fix for that?
If your Gemfile or Gemfile.lock has execjs in it, your generated Dockerfile should look like the following:
Note: these lines appear beforeFROM base as build so that node will be in the base (and therefore deployed) image, and the PATH will also be set.
Can you verify that (1) execjs is in your Gemfile.lock, (2) that you Dockerfile matches the description above, and (3) when you run fly ssh console that your PATH contains /usr/local/node/bin?
(1) yes, execjs is there
(2) yes it does match
(3) i get this when I run fly ssh console: root@90800d5b656168:/rails#
Also, I regenerated the dockerfile with the lower memory. I’m now able to get past the node bit but the seeding doesn’t seem to take place fully. The deployed app has some missing things.
Also, when I run echo $PATH within fly ssh console, i get the following: /usr/local/bundle/bin:/usr/local/bundle/gems/bin:/usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Nothing comes up when I run cat /proc/swaps within the ssh console. The table headings come up but there aren’t any values. How do I ensure that swap is properly configured? It sounds like a memory problem because when I run rails db: seed in the ssh console, it runs for a bit and then I get the following error:
Error: ssh shell: wait: remote command exited without exit status or exit signal
You can also set this up yourself. Remove that from fly.toml, remove USER rails:rails from the Dockerfile, and edit your bin/docker-entrypoint to look like this:
Place the docker-entrypoint script in your bin directory.
Note that this script will run ./bin/rails db:prepare when you start your server; this will automatically run migrate and seed so there should be no need to ssh into your server to perform these functions.