Mid server on raspberry pi
Import
·
Feb 27, 2017
·
article
Recently I attempted to get a mid server running on my raspberry pi and could find no clear instructions. Here is what I did to get it working on a Pi 3 model B running respian jessie light, hopefully it can help you out in your efforts.
- 1. As the JRE the mid server comes with does not work on the arm archectature, you must install the ARM version of JRE
1. sudo apt-get install openjdk-8-jre-headless
- Create destination for your mid server files
- sudo mkdir /servicenow
- cd /servicenow
- sudo mkdir /servicenow
- Figure out what mid server you need.
- from your instance, navigate to Mid Server > Downloads in the left nav
- right click 32 bit under linux, and copy URL / Link Address
- from your instance, navigate to Mid Server > Downloads in the left nav
- Download mid server files into your servicenow directory
- Unzip your files. From here we will be modifying the /servicenow/agent directory to change things to work on the pie. Once this is done, the /servicenow/agent directory will be used to copy to each mid server you need
- sudo unzip mid.[press tab to auto complete]
- sudo unzip mid.[press tab to auto complete]
- Figure out your exact processor architecture. Run the command and review the highlighted line
- uname -a
pi@urchpi01:/servicenow $ uname -a
Linux urchpi01 4.4.34-v7+ #930 SMP Wed Nov 23 15:20:41 GMT 2016 armv7l GNU/Linux - NOTE! The last character in the above example is a lowercase letter L !!
- uname -a
- Setup the wrapper files matching your pi's architecture
- If your architecture is armv7l, setup symlink to existing wrapper:
- * sudo ln -s -r /servicenow/agent/bin/wrapper-linux-arm-32 /servicenow/agent/bin/wrapper-linux-armv7l-32
- If your architecture is armhf, download the attached armv6l.zip file, and place the files in the following locations:(Thanks to Lance D'Souza for noting this)
- * /servicenow/agent/lib/libwrapper-linux-armhf-32.so
* /servicenow/agent/bin/wrapper-linux-armhf-32
- If your architecture is armv7l, setup symlink to existing wrapper:
- Edit wrapper override configuration to point to external JRE and change max memory
- 1. sudo nano /servicenow/agent/conf/wrapper-override.conf
2. Under External JRE uncomment the line for wrapper.java.command and update to the following
* wrapper.java.command=/usr/lib/jvm/java-1.8.0-openjdk-armhf/jre/bin/java
3. Under System resources uncomment wrapper.java.maxmemory, and set to a value that makes since for your Pi. My Pi has 1gb of memory, and I plan on running 2 mid servers so I chose 256 mb. I have been running it solid for a few days now without issue.
4. [Ctrl + x] exits, select [Y] save, enter for current file location
- 1. sudo nano /servicenow/agent/conf/wrapper-override.conf
- Edit the wrapper file to correct the processor architecture (Thanks to Robert Beeman for noting this)
- sudo nano /servicenow/agent/conf/wrapper-jvm.conf
- change set.SNC_JVM_ARCH=x86-32 to set.SNC_JVM_ARCH=arm
- sudo nano /servicenow/agent/conf/wrapper-jvm.conf
- Now copy the folder for your mid server and copy the agent into it
- Setup the directory and move mid into it
1. sudo mkdir [your_mid_server]
2. sudo cp -r /servicenow/agent/ /servicenow/[your_mid_server]/agent/
3. cd [your_mid_server]/agent/ - Config your mid server
1. sudo nano ./config.xml
2. Edit file as normal
3. [Ctrl + x] exits, select [Y] save, enter for current file location - Start it up / test it out
- Setup the directory and move mid into it
- You can use cron to automatically start your mid server when the pi boots
- sudo crontab -e
- Add these lines to the bottom of the cron file. First I delete the old logs so the current log remains agent0.log, then I start the mid. I cd first because from what I can tell some of the paths in the start script are relative and break if you don't start form the correct directory.
1. @reboot sleep 10 && rm -r /servicenow/[your_mid_server]/agent/logs/*
2. @reboot sleep 11 && cd /servicenow/[your_mid_server]/agent && ./start.sh
3. [Ctrl + x] exits, select [Y] save, enter for current file location
- sudo crontab -e
- Create destination for your mid server files
Repeat step 10 and 11 for multiple mid servers
Troubleshooting
- 1. "Unable to locate any of the following binaries:"
* This message occurs when there is not a wrapper file that matches your processor architecture.
* Review the binaries that are supposedly missing and create symlinks to those specific names similar to step 7 above.
* Remember in my examples, the last highlighted character is a lowercase L NOT a number 1.
- Review logs/wrapper.log
- If you see error messages for missing files, create symlinks from the existing ...arm... file to the missing file similar to step 7
* I had these symlinks in a earler version of this document, but thought them unnecessary. If you are having problems, try adding these symlinks back in. Be sure to add them to each mid instance's directory:
* sudo ln -s -r /servicenow/agent/lib/libwrapper-linux-armhf-32.so /servicenow/agent/lib/libwrapper-linux-null-32.so
* sudo ln -s -r /servicenow/agent/bin/wrapper-linux-arm-32 /servicenow/agent/bin/wrapper-linux-armv7l- - If you see error messages for mismatch versions:
1. Review available jre versions
1. sudo apt-cache search jre
2. Review installed jre versions
3. Go back to step 8, and try the different JRE versions.
- If you see error messages for missing files, create symlinks from the existing ...arm... file to the missing file similar to step 7
- Wifi can be difficult to get up and running for those of us not familiar on linux command line. Here is the guide that helped me get wifi running: Setting WiFi up via the command line - Raspberry Pi Documentation. You should only need to configure the /etc/wpa_supplicant/wpa_supplicant.conf file.
- Review logs/wrapper.log
View original source
https://www.servicenow.com/community/developer-articles/mid-server-on-raspberry-pi/ta-p/2301343
