Monitoring a shell script (external job) running on CentOS with Jenkins

So I wanted to setup Jenkins external monitoring on a web server I have on a Centos VM, and I found a combination of these three blog posts worked!

Firstly, run the following commands :

wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
yum -y install jenkins

… or download the RPM at http://pkg.jenkins-ci.org/redhat/ and run “rpm -Uhv jenkinx*.rpm”

  • run the following:
cd /usr/lib/jenkins
unzip /usr/lib/jenkins/jenkins.war
  • Install OpenJDK while you’re at it.
  • Go to Jenkins and create a “Monitor an external job” called “New Job”
* Create an environment variable by 
$export JENKINS_HOME=http://jenkins_host:8080 , replacing "jenkins_host" with the server running Jenkins
  • To have Jenkins monitor a script, run a command like the following…
java -jar /usr/lib/jenkins/WEB-INF/lib/jenkins-core-*.jar “New Job” /path_to/myreport.sh 2>&1 > /dev/null

And you can put that command in a cron job too!

Advertisements

Deploying your own copy of Bushfire Connect

logo3

So I worked on this awesome community startup Bushfire Connect. It is with a bit of sadness that I write this, given that we shut down our service a few years ago, but I wanted to put a note here on how to redeploy Bushfire Connect on your web server.

Please note this is a somewhat cut-down version of the Bushfire Connect we ran: all of the usernames and passwords have been stripped and a sole “admin” account is included.

Prerequisites

Your standard Linux/Apache/MySQL/PHP web server. Please note this hasn’t had many security patches applied so it’s likely to have unpatched security vulnerabilities, so be careful!

Loading the database

Go to https://github.com/ajosephau/Bushfire-Connect/blob/master/database/bushfireconnect_live.sql and download the SQL file and import it to a MySQL database using your database management app of choice (like phpMyAdmin).

Uploading the web files

Download all the files at: https://github.com/ajosephau/Bushfire-Connect/tree/master/ushahidi and upload them to your web server (let’s say you upload it to your a subfolder called “bushfireconnect” in your web root folder (like /var/www/html).

edit the application/config/database.php with the appropriate config as below for the database (replace “TODO_TEXT” with relevant parameters.)

$config['default'] = array
 (
 'benchmark' => TRUE,
 'persistent' => FALSE,
 'connection' => array
 (
 'type' => 'mysql',
 'user' => 'TODO_TEXT_DATABASE_USERNAME',
 'pass' => 'TODO_TEXT_DATABASE_USERNAME_PASSWORD',
 'host' => 'TODO_TEXT_DATABASE_HOSTNAME',
 'port' => FALSE,
 'socket' => FALSE,
 'database' => 'TODO_TEXT_DATABASE_NAME'
 ),
 'character_set' => 'utf8',
 'table_prefix' => '',
 'object' => TRUE,
 'cache' => FALSE,
 'escape' => TRUE
 );

From the web server’s console run the following commands

chmod 777 application/config/config.php
chmod 777 application/config
chmod 777 application/cache
chmod 777 application/logs
chmod 777 media/uploads
chmod 777 .htaccess

Edit application/config/config.php so it has:

$config['site_domain'] = 'localhost/bushfireconnect/';
$config['site_protocol'] = 'http';
$config['index_page'] = 'index.php';
$config['internal_cache'] = FALSE;

Changing “localhost” to whatever your domain name is, and “bushfireconnect” to the subdirectory you uploaded the files to. And lastly login as an administrator at http://localhost/ushahidi/index.php/login with the username “admin” and password “adm1n1st2011”

Some pretty usage statistics

screenshot1

screenshot2

screenshot3

Installing cmdbuild on Ubuntu 14.04 LTS

So the instructions on the Ubuntu wiki are good, but I found I had to make some slight changes in order to get it to work on the latest (at this time!) Ubuntu LTS version (14.04). I’m not too sure how secure the server is though… comments anyone? Here are the instructions I followed to get it to work

  • Install ubuntu on your platform (I’m using VirtualBox).
  • Start up the terminal app.
    • Screen Shot 2014-08-26 at 11.02.46 am
  • Install Apache Tomcat by running:
sudo apt-get update
sudo apt-get install tomcat6 tomcat6-docs tomcat6-admin

“tomcat6-docs” is optional.

  • Edit the tomcat user file:
sudo vi /etc/tomcat6/tomcat-users.xml

…comment out the “<!– …–>” at the bottom of the <tomcat-users> tag. Copy and paste one of the <user> tags to “add a new user” with the “manager” role.

  • Edit the tomcat settings file:
sudo vi /etc/default/tomcat6

…uncommenting the “TOMCAT6_SECURITY=no” setting so we explicitly don’t use the Java security manager iaw the original instructions. I’m inclined to uncomment the “LOGFILE_DAYS=14” line to keep logfiles to:

/var/log/tomcat6
  • Install postgresql and pgadmin3 (note to start pgadmin3 once it’s installed, just search for it in the Unity search in the top left hand corner).
sudo apt-get install postgresql
sudo apt-get install pgadmin3
  • Set a password for the postgresql postgres user, replacing “INSERT_PW_HERE” with your password.
sudo -u postgres psql template1
ALTER USER postgres WITH PASSWORD 'INSERT_PW_HERE';
\q
  • Download the latest JDBC (at writing time, given it’s version 9.3.5 of postgresql and 1.7.0 of Java we’d need version JDBC41 – you can find this out by running “psql –version” and “java -version” respectively) and place it in the /usr/share/tomcat6/lib folder.
  • Download and extract the cmdbuild to a folder, and move the <>/extras/tomcat-libs/x.y/* to the /usr/share/tomcatZZ/lib folder, where x.y is the tomcat version being used (6.0 for me), and “tomcatZZ” is the folder holding Tomcat ie tomcat60 for me.
  • Rename the “cmdbuild.x.y.z.war” to just “cmdbuild.war”
  • Start Tomcat with the following command (“tomcat6” might change):
sudo /etc/init.d/tomcat6 start
  • Navigate to http://localhost:8080/manager/html , logging in with your credentials you set before in the tomcat-users.xml file.
  • Under “WAR file to deploy”, select the “cmdbuild.war” and “Deploy” it. This takes a few seconds.
  • Go to http://localhost:8080/cmdbuild oncethepageis loaded and theWARfileis deployed. You should see the following settings page:
    • Screen Shot 2014-08-26 at 4.09.24 pm
  • Enter in the following parameters for the database settings, tailoring when you like (especiallyfortheCMDBuild database.
    • Screen Shot 2014-08-26 at 4.10.44 pm
  • Thenyouwill be prompted to log in with the username “admin” and password “admin” for the demo distribution.
    • Screen Shot 2014-08-26 at 4.12.12 pm

Exporting taxonomy terms in Drupal 7

Firstly you’ll need to install the UUID Features (https://drupal.org/project/uuid_features) , Features (https://drupal.org/project/features) and UUID (https://drupal.org/project/uuid) modules.

Once all those modules are enabled, go to example.com/admin/config/content/uuid_features (or on your administration menu go to Administration –> Content Authoring –> UUID Features Integration, and under “Exportable Taxonomy term bundles” check the boxes for the relevant taxonomy terms.

Go to your features export page at example.com/admin/structure/features/ (or on your administration menu go to Administration –> Structure –> Features), create/recreate the feature and you’ll see “Taxonomy Terms” listed.

Happy exporting!!

Adding Internode email accounts to Airmail

I finally found out the settings to get Airmail to work with the Internode email service – the email address is username@internode.on.net and you use your “username” as the username for the login credentials (as you do for the account preferences). Leave the ports blank and Airmail figures out the rest!

airmail internode

A HTML template for Drupal module reviews

…. Because I am so painfully lazy, here is a template for reviewing Drupal modules following the guidance at https://drupal.org/node/1587704.

<strong>Issues Summary</strong>
<ul>
<li></li>
<li></li>
<li></li>
</ul>

<strong>Basic application checks</strong>
<ul>
<li></li>
<li></li>
<li></li>
</ul>

<strong>Repository checks</strong>
<ul>
<li></li>
<li></li>
<li></li>
</ul>

<strong>Security review</strong>
<ul>
<li></li>
<li></li>
<li></li>
</ul>

<strong>Licensing checks</strong>
<ul>
<li></li>
<li></li>
<li></li>
</ul>

<strong>Documentation checks</strong>
<ul>
<li></li>
<li></li>
<li></li>
</ul>

<strong>Coding standards</strong>
<ul>
<li></li>
<li></li>
<li></li>
</ul>

<strong>API and best practices review</strong>
<ul>
<li></li>
<li></li>
<li></li>
</ul>

A quick way to import Natural Earth raster images to GeoServer

  • Start up your GeoServer instance and log in as an admin.
  • Go to Data –> Workplaces.
  • Click “Add new workplace”.
  • Enter a new name and URI.
  • Go to Data –> Stores
  • Click “Add new Store”
  • Click “WorldImage” (under Raster Data Sources)
  • Create a data source name and select the tiff file you want to upload.
  • Under “Coordinate Reference Systems”, pick one like “900913” (don’t know which one to use, but this one works?)
  • Click save.
  • If you want, go to Data -> Layer  Preview, and select the layer to see it in openlayers.