I tried to redeploy the Rails app that was working until yesterday, but it stopped working. The error message is as follows.
echo 10 > /proc/sys/vm/swappiness
swapon /swapfile
swapon: /swapfile: swapon failed: Invalid argument
rails aborted!
Command failed with status (255): [swapon /swapfile...]
I added a code to fly.toml, “swap_size_mb = 512”, but the app don’t work.
where is the problem?
Hi… You have to also locate and remove the swapon
commands, since those are no longer valid.
Do you have a file named docker-entrypoint
?
Thank you for your kind message.
I cannot fide the file, but I found a code “swapon/swapfile” in fly.rake.
task :server => :swapfile do
sh 'bin/rails server'
end
task :swapfile do
sh 'fallocate -l 512M /swapfile'
sh 'chmod 0600 /swapfile'
sh 'mkswap /swapfile'
sh 'echo 10 > /proc/sys/vm/swappiness'
sh 'swapon /swapfile'
end
Would it be better to fix this code?
Yes, this does look like the right place…
None of the commands in task :swapfile
are needed, now that you have your fly.toml
setting.
1 Like
Thank you for very good advice!
I was able to deploy after modifying the code as follows.
task :server do
sh 'bin/rails server'
end
1 Like
system
Closed
May 15, 2024, 10:06pm
7
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.