Kev’s blog. A blog from Alfresco Engineering
As a fun side project I had a go at getting part of the Alfresco 5 platform – Alfresco Share 5 in the Apache Tomcat based web-tier – running on Raspberry Pi.
I’m using a Raspberry Pi Model B which has a huge 512MB RAM and crazy fast 700Mhz single-core ARM CPU!! Wow. OK. If you hadn’t already guessed, that is not huge nor it is at all fast – in fact it is a lot slower than my HTC One Android phone CPU (quad-core 1.7Ghz ARM CPU with 2GB RAM). To give you comparison – the low-end Intel Atom processor is approx 3-4x faster than this ARM CPU – so it’s pretty amazing that it’s possible at all.
The Raspberry Pi is running the standard 32bit Debian Wheezy Linux distribution that is compiled specially for the Raspberry Pi but is not anything special from a Linux perspective. I had previously installed Oracle JDK 7 so that will save some time – but here’s how:
sudo apt-get update && sudo apt-get install oracle-java7-jdk
I expect you can also use JDK 8 but I have not tried it!
OK, next I gzipped up my local copy of Apache Tomcat which contains my share.war webapp. IMPORTANT: The Tomcat instance does not contain alfresco.war or solr.war webapps! To be clear, we are only trying the Share web-app on the Pi because the minimum CPU/RAM requirements of the complete Alfresco repository are too much for this tiny $30 computer. Most Alfresco developers run separate Share/Alfresco Tomcat instances as this makes it much easier when doing Share development so that the Alfresco+Solr server instance can be left running – it only takes a few seconds to restart a Tomcat instance containing just Share.
Use ‘scp’ or FTP to get your tomcat zip bundle onto the Pi and unpack it somewhere.
1. Edit the tomcat/bin/catalina.sh file to apply JVM memory settings. Add this line near the top of the file:
JAVA_OPTS="$JAVA_OPTS -Xms128m -Xmx200m"
I set mine to 200MB which is more than enough for Share. Also ensure there are no other JVM options applied that may not be suitable – e.g. for my instance I removed settings for the CMS GC and a few server related flags that were not appropriate for a tiny device with a single-core CPU.
2. Edit tomcat/shared/classes/alfresco/web-extension/share-config-custom.xml to point to your remote Alfresco 5.0 repository instance. This is a common Remote config change for an Alfresco Share installation. I won’t go into the details here as I have posted about it before on few occasions – but here is what mine looks like:
<alfresco-config> <config evaluator="string-compare" condition="Remote"> <remote> <endpoint> <id>alfresco-noauth</id> <name>Alfresco - unauthenticated access</name> <description>Access to Alfresco Repository WebScripts that do not require authentication</description> <connector-id>alfresco</connector-id> <endpoint-url>http://KEVLINUX:8080/alfresco/s</endpoint-url> <identity>none</identity> </endpoint> <endpoint> <id>alfresco</id> <name>Alfresco - user access</name> <description>Access to Alfresco Repository WebScripts that require user authentication</description> <connector-id>alfresco</connector-id> <endpoint-url>http://KEVLINUX:8080/alfresco/s</endpoint-url> <identity>user</identity> </endpoint> <endpoint> <id>alfresco-feed</id> <name>Alfresco Feed</name> <description>Alfresco Feed - supports basic HTTP authentication via the EndPointProxyServlet</description> <connector-id>http</connector-id> <endpoint-url>http://KEVLINUX:8080/alfresco/s</endpoint-url> <basic-auth>true</basic-auth> <identity>user</identity> </endpoint> </remote> </config> </alfresco-config>
The important part is the <endpoint-url> address. You may need to use a direct IP address in your config depending on your Alfresco repository machine OS and network.
3. In tomcat/bin folder execute ./catalina.sh run as usual to start Tomcat. Because I was using ssh to remote the Pi, I actually used nohup ./catalina.sh run & so I could then tail -fthe log and leave it running in the background when logged out – but that’s up to you.
The server takes a little under 3 minutes to start (rather than around 20 seconds on a modern laptop!)
INFO: Deploying web application directory /home/pi/dev/tomcat/webapps/share INFO: Starting Servlet Engine: Apache Tomcat/7.0.40 INFO: Server startup in 156202 ms
Point a web browser at the Raspberry Pi Share start page URL e.g. http://raspberrypi:8081/share – again this will vary with your set-up as you might need a direct IP and your port may be different depending on your original Share Tomcat config.
The server takes another couple of minutes to warm up (Share is in production mode; warms caches, compiles JS/FTL/Less, retrieves License/DD from Alfresco etc. – lots to do for a single core 700Mhz CPU!)
2014-10-14 21:04:51,434 INFO [web.site.EditionInterceptor] [http-bio-8081-exec-4] Successfully retrieved license information from Alfresco.
Login to Share!
The server takes another 30 seconds to login the first time – then each new page takes ~10sec to warm up – but then response time is very reasonable! Pages appears in <2 seconds.
Memory usage of Share heap is ~120MB during page generation, ~75MB at idle.
A fun Raspberry Pi experiment and an example of how lean the Alfresco Share 5.0 web-tier is!