[Archivesspace_Users_Group] Serving ArchivesSpace with prefix and proxy

Steven Majewski sdm7g at virginia.edu
Sat Jul 25 10:41:29 EDT 2015

> On Jul 24, 2015, at 9:44 PM, Steven Majewski <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. )

     [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";

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20150725/b910ca7e/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/b910ca7e/attachment.bin>

More information about the Archivesspace_Users_Group mailing list