Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@ packer_virtualbox-ovf_virtualbox.box
**/target/*

.credentials
.idea
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,30 @@ Udacity and Twitter bring you Real-Time Analytics with Apache Storm

Join the course for free:
www.udacity.com/course/ud381


### Serge's changes

- updated to point to fixed apache storm repo
- added provision task for vagrant
- run or re-run vagrant provision --provision-with bootstrap - will remove old, reinstall storm
- run or re-run vagrant provision --provision-with jdk8 - this will upgrade to jdk8 and set it to default


- Install JDK 8 since default is 6
- sudo apt-get install software-properties-common python-software-properties
- sudo add-apt-repository ppa:webupd8team/java
- sudo apt-get update
- sudo apt-get install oracle-java8-installer




### Environmental variables need to be set:

=====

export TWITTER_CKEY=...
export TWITTER_SKEY=...
export TWITTER_TOKEN=..
export TWITTER_SECRET=...
7 changes: 7 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,11 @@ VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "udacity/ud381"
config.vm.network :forwarded_port, guest: 5000, host: 5000
#config.vm.provision :shell, path: "bootstrap.sh"


config.vm.provision 'bootstrap', type: :shell, path: "bootstrap.sh"
config.vm.provision 'jdk8', type: :shell, path: "jdk8.sh"


end
24 changes: 16 additions & 8 deletions provision.sh → bootstrap.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -i
#!/usr/bin/env bash

# The following are documented (and stolen from) here:
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
Expand All @@ -18,12 +18,20 @@ sudo apt-get -y install default-jdk maven vim zookeeper zookeeperd redis-server

sudo pip install flask redis

echo "Storm..."
# TODO maybe make this use the best mirror always?
echo "Storm.."


sudo rm -rf /opt/storm 2> /dev/null | echo "Removed old"
sudo rm /usr/bin/storm 2> /dev/null | echo "Removed old"



sudo mkdir /opt/storm
cd /opt/storm
sudo wget http://mirror.cogentco.com/pub/apache/incubator/storm/apache-storm-0.9.2-incubating/apache-storm-0.9.2-incubating.tar.gz
sudo tar xvzf apache-storm-0.9.2-incubating.tar.gz
sudo rm apache-storm-0.9.2-incubating.tar.gz
sudo chmod +x /opt/storm/apache-storm-0.9.2-incubating/bin/storm
sudo ln -s /opt/storm/apache-storm-0.9.2-incubating/bin/storm /usr/bin/storm

# -q option will supress progress
sudo wget -q http://apache.mirror.vexxhost.com/storm/apache-storm-0.9.3/apache-storm-0.9.3.tar.gz
sudo tar xvzf apache-storm-0.9.3.tar.gz
sudo rm apache-storm-0.9.3.tar.gz
sudo chmod +x /opt/storm/apache-storm-0.9.3/bin/storm
sudo ln -s /opt/storm/apache-storm-0.9.3/bin/storm /usr/bin/storm
22 changes: 22 additions & 0 deletions jdk8.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

# - Install JDK 8 since default is 6
# - sudo apt-get install software-properties-common python-software-properties
# - sudo add-apt-repository ppa:webupd8team/java
# - sudo apt-get --yes update
# - sudo apt-get --yes --force-yes install oracle-java8-installer
# - sudo apt-get --yes --force-yes install oracle-java8-set-default
# - sudo apt-get --yes update




sudo apt-get install software-properties-common python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get --yes update
sudo apt-get --yes --force-yes install oracle-java8-installer
sudo apt-get --yes --force-yes install oracle-java8-set-default
sudo apt-get --yes upgrade


echo "Done "
138 changes: 72 additions & 66 deletions lesson1/stage1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,75 +27,81 @@

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert-core</artifactId>
<version>2.0M8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jmock</groupId>
<artifactId>jmock</artifactId>
<version>2.6.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.storm</groupId>
<artifactId>storm-core</artifactId>
<version>0.9.2-incubating</version>
<!-- keep storm out of the jar-with-dependencies -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>15.0</version>
</dependency>
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-core</artifactId>
<version>[3.0,)</version>
</dependency>
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-stream</artifactId>
<version>[3.0,)</version>
</dependency>
<groupId>com.lambdaworks</groupId>
<artifactId>lettuce</artifactId>
<version>2.3.3</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert-core</artifactId>
<version>2.0M8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jmock</groupId>
<artifactId>jmock</artifactId>
<version>2.6.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.storm</groupId>
<artifactId>storm-core</artifactId>
<version>0.9.3</version>
<!-- keep storm out of the jar-with-dependencies -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>15.0</version>
</dependency>
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-core</artifactId>
<version>[3.0,)</version>
</dependency>
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-stream</artifactId>
<version>[3.0,)</version>
</dependency>
<!--
COPY AND PASE: lettuce (redis) here: pom.xml file (located lesson1/stage1/pom.xml)
-->
</dependencies>
-->
</dependencies>

<build>
<sourceDirectory>src/jvm</sourceDirectory>
<plugins>
<build>
<sourceDirectory>src/jvm</sourceDirectory>
<plugins>
<!--
Bind the maven-assembly-plugin to the package phase
this will create a jar file without the storm dependencies
suitable for deployment to a cluster.
-->
-->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
Expand Down Expand Up @@ -172,11 +178,11 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<!-- or whatever version you use -->
<!-- or whatever version you use -->
<source>1.7</source>
<target>1.7</target>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,23 @@

import java.util.Map;


import com.lambdaworks.redis.RedisClient;

import com.lambdaworks.redis.RedisConnection;



//********* TO DO 1-of-4 imported http://mvnrepository.com/artifact/com.lambdaworks/lettuce/


// COPY AND PASE: following code into pom.xml file (located lesson1/stage1/pom.xml)
//<dependency>
// <dependency>
// <groupId>com.lambdaworks</groupId>
// <artifactId>lettuce</artifactId>
// <version>2.3.3</version>
//</dependency>
//
// </dependency>

//********* END 1-of-4

/**
Expand Down Expand Up @@ -54,7 +61,7 @@ public static class ExclamationBolt extends BaseRichBolt
//********* TO DO 2-of-4
// place holder to keep the connection to redis


RedisConnection<String,String> redis;
//********* END 2-of-4

@Override
Expand All @@ -68,9 +75,9 @@ public void prepare(

//********* TO DO 3-of-4
// instantiate a redis connection

RedisClient client = new RedisClient("localhost",6379);
// initiate the actual connection

redis = client.connect();
//********* END 3-of-4
}

Expand All @@ -88,8 +95,8 @@ public void execute(Tuple tuple)
_collector.emit(tuple, new Values(exclamatedWord.toString()));

//********* TO DO 4-of-4 Uncomment redis reporter
//long count = 30;
//redis.publish("WordCountTopology", exclamatedWord.toString() + "|" + Long.toString(count));
long count = 30;
redis.publish("WordCountTopology", exclamatedWord.toString() + "|" + Long.toString(count));
//********* END 4-of-4
}

Expand Down
Loading