chris3's picture

Hi there!

 

First of all a big thank you to the developers of Turnkey linux providing these really time-saving solutions!

 

Recently I have downloaded the latest TRACKS appliance* and figured out, that the icons for tasks like "Star this action", "Edit the action", "Show notes" are missing in all views. They are replaced with plain white squares (.../assets/blank-c321445ffe5946472b51dcc7fd7cdec5.png), so you have to mouse over to see the alternate text appear in order to hit the correct button.

Is this a bug of the Tracks version used in the appliance v12.1 or due to some bug in the Turnkey customization? In the Tracks mailing list only one guy using a customized Windows version is reporting this issue, however nothing can be found in the bug tracker or related to the official Linux version.

Tried to find the issue in some of the css files or other setting/parameter files, but this is the first time I'm dealing with a ruby on rails application and actually I don't have a clue where to look...

*installed the default VM optimized version - tested in a vsphere 5.1 and virtualbox 4.2 environment

Thanks and Cheers!

Forum: 
Tags: 
peter's picture

I can confirm the same problem with tracks, too

 

Please anyone, write a small how to what has to be done to fix this problem.

SomeRandomBloke's picture

from https://groups.google.com/forum/#!topic/TracksApp/c6alHoXVskc

ssh into your appliance as root

cd /var/www/tracks

bundle exec rake assets:precompile

exit

 

refresh your browser and icons are now visible

Alon Swartz's picture

Thanks for reporting the issue, and the workaround!

I created an issue on the tracker (#126), and replaced ondemand asset compilation with precompilation as suggested.

Paulo Abadie Guedes's picture

Hello, I've just downloaded and tested tracks 14.2 Jessie (AMD 64) inside virtualbox. The same problem is happening again.

Can you please take a look?

Regards,

Paulo

Jeremy Davis's picture

Thanks for your reporting the issue.

It is weird though as the fix (posted ages ago in the thread above and closed on our issue tracker here) is still applied to the appliance at build time: see here. So I'm not really sure why it's not working as it should?!

Could you please perhaps try ssh ing into your appliance and re-running that and see if it resolves it (my guess is that it may not? - but I'm not sure). So either there's something else we need to do, or perhaps we need to change the order a little?

To reiterate the steps:

cd /var/www/tracks
bundle exec rake assets:precompile

Please let me know how you go. Regardless, I've also opened a new issue (rather than reopen that really old one).

Paulo Abadie Guedes's picture

Hello Jeremy,

here is the result of my tests, regarding this "icon missing" issue. Sorry for the long answer, but... it's working!!!

I managed to make it work successfully yesterday, after trying many things.
This test is to detect precisely what solved the problem.

1) Brought up the vm in a clean state, setup passwords, etc.
   My internet is currently down, have only a bad/slow/expensive 3g link.
   So, no updates. That does not matter that much, as yesterday's test was with
   an updated state and it worked: all security updates applied.
   Mental note: always create a snapshot, as soon as the VM is updated;).

2) Tried the "bundle exec..." command. A new css file is created.

root@tracks ~# cd /var/www/tracks/
root@tracks www/tracks# bundle exec rake assets:precompile
I, [2018-05-30T11:56:43.763837 #5531]  INFO -- : Writing /var/www/tracks/public/assets/application-3d7ea0fe3f14f711b2f52d9b4a4f7fa2.css

3) Logout, login, same problem. Restarted virtualbox, no icons.
This makes sense. The issue could not be just a missing
"bundle exec..." command, since this was already fixed, a long time ago.

4) Tryed to change /var/www/tracks/config/site.yml, by adding the following line:
serve_static_assets: true
Nothing changed. File reverted back to its original state.

5) Changed production.rb to make ruby serve static content. Restarted.

root@tracks config/environments# pwd
/var/www/tracks/config/environments
root@tracks config/environments# nano production.rb

Here is the file snippet, after changing:
  # Disable Rails's static asset server (Apache or nginx will already do this).
#  config.serve_static_assets = false
  config.serve_static_assets = true

Nothing changed. Reverting.
Diggind deeper into forums, stackoverflow, etc. A long time later...

6) Trying nother way to recreate assets.
In a log file, I observed something like this: "No route matches [GET] /assets"
Which led me to this answer (among others):
https://stackoverflow.com/questions/7829480/no-route-matches-get-assets

The following command is a variant of the suggested one, but with an environment variable set.
bundle exec rake assets:precompile RAILS_ENV=production

The first one rebuilt a single file, while this created several. The process took a short while.
This step alone was not enough, but feeling that I'm getting close. Let's move on.

7) Now tried the "bundle rake..." (step 6) AND step 4. Nothing.

8) Now tried the "bundle rake..." (step 6) AND step 5. Nothing. Time to stop.

Another day, internet working again. Wait. Something changed. No, it's real: it WORKED!!! But... why? How? Well, I made a mistake: forgot to restart Apache after rebuilding assets. That's why it worked the next day: restarted virtualbox.

In short, only step 6 is necessary, plus a restart (apache will do). No need to change any config files.
So, the following commands solved the problem (at least, for me):

cd /var/www/tracks/
bundle exec rake assets:precompile RAILS_ENV=production
service apache2 restart

You may also restart the server. Done. It works. By the way, tests were run with and without security updates. Worked either way. My (wild) guess is that something changed in the way Ruby assets are built. Most probably, this environment thing was not necessary before, but some update changed the build behavior and inadvertently introduced this bug.

--------------------------------------------------------------------------------

In order to debug the process, it's possible to launch another server like this:
cd /var/www/tracks/
bundle exec rails server -e production

This will run a server on port 3000. Here, it's accessible like this:
http://192.168.25.9:3000/

Your IP will certainly change, but you got the idea. Every time I revert a snapshot, another IP can be assigned.

It's interesting to notice that not all icons are missing. The "downarrow" is present. No idea why, or what this means.
Anyway, it's generated again with other assets.
http://192.168.25.12/assets/downarrow-fa5136b753974e53b7a05a4ba2509c84.png

Useful commands:
- To restart apache service:
    sudo service apache2 restart
    
- To restart without downtime:
    sudo service apache2 reload

    Details:
    https://askubuntu.com/questions/6358/how-do-you-restart-apache?utm_mediu...

To restart ruby:
touch /path/to/your/app/tmp/restart.txt        

    For more ways, check:
    https://www.phusionpassenger.com/library/admin/apache/restart_app.html#r...

 

Jeremy Davis's picture

That's fantastic. Thank you so much for looking into this for us and then documenting everything so clearly!

So my reading of your thread is that essentially we simply need to add the RAILS_ENV=production to the bundle ... line. I.e.:

bundle exec rake assets:precompile RAILS_ENV=production

Whilst the Apache restart would be important as part of the workaround (on an existing appliance) it shouldn't be required when we build the appliances (as the services are stopped at the end of the build, then started when the appliance first boots).

I've added a comment to the issue documenting your workaround.

Thanks again for your efforts to improve TurnKey Linux. You're awesome! :)

Paulo Abadie Guedes's picture

Hello Jeremy,

you're welcome, it was a pleasure to help. This VM is important for me too, so... helping to fix it is a win-win for everyone;).

About your reading: yes, you're right: add "RAILS_ENV=production" to the "bundle" line and you're ready to go. Your command is correct. Agreed about "apache restart": it's important only for those already running the server. Documented it for this reason, and also to help debug the problem. It's too easy to forget this step.

However, here's a word of caution. I have no idea how this would affect other parts of the software. I mean, I don't actually understand the hidden impacts or possible side effects that may arise. Most probably, other environments would not be affected. So, in case something else breaks, it might be nice if someone that actually understands Ruby (in depth) to double check it.

Anyway, I tested it in many ways and for a long time, and it really seems to fix the problem. But the "programmer inside of me" warns that only time will tell;).

Meanwhile, I'm working on the CSV issue I reported before(next link). Hope to have something new to add in the next week.
https://www.turnkeylinux.org/forum/support/tue-20180529-1143/failure-res...

Regards,
Paulo

p.s.: please tell me how to highlight text inside a box, as you did in the "bundle..." command. Very, very useful. I'm new to this forum and would like to learn that (always learning).

 

Jeremy Davis's picture

Hopefully it's not too painful!

Regarding the formatted text box, personally I use the "plain text editor" in my posts here on the forums. So I write raw html on the fly (I know that may sound a bit bizarre, but I find it easier to always ensure formatting is exactly as I want it). I wouldn't necessarily recommend that you do that (although I'm pretty sure you can if you want via editing the preferences of your website user page). FWIW when doing raw html, it's simply using the <pre></pre> tags.

But you can also do it via the default "rich text editor". First, hit enter (so you're on a new line, behind the scenes that will add a closing </p> tag). Then select "Formatted" from the "Format" dropdown (right next to "Font"). FWIW it defaults to "Normal". I hope that helps.

Add new comment