[Archivesspace_Users_Group] Serving ArchivesSpace with prefix and proxy

Steven Majewski sdm7g at virginia.edu
Sat Jul 25 15:35:16 EDT 2015


Went back to hard coding some of the asset paths in .less assets. 

It appears the .erb trick works for some files but for other causes the precompile to fail. 
I figured I’ld go back to looking at that issue after I find all of the required changes and test them with hard coded values.


Further testing I found that the component paths in the public resource views are also broken.

I tested hardcoding the “/public/“ prefix, and that fixes the problem.


diff --git a/public/app/views/records/_components.html.erb b/public/app/views/records/_components.html.erb
index e332e6f..4300347 100644
--- a/public/app/views/records/_components.html.erb
+++ b/public/app/views/records/_components.html.erb
@@ -31,7 +31,7 @@
   <li class="record-tree-node {if has_children} has-children{else} no-children{/if}" data-uri="${record_uri}">
     {if has_children}<a href="#" class="record-tree-node-toggle"><span class="record-tree-node-toggle-icon"></span></a>{/if}
     <span class="icon icon-${node_type}"></span>
-    <a href="${record_uri}" class="record-tree-node-title">${title}</a>
+    <a href="/public/${record_uri}" class="record-tree-node-title">${title}</a>
     {if has_children}<ul class="record-sub-tree"></ul>{/if}
   </li>
 --></div>



I think I may have to give up on the goal of getting this working for our production deployment, at least for the time being. The more I test it, the more bugs I find. I’m not feeling very confident that this is the last one. 



— Steve. 



> On Jul 25, 2015, at 10:41 AM, Steven Majewski <sdm7g at virginia.edu> wrote:
> 
> 
> 
> 
>> On Jul 24, 2015, at 9:44 PM, Steven Majewski <sdm7g at virginia.edu <mailto:sdm7g at virginia.edu>> wrote:
>> 
>> 
>> The resources that are failing all seem to be hardwired in less stylesheets.
>> It would seem that the RAILS_RELATIVE_URL_ROOT patch is unnecessary — the paths
>> that are variable were already getting prefixed properly, and that can’t do anything
>> about the hardwired paths in these stylesheets. 
>> 
>> As a hack, it appears to work to edit the hardwired paths in the less stylesheets. 
>> ( At least for frontend app, I haven’t tried the same changes to public yet. ) 
>> 
>> Unfortunately, I’m not familiar enough with lessc and how it’s called in Rails
>> to know if it’s possible to pass the path prefix in as a variable. 
>> 
>> 
> 
> Reading the docs on the Rails asset pipeline, it seems the suggested way to do something 
> like that ( their example is with sass, not less, but it should be the same sort of thing )
> is to use .erb templating and that the pipeline will successively process extensions: 
>    icons.less.erb  ==>  icons.less ==> icons.css 
> 
> 
> I tried adding the fronted_prefix in icons.less.erb, but my build failed. 
> 
> 
> Thinking I may have had a syntax error, I tried just renaming “icons.less" to “icons.less.erb",
> but the build still fails with a not very informative stack track:
> ( I’ve also tried renaming to “icons.css.less.erb” with result the same. )
> 
> 
> frontend:war:
>      [echo] Precompiling Rails assets (this can take a little while...)
>      [java] rake aborted!
>      [java] LoadError: no such file to load -- action_controller/railtie
>      [java] org/jruby/RubyKernel.java:1071:in `require'
>      [java] /projects/Archivespace/dcs-archivesspace/frontend/config/application.rb:4:in `(root)'
>      [java] org/jruby/RubyKernel.java:1071:in `require'
>      [java] /projects/Archivespace/dcs-archivesspace/build/jruby-complete-1.7.18.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55:in `require'
>      [java] /projects/Archivespace/dcs-archivesspace/build/jruby-complete-1.7.18.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:53:in `require'
>      [java] /projects/Archivespace/dcs-archivesspace/frontend/Rakefile:1:in `(root)'
>      [java] org/jruby/RubyKernel.java:1087:in `load'
>      [java] /projects/Archivespace/dcs-archivesspace/frontend/Rakefile:5:in `(root)'
>      [java] /projects/Archivespace/dcs-archivesspace/build/gems/gems/rake-10.4.2/lib/rake/rake_module.rb:1:in `(root)'
>      [java] /projects/Archivespace/dcs-archivesspace/build/gems/gems/rake-10.4.2/lib/rake/rake_module.rb:28:in `load_rakefile'
>      [java] /projects/Archivespace/dcs-archivesspace/build/gems/gems/rake-10.4.2/lib/rake/application.rb:689:in `raw_load_rakefile'
>      [java] /projects/Archivespace/dcs-archivesspace/build/gems/gems/rake-10.4.2/lib/rake/application.rb:94:in `load_rakefile'
>      [java] /projects/Archivespace/dcs-archivesspace/build/gems/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
>      [java] /projects/Archivespace/dcs-archivesspace/build/gems/gems/rake-10.4.2/lib/rake/application.rb:93:in `load_rakefile'
>      [java] /projects/Archivespace/dcs-archivesspace/build/gems/gems/rake-10.4.2/lib/rake/application.rb:77:in `run'
>      [java] /projects/Archivespace/dcs-archivesspace/build/gems/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
>      [java] org/jruby/RubyKernel.java:1087:in `load'
>      [java] /usr/local/var/rbenv/versions/jruby-1.7.11/bin/rake:23:in `(root)'
> 
> 
> 
> 
> For this deployment, I will probably go back to just editing the hardwired urls in those stylesheets.
> Another possible option may be to just serve up the static files directly from apache —
> not using the proxy to rails app. The question there is whether I can get the public and frontend 
> assets to merge together nicely. 
> 
> 
> — Steve. 
> 
> 
> 
>> Here are the paths that I changed in frontend app. 
>> I expect to find a similar set in the public app stylesheets.
>> 
>> 
>> — Steve. 
>> 
>> 
>> diff --git a/frontend/app/assets/stylesheets/archivesspace/icons.less b/frontend/app/assets/stylesheets/archivesspace/icons.less
>> index 773070d..49edb32 100644
>> --- a/frontend/app/assets/stylesheets/archivesspace/icons.less
>> +++ b/frontend/app/assets/stylesheets/archivesspace/icons.less
>> @@ -1,10 +1,10 @@
>>  @font-face {
>>    font-family: 'icomoon';
>> -  src:url('/assets/icomoon/icomoon.eot?-z7cehr');
>> -  src:url('/assets/icomoon/icomoon.eot?#iefix-z7cehr') format('embedded-opentype'),
>> -  url('/assets/icomoon/icomoon.woff?-z7cehr') format('woff'),
>> -  url('/assets/icomoon/icomoon.ttf?-z7cehr') format('truetype'),
>> -  url('/assets/icomoon/icomoon.svg?-z7cehr#icomoon') format('svg');
>> +  src:url('/admin/assets/icomoon/icomoon.eot?-z7cehr');
>> +  src:url('/admin/assets/icomoon/icomoon.eot?#iefix-z7cehr') format('embedded-opentype'),
>> +  url('/admin/assets/icomoon/icomoon.woff?-z7cehr') format('woff'),
>> +  url('/admin/assets/icomoon/icomoon.ttf?-z7cehr') format('truetype'),
>> +  url('/admin/assets/icomoon/icomoon.svg?-z7cehr#icomoon') format('svg');
>>  }
>>  
>>  .icomoon {
>> diff --git a/frontend/app/assets/stylesheets/themes/default/bootstrap.less b/frontend/app/assets/stylesheets/themes/default/bootstrap.less
>> index 25150dd..bdf1817 100644
>> --- a/frontend/app/assets/stylesheets/themes/default/bootstrap.less
>> +++ b/frontend/app/assets/stylesheets/themes/default/bootstrap.less
>> @@ -1,4 +1,4 @@
>>  // override icon paths
>>  @import "bootstrap/variables";
>> - at icon-font-path: "/assets/";
>> + at icon-font-path: "/admin/assets/";
>>  @import "bootstrap/bootstrap";
>> 
>> 
>> 
>> 
> 
> _______________________________________________
> Archivesspace_Users_Group mailing list
> Archivesspace_Users_Group at lyralists.lyrasis.org
> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20150725/e57d88c6/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4943 bytes
Desc: not available
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20150725/e57d88c6/attachment.bin>


More information about the Archivesspace_Users_Group mailing list