-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
release: v0.0.7
- Loading branch information
Showing
5 changed files
with
127 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
PROJECT_ROOT=/home/ubuntu/app | ||
DEPLOY_PATH=$PROJECT_ROOT/deploy | ||
DEPLOY_LOG=$DEPLOY_PATH/deploy.log | ||
|
||
CURRENT_PROFILE=$(curl -s http://localhost/api/profile) | ||
echo "[ $(date +%c) ] ํ์ฌ ๊ตฌ๋ ์ค์ธ Profile: $CURRENT_PROFILE" >> $DEPLOY_LOG | ||
if [ "$CURRENT_PROFILE" == prod1 ] | ||
then | ||
CURRENT_PORT=8081 | ||
IDLE_PROFILE=prod2 | ||
IDLE_PORT=8082 | ||
elif [ "$CURRENT_PROFILE" == prod2 ] | ||
then | ||
CURRENT_PORT=8082 | ||
IDLE_PROFILE=prod1 | ||
IDLE_PORT=8081 | ||
else | ||
echo "> ์ผ์นํ๋ Profile์ด ์์ต๋๋ค. Profile: $CURRENT_PROFILE" | ||
echo "> prod1์ ํ ๋นํฉ๋๋ค." | ||
IDLE_PROFILE=prod1 | ||
IDLE_PORT=8081 | ||
fi | ||
|
||
echo "[ $(date +%c) ] Nginx Current Profile / Port: $CURRENT_PROFILE / $CURRENT_PORT" | ||
echo "[ $(date +%c) ] ์ ํํ Profile / Port: $IDLE_PROFILE / $IDLE_PORT" | ||
echo "[ $(date +%c) ] set \$service_url http://localhost:${IDLE_PORT};" | sudo tee /etc/nginx/conf.d/service-url.inc | ||
|
||
echo "[ $(date +%c) ] Nginx Reload" | ||
sudo service nginx reload | ||
|
||
CURRENT_PROFILE=$(curl -s http://localhost/api/profile) | ||
echo "[ $(date +%c) ] Nginx Current Profile: $CURRENT_PROFILE" |
21 changes: 21 additions & 0 deletions
21
src/main/java/com/verby/indp/global/profile/ProfileController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.verby.indp.global.profile; | ||
|
||
import java.util.Arrays; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.core.env.Environment; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
public class ProfileController { | ||
|
||
private final Environment environment; | ||
|
||
@GetMapping("/profile") | ||
public String profile() { | ||
return Arrays.stream(environment.getActiveProfiles()) | ||
.findFirst() | ||
.orElse(""); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters