Skip to content

Commit 0bfe811

Browse files
Thoughtscriptzhendrikse
authored andcommitted
BAEL-456: Introduction to Spring Cloud CLI - Bash Scripts (eugenp#2745)
* BAEL-456: Introduction to Spring Cloud CLI - Bash Scripts * Readme added * Removed batch script artifacts
1 parent 4aaaf4c commit 0bfe811

File tree

10 files changed

+143
-0
lines changed

10 files changed

+143
-0
lines changed

spring-cloud-cli/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
=========
2+
3+
## Spring Cloud CLI
4+
5+
### Relevant Articles:
6+
- [Introduction to Spring Cloud CLI](http://www.baeldung.com/introduction-to-spring-cloud-cli/)

spring-cloud-cli/decrypt.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
echo Decrypting my_value as key my_key
3+
spring decrypt --key my_key
4+
echo
5+
echo You should see: \"my_value\"
6+
echo

spring-cloud-cli/encrypt.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
echo Encrypting my_value as key my_key
3+
spring encrypt my_value --key my_key
4+
echo
5+
echo You should see something like: c93cb36ce1d09d7d62dffd156ef742faaa56f97f135ebd05e90355f80290ce6b
6+
echo
7+
echo You can use: \"{cipher}c93cb36ce1d09d7d62dffd156ef742faaa56f97f135ebd05e90355f80290ce6b\" in your configuration files
8+
echo

spring-cloud-cli/groovy.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
echo "Run Groovy Rest API Server"
3+
echo "spring run restapi.groovy"
4+
echo "http://localhost:8080/api/get"
5+
spring run restapi.groovy
6+
echo
7+
echo "Run Groovy Eureka Server"
8+
echo "spring run eureka.groovy"
9+
echo "http://localhost:8761"
10+
spring run eureka.groovy
11+
echo

spring-cloud-cli/groovy/eureka.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@EnableEurekaServer
2+
class Eureka {}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@RestController
2+
@RequestMapping('/api')
3+
class api {
4+
@GetMapping('/get')
5+
def get() { [message: 'Hello'] }
6+
}

spring-cloud-cli/install.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env bash
2+
echo See: https://howtoprogram.xyz/2016/08/28/install-spring-boot-command-line-interface-on-linux/
3+
echo
4+
5+
echo "Setting up Java JDK 8"
6+
echo See: http://tipsonubuntu.com/2016/07/31/install-oracle-java-8-9-ubuntu-16-04-linux-mint-18/
7+
sudo add-apt-repository ppa:webupd8team/java
8+
sudo apt-get update
9+
sudo apt-get install oracle-java8-set-default
10+
echo
11+
12+
echo "Downloading Spring Boot CLI 1.5.7"
13+
wget http://repo.spring.io/release/org/springframework/boot/spring-boot-cli/1.5.7.RELEASE/spring-boot-cli-1.5.7.RELEASE-bin.tar.gz
14+
echo
15+
16+
echo "Extracting and Installing"
17+
sudo mkdir /opt/spring-boot
18+
sudo tar xzf spring-boot-cli-1.5.7.RELEASE-bin.tar.gz -C /opt/spring-boot
19+
export SPRING_HOME=/opt/spring-boot/spring-1.5.7.RELEASE
20+
export PATH=$SPRING_HOME/bin:$PATH
21+
source /etc/profile
22+
echo
23+
24+
echo "Verifying Install of Spring CLI"
25+
spring --version
26+
echo
27+
28+
echo "Maven Install"
29+
sudo apt-get install maven
30+
echo
31+
32+
echo "Installing JCE"
33+
sudo apt-get install p7zip-full
34+
echo please go to: http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html
35+
echo Download the jce_policy-8.zip after you agree to the terms
36+
sleep 25
37+
sudo 7z x jce_policy-8.zip
38+
sudo mv /usr/lib/jvm/java-8-oracle/jre/lib/security/local_policy.jar /usr/lib/jvm/java-8-oracle/jre/lib/security/local_policy.jar.backup
39+
sudo mv /usr/lib/jvm/java-8-oracle/jre/lib/security/US_export_policy.jar /usr/lib/jvm/java-8-oracle/jre/lib/security/US_export_policy.jar.backup
40+
sudo mv UnlimitedJCEPolicyJDK8/*.jar /usr/lib/jvm/java-8-oracle/jre/lib/security/
41+
echo
42+
43+
echo "Installing Spring Cloud CLI"
44+
sudo mkdir /opt/spring-boot/spring-1.5.7.RELEASE/lib/ext
45+
sudo chown -R $USER:$USER /opt/spring-boot/spring-1.5.7.RELEASE/lib/ext
46+
echo see: https://repo.spring.io/snapshot/org/springframework/cloud/spring-cloud-cli/ if manual install required
47+
spring install org.springframework.cloud:spring-cloud-cli:1.3.2.RELEASE
48+
echo
49+
50+
echo "Verify Installation"
51+
spring cloud --version
52+
echo

spring-cloud-cli/spring-cli-cmds.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
echo "Run Config Server"
3+
echo "spring cloud configserver"
4+
echo "http://localhost:8888"
5+
spring cloud configserver
6+
echo
7+
echo "Run Eureka Server"
8+
echo "spring cloud eureka"
9+
echo "http://localhost:8761"
10+
spring cloud eureka
11+
echo
12+
echo "Run H2 Server"
13+
echo "spring cloud h2"
14+
echo "http://localhost:9095"
15+
spring cloud h2
16+
echo
17+
echo "Run Kafka Server"
18+
echo "spring cloud kafka"
19+
echo "http://localhost:9091"
20+
spring cloud kafka
21+
echo
22+
echo "Run Zipkin Server"
23+
echo "spring cloud zipkin"
24+
echo "http://localhost:9411"
25+
spring cloud zipkin
26+
echo
27+
echo "Run Dataflow Server"
28+
echo "spring cloud dataflow"
29+
echo "http://localhost:9393"
30+
spring cloud dataflow
31+
echo
32+
echo "Run Hystrixdashboard Server"
33+
echo "spring cloud hystrixdashboard"
34+
echo "http://localhost:7979"
35+
spring cloud hystrixdashboard
36+
echo
37+
echo "List Services"
38+
echo "spring cloud --list"
39+
spring cloud --list
40+
echo

spring-cloud-cli/yml/configserver.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
spring:
2+
profiles:
3+
active: git
4+
cloud.config.server.git.uri: https://github.com/spring-cloud/spring-cloud-cli/tree/master/spring-cloud-launcher/spring-cloud-launcher-configserver

spring-cloud-cli/yml/eureka.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
spring:
2+
profiles:
3+
active: git
4+
cloud:
5+
config:
6+
server:
7+
git:
8+
uri: https://github.com/spring-cloud/spring-cloud-cli/tree/master/spring-cloud-launcher/spring-cloud-launcher-eureka

0 commit comments

Comments
 (0)