-
Notifications
You must be signed in to change notification settings - Fork 3
Server on Cubieboard A20
Moved server-setup.sh
script down into directory with Sinatra server code.
The Cubieboard2 (also called the Cubieboard A-20) is very similar to the original Cubieboard but with a dual-core Allwinner A20 ARM SoC instead of the A10 single-core.
- Power (lower right) is connected to 5V, 2 Amp power adapter.
- Ethernet (left) connection to LAN.
- Adafruit console cable (center). Connect black to GND; green to RX; white to TX; do not connect red. Connect at 115200 baud (8/1/N).
- SSD connected to SATA port
I tried several OS images before finding one that all the Napkin dependencies work on. I ended up with a Linaro Ubuntu 13.06 NAND server image. Check the parent dir for other images, and see associated release notes.
I installed PhoenixSuit 1.06 on Windows 7. The tool updated itself to version 1.07 after the initial install. To flash the OS image into Cubieboard NAND memory, connect a USB cable to the OTG port (on the left in the pic above, between the Ethernet and audio jacks) and hold down the button next to the port as you plug the USB cable into the PC running Windows 7 and PhoenixSuit. Watch for PhoenixSuit to indicate it has attached to the Cubieboard. Select the image file and press Upgrade.
With the variant of Ubuntu selected above, the console cable connection provides a root shell. The commands below assume the root user is running them. If a non-root user is doing the setup, prepend sudo
and otherwise adjust as necessary.
- Is SATA device found? Run
dmesg | grep ata
... look for devices at/dev/sda*
- Edit /etc/fstab to mount drive at startup. Add line below:
/dev/sda1 /media/ssd ext4 rw,nosuid,nodev 0 0
- See notes here.
- Created ext4 partition on drive to use for Neo4j DB
Run the following commands to install components needed by the Napkin server (some of these may already be present):
apt-get update
apt-get install -y ssh git
These next 2 dependencies are needed by the software floating point variant of the Java runtime (more on this in the Java setup section below):
apt-get install -y libc6-armel libsfgcc1
The Apache web server is started by default in this Ubuntu distro, but I'm not using it. These notes explain how to disable it:
update-rc.d apache2 disable
There is a process called irqbalance
which seems to have a memory leak. It also seems safe to disable it as described here, by editing the /etc/default/irqbalance
config file to change the ENABLED
value:
ENABLED="0"
To set the system timezone:
dpkg-reconfigure tzdata
Also need to increase open files limit (the value reported by running: ulimit -n
). Edit /etc/security/limits.conf and add lines like this (replace linaro
below with the userid you will use to run the Napkin server, if different):
linaro hard nofile 40000
linaro soft nofile 40000
You can set a password for the linaro
user account like this:
passwd linaro
Reboot the system after editing the limits.conf file for the changes to take effect:
shutdown -r now
For the rest of the configuration, login as the default linaro
user, or other non-root user. Use ifconfig
in console/root shell to determine DHCP assigned IP address.
I have tried both the hardware float and software float Oracle Java 7 JRE packages. With the hflt
package, I am stuck on https://github.com/cjdaly/napkin/issues/3 . The sflt
package seems to work as long as the libc6-armel
and libsfgcc1
have been installed with apt-get
(see above).
From the Oracle embedded downloads page, download the Java 7 for ARM, server, headless, software floating point download, ejre-7u45-fcs-b15-linux-arm-vfp-sflt-server_headless-26_sep_2013.gz
on a separate system (download from web browser) and use sftp (Linux) or WinSCP (Windows) to copy it to the Cubieboard.
On the Cubieboard:
cd ~
mkdir java
cd java
mkdir sflt
cd sflt
Use the sftp client to copy the Java download to the directory just created. Then extract the download:
tar xvf ejre-7u45-fcs-b15-linux-arm-vfp-sflt-server_headless-26_sep_2013.gz
cd ~
mkdir neo4j
cd neo4j
wget -O neo4j-community-2.0.0.tgz 'http://download.neo4j.org/artifact?edition=community&version=2.0.0&distribution=tarball'
tar xvf neo4j-community-2.0.0.tgz
cd neo4j-community-2.0.0/conf
Edit the neo4j-server.properties
file and change the database location property value to use storage on the SATA drive:
org.neo4j.server.database.location=/media/ssd/napkin-neo4j-db
Edit the neo4j-wrapper.conf
file, uncomment and set values for the properties below:
wrapper.java.initmemory=128
wrapper.java.maxmemory=128
Also, add this line to the neo4j-wrapper.conf
file:
wrapper.java.additional=-XX:MaxPermSize=64M
Now edit the neo4j.properties
file and uncomment and set these values to constrain usage of memory mapped IO:
neostore.nodestore.db.mapped_memory=12M
neostore.relationshipstore.db.mapped_memory=12M
neostore.propertystore.db.mapped_memory=12M
neostore.propertystore.db.strings.mapped_memory=12M
neostore.propertystore.db.arrays.mapped_memory=12M
See Neo4j issue 1384 for more details on how these configuration settings were determined.
cd ~
mkdir jruby
cd jruby
wget -O jruby-bin-1.7.9.tar.gz 'http://jruby.org.s3.amazonaws.com/downloads/1.7.9/jruby-bin-1.7.9.tar.gz'
tar xvf jruby-bin-1.7.9.tar.gz
Next, clone the napkin code from github:
cd ~
git clone https://github.com/cjdaly/napkin.git
Now add java, neo4j and jruby to the path, and confirm each one gives a reasonable version/status message.
source ~/napkin/server/sinatra/server-setup.sh
Now install gems used by Napkin:
gem install --no-rdoc --no-ri rest-client sinatra json kramdown
cd ~/napkin/server/sinatra
source server-setup.sh
./napkin.sh -start systems/cubie2
tail -f napkin.log
./napkin.sh -status
./napkin.sh -stop