Support
Quality
Security
License
Reuse
kandi has reviewed piggymetrics and discovered the below as its top functions. This is intended to give you an instant insight into piggymetrics implemented functionality, and help decide if they suit your requirements.
Microservice Architecture with Spring Boot, Spring Cloud and Docker
Config service
spring:
application:
name: notification-service
cloud:
config:
uri: http://config:8888
fail-fast: true
Auth service
@PreAuthorize("#oauth2.hasScope('server')")
@RequestMapping(value = "accounts/{name}", method = RequestMethod.GET)
public List<DataPoint> getStatisticsByAccountName(@PathVariable String name) {
return statisticsService.findByAccountName(name);
}
API Gateway
zuul:
routes:
notification-service:
path: /notifications/**
serviceId: notification-service
stripPrefix: false
Service discovery
spring:
application:
name: notification-service
Load balancer, Circuit breaker and Http client
@FeignClient(name = "statistics-service")
public interface StatisticsServiceClient {
@RequestMapping(method = RequestMethod.PUT, value = "/statistics/{accountName}", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
void updateStatistics(@PathVariable("accountName") String accountName, Account account);
}
Distributed tracing
2018-07-26 23:13:49.381 WARN [gateway,3216d0de1384bb4f,3216d0de1384bb4f,false] 2999 --- [nio-4000-exec-1] o.s.c.n.z.f.r.s.AbstractRibbonCommand : The Hystrix timeout of 20000ms for the command account-service is set lower than the combination of the Ribbon read and connect timeout, 80000ms.
2018-07-26 23:13:49.562 INFO [account-service,3216d0de1384bb4f,404ff09c5cf91d2e,false] 3079 --- [nio-6000-exec-1] c.p.account.service.AccountServiceImpl : new account has been created: test
How to run the shellscript with -z parameters?
test -z "$MONGODB_PASSWORD"
MONGODB_PASSWORD="password" ./init.sh
-----------------------
test -z "$MONGODB_PASSWORD"
MONGODB_PASSWORD="password" ./init.sh
Caused by: java.lang.ClassNotFoundException: org.springframework.messaging.converter.MessageConverter in microservices
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ monitoring ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\Users\pc\Desktop\My_MicroServices\PPP\PiggyMetrics-master\monitoring\target\classes
[ERROR] error reading C:\Users\pc\.m2\repository\io\projectreactor\ipc\reactor-netty\0.7.8.RELEASE\reactor-netty-0.7.8.RELEASE.jar; invalid LOC header (bad signature)
[ERROR] error reading C:\Users\pc\.m2\repository\org\springframework\spring-messaging\5.0.7.RELEASE\spring-messaging-5.0.7.RELEASE.jar; invalid LOC header (bad signature)
[INFO]
[INFO] --- maven-resources-plugin:3.0.1:testResources (default-testResources) @ monitoring ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ monitoring ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\Users\pc\Desktop\My_MicroServices\PPP\PiggyMetrics-master\monitoring\target\test-classes
[ERROR] error reading C:\Users\pc\.m2\repository\io\projectreactor\ipc\reactor-netty\0.7.8.RELEASE\reactor-netty-0.7.8.RELEASE.jar; invalid LOC header (bad signature)
[ERROR] error reading C:\Users\pc\.m2\repository\org\springframework\spring-messaging\5.0.7.RELEASE\spring-messaging-5.0.7.RELEASE.jar; invalid LOC header (bad signature)
java.lang.IllegalStateException: Could not locate PropertySource and the fail fast property is set, failing in Microservices
spring:
application:
name: <name>
cloud:
config:
uri: http://host:port
fail-fast: true
password: <password>
username: <user>
QUESTION
How to run the shellscript with -z parameters?
Asked 2018-Sep-05 at 19:52How to run below shell scripts which name is init.sh
? I am running this sheel script like this ./init.sh test123
and its giving me the message MONGODB_PASSWORD not defined
. Being new to the shell-script, I am not aware what does this mean ?
-z ==>
Checks if the given string operand size is zero; if it is zero length, then it returns true.
Actual File details:
#!/bin/bash
if test -z "$MONGODB_PASSWORD"; then
echo "MONGODB_PASSWORD not defined"
exit 1
fi
auth="-u user -p $MONGODB_PASSWORD"
# MONGODB USER CREATION
(
echo "setup mongodb auth"
create_user="if (!db.getUser('user')) { db.createUser({ user: 'user', pwd: '$MONGODB_PASSWORD', roles: [ {role:'readWrite', db:'piggymetrics'} ]}) }"
until mongo piggymetrics --eval "$create_user" || mongo piggymetrics $auth --eval "$create_user"; do sleep 5; done
killall mongod
sleep 1
killall -9 mongod
) &
# INIT DUMP EXECUTION
(
if test -n "$INIT_DUMP"; then
echo "execute dump file"
until mongo piggymetrics $auth $INIT_DUMP; do sleep 5; done
fi
) &
echo "start mongodb without auth"
chown -R mongodb /data/db
gosu mongodb mongod "$@"
echo "restarting with auth on"
sleep 5
exec gosu mongodb /usr/local/bin/docker-entrypoint.sh --auth "$@"
EDIT-1: cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
export JAVA_HOME=/opt/jdk1.8.0_181
export M2_HOME=/usr/local/apache-maven-3.5.4
export MAVEN_OPTS=-Xms256m -Xmx512m
export M2=$M2_HOME/bin
# THIS IS SETTING TO RUN THE PiggyMetrix
export CONFIG_SERVICE_PASSWORD=test123
export NOTIFICATION_SERVICE_PASSWORD=test123
export STATISTICS_SERVICE_PASSWORD=test123
export ACCOUNT_SERVICE_PASSWORD=test123
export MONGODB_PASSWORD=test123
export PATH=$M2:$PATH:/opt/jdk1.8.0_181/bin/:$HOME/.local/bin:$HOME/bin
I am using
uname -a
Linux ech-10-XX-XX-11 4.1.12-61.1.18.el7uek.x86_64 #2 SMP Fri Nov 4 15:48:30 PDT 2016 x86_64 x86_64 x86_64 GNU/Linux
EDIT-2:
[dc-user@ech-10-XX-XX-11 ~]$ whoami
dc-user
[dc-user@ech-10-XX-XX-11 ~]$ ls -ltra
total 8664
-rw-r--r-- 1 dc-user dc-user 231 Oct 7 2016 .bashrc
-rw-r--r-- 1 dc-user dc-user 18 Oct 7 2016 .bash_logout
drwxrwxr-x 3 dc-user dc-user 23 Sep 5 13:43 .m2
-rw-r--r-- 1 dc-user dc-user 677 Sep 5 13:56 .bash_profile
-rw------- 1 dc-user dc-user 3478 Sep 5 13:56 .viminfo
drwx------ 8 dc-user dc-user 4096 Sep 5 13:56 .
ANSWER
Answered 2018-Sep-05 at 19:52With
test -z "$MONGODB_PASSWORD"
you are testing if the variable $MONGODB_PASSWORD
is not empty.
Before running the script you will have to store your password in the variable:
MONGODB_PASSWORD="password" ./init.sh
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
No vulnerabilities reported
Save this library and start creating your kit
Explore Related Topics
Save this library and start creating your kit