From f55bd014f9704d5fbb18fb5a9f227f571fa30a39 Mon Sep 17 00:00:00 2001 From: Thoughtscript Date: Tue, 21 Nov 2017 06:44:51 +0000 Subject: [PATCH] BAEL-1175 - Using a Spring Cloud App Starter Bash --- spring-cloud/README.md | 1 + .../bash/hadoop.sh | 42 +++++++++++++++++++ .../hdfs/application.properties | 1 + .../spring-cloud-stream-starters/hdfs/hdfs.sh | 14 +++++++ .../twitter/application.properties | 4 ++ .../twitter/twitter.sh | 15 +++++++ 6 files changed, 77 insertions(+) create mode 100644 spring-cloud/spring-cloud-stream-starters/bash/hadoop.sh create mode 100644 spring-cloud/spring-cloud-stream-starters/hdfs/application.properties create mode 100644 spring-cloud/spring-cloud-stream-starters/hdfs/hdfs.sh create mode 100644 spring-cloud/spring-cloud-stream-starters/twitter/application.properties create mode 100644 spring-cloud/spring-cloud-stream-starters/twitter/twitter.sh diff --git a/spring-cloud/README.md b/spring-cloud/README.md index 1b793144b1..523cf683c3 100644 --- a/spring-cloud/README.md +++ b/spring-cloud/README.md @@ -19,3 +19,4 @@ ### Relevant Articles: - [Introduction to Spring Cloud Rest Client with Netflix Ribbon](http://www.baeldung.com/spring-cloud-rest-client-with-netflix-ribbon) [An Introduction to Spring Cloud Zookeeper](http://www.baeldung.com/spring-cloud-zookeeper) + [Using a Spring Cloud App Starter](http://www.baeldung.com/using-a-spring-cloud-app-starter) \ No newline at end of file diff --git a/spring-cloud/spring-cloud-stream-starters/bash/hadoop.sh b/spring-cloud/spring-cloud-stream-starters/bash/hadoop.sh new file mode 100644 index 0000000000..5eebcca426 --- /dev/null +++ b/spring-cloud/spring-cloud-stream-starters/bash/hadoop.sh @@ -0,0 +1,42 @@ +# For Ubuntu 14.04 +# Inspired from: https://github.com/curran/setupHadoop/blob/master/setupHadoop.sh +# Use from the user directory + +# Install Java +sudo apt-get update +sudo add-apt-repository -y ppa:webupd8team/java +sudo apt-get install -y oracle-java8-installer + +# Install Hadoop +curl -O http://mirror.cogentco.com/pub/apache/hadoop/common/hadoop-2.8.2/hadoop-2.8.2.tar.gz +tar xfz hadoop-2.8.2.tar.gz +sudo mv hadoop-2.8.2 /usr/local/hadoop +rm hadoop-2.8.2.tar.gz + +# Environmental Variables +echo export JAVA_HOME=/usr/lib/jvm/java-8-oracle >> ~/.bashrc +echo export HADOOP_PREFIX=/usr/local/hadoop >> ~/.bashrc +echo export PATH=\$PATH:/usr/local/hadoop/bin >> ~/.bashrc +echo export PATH=\$PATH:/usr/local/hadoop/sbin >> ~/.bashrc +source ~/.bashrc + +# Copy configuration files +cp master/* /usr/local/hadoop/etc/hadoop/ + +# Format HDFS +hdfs namenode -format + +# SSH keys for Hadoop to use. +ssh-keygen -t rsa -P 'password' -f ~/.ssh/id_rsa.pub +sudo mv ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys + +# SSH +ssh localhost +# Authenticate with local user + +# Start NameNode daemon and DataNode daemon +start-dfs.sh +# stop-dfs.sh + +# Install Maven +sudo apt-get install maven diff --git a/spring-cloud/spring-cloud-stream-starters/hdfs/application.properties b/spring-cloud/spring-cloud-stream-starters/hdfs/application.properties new file mode 100644 index 0000000000..8b421f954c --- /dev/null +++ b/spring-cloud/spring-cloud-stream-starters/hdfs/application.properties @@ -0,0 +1 @@ +hdfs.fs-uri=http://osboxes:50075 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-stream-starters/hdfs/hdfs.sh b/spring-cloud/spring-cloud-stream-starters/hdfs/hdfs.sh new file mode 100644 index 0000000000..3c45391f75 --- /dev/null +++ b/spring-cloud/spring-cloud-stream-starters/hdfs/hdfs.sh @@ -0,0 +1,14 @@ +# Git spring-cloud-stream-app-starters +git clone https://github.com/spring-cloud/spring-cloud-stream-app-starters.git + +# Navigate to HDFS +cd /hdfs + +# Navigate to the the app configuration settings +cd /spring-cloud-starter-stream-sink-hdfs/src/main/java/org/springframework/cloud/stream/app/hdfs/sink/HdfsSinkProperties.java +# Specify the properties you want there +# or inject the application.properties file before building the app + +# Then build the customized starter app +cd ../../../../../../../../../../../../../ +mvn clean install \ No newline at end of file diff --git a/spring-cloud/spring-cloud-stream-starters/twitter/application.properties b/spring-cloud/spring-cloud-stream-starters/twitter/application.properties new file mode 100644 index 0000000000..5cfedee80e --- /dev/null +++ b/spring-cloud/spring-cloud-stream-starters/twitter/application.properties @@ -0,0 +1,4 @@ +twitter.credentials.access-token=932486336086286336-2HURQbA2cYzX5hixgAshIBy2Dhefupn +twitter.credentials.access-token-secret=0pyZ7etHvro8x85QSXxsqYFzYk63bK6DS5nNYy0R3l1io +twitter.credentials.consumer-key=10xCXkRYi5xLFYq3P0ymWGEwJ +twitter.credentials.consumer-secret=VfyCUcGfAQ2aWcd3uTg8GmVGyhUfAcNJU6ksG09TAtPMqhmWTS \ No newline at end of file diff --git a/spring-cloud/spring-cloud-stream-starters/twitter/twitter.sh b/spring-cloud/spring-cloud-stream-starters/twitter/twitter.sh new file mode 100644 index 0000000000..c3d16bb92e --- /dev/null +++ b/spring-cloud/spring-cloud-stream-starters/twitter/twitter.sh @@ -0,0 +1,15 @@ +# Git spring-cloud-stream-app-starters +git clone https://github.com/spring-cloud/spring-cloud-stream-app-starters.git + +# Navigate to Twitter +cd /twitter + +# Navigate to the the app configuration settings +cd /spring-cloud-starter-stream-source-twitterstream/src/main/java/org/springframework/cloud/stream/app/twitterstream/source/TwitterStreamProperties.java +cd /spring-cloud-stream-app-starters/app-starters-common/app-starters-twitter-common/src/main/java/org/springframework/cloud/stream/app/twitter/TwitterCredentials.java +# Specify the properties you want there +# or inject the application.properties file before building the app + +# Then build the customized starter app +cd ../../../../../../../../../../../../ +mvn clean install \ No newline at end of file