-
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.
[FEAT] #26 - Create script and yaml for aws codedeploy
- Loading branch information
Showing
3 changed files
with
59 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
version: 0.0 | ||
os: linux | ||
|
||
files: | ||
- source: / | ||
destination: /home/ubuntu/jampick | ||
permissions: | ||
- object: /home/ubuntu/jampick | ||
owner: ubuntu | ||
group: ubuntu | ||
mode: 755 | ||
hooks: | ||
BeforeInstall: | ||
- location: scripts/database.sh | ||
timeout: 60 | ||
runas: root | ||
AfterInstall: | ||
- location: scripts/deploy.sh | ||
timeout: 60 | ||
runas: root |
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,17 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [ ! "$(docker ps -q -f name=my-mysql)" ]; then | ||
if [ "$(docker ps -aq -f status=exited -f name=my-mysql)" ]; then | ||
echo "cleanup" | ||
docker rm my-mysql | ||
fi | ||
echo "run your container" | ||
docker run -d --name my-mysql my-docker- | ||
docker run --name my-mysql \ | ||
-e MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD \ | ||
-e MYSQL_DATABASE=jampick \ | ||
-v /home/ubuntu/mysql:/var/lib/mysql \ | ||
-d mysql:5.7 \ | ||
--character-set-server=utf8mb4 \ | ||
--collation-server=utf8mb4_unicode_ci | ||
fi |
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,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
REPOSITORY=/home/ubuntu/jampick | ||
cd $REPOSITORY | ||
|
||
APP_NAME=action_codedeploy | ||
JAR_NAME=$(ls $REPOSITORY/build/libs/ | grep '.jar' | tail -n 1) | ||
JAR_PATH=$REPOSITORY/build/libs/$JAR_NAME | ||
|
||
CURRENT_PID=$(pgrep -f $APP_NAME) | ||
|
||
if [ -z $CURRENT_PID ] | ||
then | ||
echo "> 종료할것 없음." | ||
else | ||
echo "> kill -9 $CURRENT_PID" | ||
kill -15 $CURRENT_PID | ||
sleep 5 | ||
fi | ||
|
||
echo "> $JAR_PATH 배포" | ||
nohup java -jar $JAR_PATH > /dev/null 2> /dev/null < /dev/null & |