Introduction: Setup SCDE RpServer - With Jenkis Traffic Light
Super Cool development environment (SCDE) is cheap solution for those who don't have money for expensive severs and are tired of reinstalling their OS, wanna test all cool stuff for webdevelopment or just have own private git repository or cool jenkins TraficLight :)
let's get started
Step 1: 1. What Is SCDE
List of software we'll use:
- Java, Python, Node JS
- Serves : Tomcat, Apache, Wildfly, Glassfish
- Db: MySql, PostregSql
- Building tools: Gradle, Maven, Grunt
- CI - Jenkins
Step 2: 2. Prepare Raspberry Pi and Install 'Power' (java, Python Etc) and Setup Static Ip :)
Lets update and upgrade Rp.
Install RASPBIAN JESSIE LITE image after that.
sudo apt-get update sudo apt-get upgrade
Than setup static Ip address
Release storage in Rp
select '1 Expand Filesystem'
for more config
Install Java :)
Type to terminal java -version if you will get than install java
-bash: java: command not found
sudo apt-get install openjdk-8-jdk
Than try type
pi@raspberrypi:~ $ java -version<br>openjdk version "1.8.0_40-internal" OpenJDK Runtime Environment (build 1.8.0_40-internal-b04) OpenJDK Zero VM (build 25.40-b08, interpreted mode) pi@raspberrypi:~ $ javac -version javac 1.8.0_40-internal
Open .bashrc on bottom of file write
sudo find /usr/ -name *jdk export JAVA_HOME=/usr/share/doc/openjdk-8-jdk export PATH=$JAVA_HOME/bin:$PATH
Than type echo $JAVA_HOME and you should get something like this:
pi@raspberrypi:~ $ echo $JAVA_HOME<br>/usr/share/doc/openjdk-8-jdk/
It is already installed on my version :)
Install node Js
I use the first method with nvm manager
For the last Install Git
sudo apt-get install git
Congratulations you have successfully configure your SCDE
Setup SSH key for no login access
Follow this tutorial
Step 3: 3. SERVERS SERVERS CAN I Have Some Servers ?
Modern webdeveloper is useless without arsenal of servers. In this part we will install most famous app server Tomcat than java web servers like WILDFLY GlassFish and most popular http server Apache hope you'll ejoy
This is is list of ports for individual servers
- Tomcat: 8082
- Apache 80
- Wildfly: 8081
- GlassFish: 8083
- Node apps from 8084 - to 8085
- Java standalone wepApp from 8085 - 8095
- Other python or .. servers 8095 8100
- MySql : 3306 default
- PostgreSql: 5432 default
Firstly create directory under Home called servers
Download Tomcat from this link
Than extract files to ~/servers/tomcat.
mkdir ~/servers/tomcat cd ~/servers/tomcat/ tar -xvf ~/Downloads/apache-tomcat-7.0.70.tar.gz --directory .
Set port in tomcatFolder/conf/server.xml
<Connector port="8082" protocol="HTTP/1.1" conncetionTimout="20000" redirectPort="8443" address="0.0.0.0" />
Starting the beast
cd ~/servers/tomcat/%tomcatVersion%/bin ./startup.sh
ps aux | grep tomcat
You should in process something like this
pi@raspberrypi:~/servers/tomcat/apache-tomcat-7.0.70/bin $ ps aux | grep tom root 31472 17.2 6.0 351808 57304 pts/0 Sl 14:58 1:10 /usr/bin/java -Djava.util.logging.config.file=/home/pi/servers/tomcat/apache-tomcat-7.0.70/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.endorsed.dirs=/home/pi/servers/tomcat/apache-tomcat-7.0.70/endorsed -classpath /home/pi/servers/tomcat/apache-tomcat-7.0.70/bin/bootstrap.jar:/home/pi/servers/tomcat/apache-tomcat-7.0.70/bin/tomcat-juli.jar -Dcatalina.base=/home/pi/servers/tomcat/apache-tomcat-7.0.70 -Dcatalina.home=/home/pi/servers/tomcat/apache-tomcat-7.0.70 -Djava.io.tmpdir=/home/pi/servers/tomcat/apache-tomcat-7.0.70/temp org.apache.catalina.startup.Bootstrap start pi 31524 0.0 0.1 4248 1404 pts/0 S+ 15:05 0:00 grep --color=auto tom
Apache (with mysql and wordpress)
There is a lot of great tutorials for setup apache MySQL and WordPress will be installed later
Very similar like Tomcat first download latest version of WildFly.
mkdir ~/servers/wildfly && cd ~/servers/wildfly/ wget http://download.jboss.org/wildfly/10.1.0.Final/wildfly-10.1.0.Final.tar.gz
Than you need to setup port in standalone.xml file and biding address for remote access
Change biding address of management tool and server.
Than on bottom of standalone.xml change number of server port to "8081"
Create glassFish directory under servers directory
mkdir glassFish && cd glassFish wget http://download.java.net/glassfish/4.1.1/release/glassfish-4.1.1.zip
I use this tutorial to make it live
Be carefuller wait for sever starts it take some time.
Health check scripts
Step 4: 4. Setup Databases
Install mysql database following this tutorial
!!!!!!! beware this will make your DB accessible in network only for Developing purpose
$ mysql -u root -p $ Enter password: $ mysql use mysql $ mysql GRANT ALL ON *.* to root@'192.168.1.4' IDENTIFIED BY 'your-root-password'; $ mysql FLUSH PRIVILEGES;
This was hard one because I did't get rid off perl erros connect with local problems... but this is solution for you
$ sudo dpkg-reconfigure locales $ select en_US.UTF-8 $ select en_US.UTF-8 sudo locale-gen en_US.UTF-8 $ type "locale" to check again.
Tha you get rid of this error
$ perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = "en_US.UTF-8", LC_ALL = "en_US.UTF-8", LC_PAPER = "sk_SK.UTF-8", LC_ADDRESS = "sk_SK.UTF-8", LC_MONETARY = "sk_SK.UTF-8", LC_NUMERIC = "sk_SK.UTF-8", LC_TELEPHONE = "sk_SK.UTF-8", LC_IDENTIFICATION = "sk_SK.UTF-8", LC_MEASUREMENT = "sk_SK.UTF-8", LC_TIME = "sk_SK.UTF-8", LC_NAME = "sk_SK.UTF-8", LANG = "en_US.UTF-8" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). /bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
$ sudo apt-get update && sudo apt-get upgrade $ sudo apt-get purge postgresql* $ sudo apt-get -f install $ sudo apt-get install postgresql
Than you have to set password for postgres user
$ sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';"
Done! You saved User = postgres and password = postgres. If you do not have a password for the User postgres
$ sudo passwd postgres
Than you have to setup PgDb for remote access
su - postgres
Add or edit the following line in your /etc/postgresql/9.4/main/postgresql.conf :
listen_addresses = '*'
Add the following line as the first line of /etc/postgresql/9.4/main/pg_hba.conf. It allows access to all databases for all users with an encrypted password:
# TYPE DATABASE USER CIDR-ADDRESS METHOD host all all 0.0.0.0/0 md5
Than restart posgtres
sudo /etc/init.d/postgres restart
Try to connect to db with PgAdmin.
Step 5: Install and Setup Jenkins
This was not that easy.. if you wanna use NodeJs okay so lets go.
Install jenkins following instructions on this site:
I have my personal web which is powered by grunt task runner, bower for installing dependencies and so on.
And fortunately nodeJS plugin for jenkis doesnt work on Rp.
But I have workaround for you. This instruction is against security rules but this servers is only in your home network so ... is not that big deal, but if you want proper security you have to find another tutorial for that maybe next time :).
Open visudo and at this lines
jenkins ALL=(ALL) NOPASSWD: ALL
# Members of the admin group may gain root privileges.<br>%admin ALL=(ALL) NOPASSWD:ALL
Than log as jenkins
and install node, npm, bower, grunt etc/
sudo apt-get install nodejs
sudo apt-get install npm
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo npm install -g bower
sudo npm install -g grunt-cli
Yea I know this is not good way but works now...
Setup test task
I have my portfolio web site Like I said on pictures you can see my setup for CI.
This tutorial is only for setup things not to use it so if you have better solution for jenkins and NodeJs give my advice I'll appreciated that.
Step 6: List of HW Materials
What you will need...
Step 7: Build Traffic Light
Sorry I don't have video how I build traffic light but it is not that hard jut drill few holes a put everything together.
I will provide later completely schematic for wiring inside the box if somebody wants email me (email@example.com).
Before you build the whole thing, Test first :) TDD in action, buy relay module with Led signalization. I used tutorial from this site and connection everything works for the first time :) http://antonfisher.com/posts/2016/01/05/make-rasp...
So If you follow tutorial in the link you will have working jenkis Traffic light is not that hard just make every connection properly.
Try to add some test project Like I add put there sleep echo etc. a try if its flasing check my video.
Step 8: Finish
Hope you enjoy this tutorial please check youtube video and give me feedback thanks.
See you soon ADIOS from SLOVAKIA A.L
We have a be nice policy.
Please be positive and constructive.