[Archivesspace_Users_Group] Serving ArchivesSpace with prefix and proxy

Steven Majewski sdm7g at virginia.edu
Fri Jul 24 21:44:30 EDT 2015


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. 


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





> On Jul 24, 2015, at 7:41 PM, Steven Majewski <sdm7g at virginia.edu> wrote:
> 
> 
> OK. [1] Copied that file into both {public,frontend}/lib/tasks , replacing the existing file. 
> 
> [2] added these env settings to targets  frontend:war and public:war in build.xml 
> 
> 
> 
>        <env key="GEM_HOME" value="${gem_home}" />
>        <env key="GEM_PATH" value="" />
>        <env key="BUNDLE_PATH" value="${gem_home}" />
> +      <env key="RAILS_RELATIVE_URL_ROOT" value="admin" />
>        <arg line="--1.9 -S rake assets:precompile --trace" />
>      </java>
> 
> 
>        <env key="GEM_HOME" value="${gem_home}" />
>        <env key="GEM_PATH" value="" />
>        <env key="BUNDLE_PATH" value="${gem_home}" />
> +      <env key="RAILS_RELATIVE_URL_ROOT" value="public" />
>        <arg line="--1.9 -S rake assets:precompile --trace" />
>      </java>
> 
> 
> (did it need a leading or trailing slash ? )
> 
> [3] Built distribution, unzipped it an ran. Is that was I was supposed to do ? 
> 
> 
> output looks like the env values are getting passed in : 
> public:war:
>      [echo] Precompiling Rails assets for Public (this can take a little while...)
>      [java] ** Invoke assets:precompile (first_time)
>      [java] ** Execute assets:precompile
>      [java] java -XX:MaxPermSize=128m -Xmx256m -cp /projects/Archivespace/dcs-archivesspace/public/../common:/projects/Archivespace/dcs-archivesspace/public/../build/jruby-complete-1.7.18.jar org.jruby.Main --1.9 -X-C -S rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets RAILS_RELATIVE_URL_ROOT=public
>      [java] Using Node ExecJS runtime
>      [java] Forcing Rails configuration
>      [java] Using Node ExecJS runtime
>      [java] Forcing Rails configuration
>      [java] Creating public.war
>      [java] rm -f public.war
> 
> 
> 
> I Still get the same problems with the same set of assets. 
> It doesn’t appear to change the behavior at all. 
> 
> Note that most of the assets have been loading correctly and still do. 
> It’s only that handful that don’t load. See screenshot below showing
> correct URLs for one selected. It’s only the ones in red that aren’t loading
> on that page.   
> 
> — Steve. 
> 
> 
> 
> <assets.tiff>
> 
> 
> 
>> On Jul 23, 2015, at 11:40 PM, Chris Fitzpatrick <Chris.Fitzpatrick at lyrasis.org <mailto:Chris.Fitzpatrick at lyrasis.org>> wrote:
>> 
>> Hi Steven,
>> 
>> Yeah, so the fix for this is you're probably going to have to precompile you assets again and pass in a relative url root. 
>> 
>> Something like this would work I think:
>> https://gist.github.com/cfitz/8d5d65c30127ff69ff22 <https://gist.github.com/cfitz/8d5d65c30127ff69ff22>
>> 
>> You can set a RAILS_RELATIVE_URL_ROOT environment variable when you run ./scripts/build_release ( or the build/run dist or whatever ) 
>> 
>> There's a similar file in the public directory. 
>> 
>> I think this would work...
>> 
>> b,chris. 
>> 
>> Chris Fitzpatrick | Developer, ArchivesSpace
>> Skype: chrisfitzpat  | Phone: 918.236.6048
>> http://archivesspace.org/ <http://archivesspace.org/>
>> 
>> 
>> From: archivesspace_users_group-bounces at lyralists.lyrasis.org <mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org> <archivesspace_users_group-bounces at lyralists.lyrasis.org <mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org>> on behalf of Steven Majewski <sdm7g at virginia.edu <mailto:sdm7g at virginia.edu>>
>> Sent: Friday, July 24, 2015 5:25 AM
>> To: Archivesspace Users Group
>> Subject: Re: [Archivesspace_Users_Group] Serving ArchivesSpace with prefix and proxy
>>  
>> 
>>> On Jul 23, 2015, at 9:11 PM, Steven Majewski <sdm7g at virginia.edu <mailto:sdm7g at virginia.edu>> wrote:
>>> 
>>> 
>>> There is still the issue of LCNAF plugin paths being broken. I haven't looked at that issue yet. 
>>> 
>>> 
>> 
>> 
>> Looks like LCNAF plugin frontend/routes.rb just needs to be wrapped with a scope like the public and frontend routes: 
>> 
>> 
>> diff --git a/plugins/lcnaf/frontend/routes.rb b/plugins/lcnaf/frontend/routes.rb
>> index 9a41305..7f0acd9 100644
>> --- a/plugins/lcnaf/frontend/routes.rb
>> +++ b/plugins/lcnaf/frontend/routes.rb
>> @@ -1,7 +1,9 @@
>>  ArchivesSpace::Application.routes.draw do
>> +  scope AppConfig[:frontend_prefix] do
>>  
>> -  match('/plugins/lcnaf' => 'lcnaf#index', :via => [:get])
>> -  match('/plugins/lcnaf/search' => 'lcnaf#search', :via => [:get])
>> -  match('/plugins/lcnaf/import' => 'lcnaf#import', :via => [:post])
>> +    match('/plugins/lcnaf' => 'lcnaf#index', :via => [:get])
>> +    match('/plugins/lcnaf/search' => 'lcnaf#search', :via => [:get])
>> +    match('/plugins/lcnaf/import' => 'lcnaf#import', :via => [:post])
>>  
>> +  end
>>  end
>> _______________________________________________
>> Archivesspace_Users_Group mailing list
>> Archivesspace_Users_Group at lyralists.lyrasis.org <mailto:Archivesspace_Users_Group at lyralists.lyrasis.org>
>> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group <http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group>
> _______________________________________________
> 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/20150724/6e3596d7/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/20150724/6e3596d7/attachment.bin>


More information about the Archivesspace_Users_Group mailing list