Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Capistrano 3 assets:precompile takes hours. Stops at css file

Just as it says, I can't get capistrano 3 to do assets:precompile correctly. Even after hours, it still says writing to the .css file on the server.

UPDATE:

I was playing around and I tried a m1.medium. Same thing happened when it got to a certain point it simply stopped precompiling. Not errors are thrown, the cursor simply flashes.

It looks like it is still working, as it just says:

I, [2013-12-31T01:18:45.210416 #31413] INFO -- : Writing /var/www/app/releases/20131231011622/public/assets/application-998b176a776d6aff56fce8af9ca0d861.css

When I look at the cpu usage from any instance It looks like this:

enter image description here

It seems like the process is done, but it isn't. I created a fake application from scratch and it uploads perfectly with the same capistrano settings. I am using ckeditor, bootstrap-sass and a custom engine if that makes a difference.

If I need to show any other files I would be happy to add them here.

Thanks

Update 2 I got it to work on m1.medium instances, but it still fails on m1.small or t1.micro instances. So I assume it is with the ssh.

like image 474
moosilauke18 Avatar asked Dec 23 '13 19:12

moosilauke18


1 Answers

I had a similar issue where Capistrano 3 freezes on assets:precompile.

For me it turned out that it was an SSH problem due to the prolonged time it takes to precompile assets on production! Especially if the server memory and CPU specs are not too high.

Although my connection to the production server was pretty fast and reliable, it seemed that my SSH client just gave up reading output from SSHD server after a certain amount of time.

The Fix

Add the following in /etc/ssh/sshd_config on production server to keep connection with SSH client alive:

ClientAliveInterval 30
ClientAliveCountMax 10

This fixed the issue and now Capistrano 3 completes deployment with no problems.

like image 164
moeabdol Avatar answered Sep 29 '22 01:09

moeabdol