Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

๐Ÿ“ docs: CI/CD ์Šคํฌ๋ฆฝํŠธ ์ˆ˜์ • #80

Merged
merged 36 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
6957e9b
Merge pull request #65 from WaitherTeam/develop
DDonghyeo May 23, 2024
6c5e657
Deployment 2
DDonghyeo May 23, 2024
de0a88f
Deployment 3
DDonghyeo May 23, 2024
046a340
Deployment 4
DDonghyeo May 23, 2024
9aa4750
Deployment 5
DDonghyeo May 23, 2024
a2f4e11
Deploy
DDonghyeo May 24, 2024
8e9b3cd
Deploy
DDonghyeo May 24, 2024
aee8164
Deploy
DDonghyeo May 24, 2024
843fdc5
Deploy
DDonghyeo May 24, 2024
3dc6afc
๐Ÿ“docs : docker-compose port ๋ณ€๊ฒฝ
DDonghyeo May 24, 2024
102dcff
๐Ÿ“docs : docker image ์บ์‹œ ์ œ๊ฑฐ
DDonghyeo May 25, 2024
e96d6ee
๐Ÿ“docs : changed port
DDonghyeo May 25, 2024
1cbf40c
๐Ÿ“docs : print bootstrap
DDonghyeo May 25, 2024
8ab5821
๐Ÿ“docs : print bootstrap
DDonghyeo May 25, 2024
b917950
๐Ÿ“docs : changed port
DDonghyeo May 25, 2024
5e8f6c4
๐Ÿ“docs : docker build withouth cache
DDonghyeo May 25, 2024
0a8ad14
๐Ÿ“docs : Dockerfile ์ˆ˜์ •
DDonghyeo May 25, 2024
e91e2d9
๐Ÿ“docs : gradle build problem
DDonghyeo May 25, 2024
45db6c3
๐Ÿ“docs : noti build name
DDonghyeo May 25, 2024
bf976d8
๐Ÿ“docs : noti build name
DDonghyeo May 25, 2024
7beb80f
๐Ÿ“docs : noti build name
DDonghyeo May 25, 2024
a102dc7
๐Ÿ“docs : noti build name
DDonghyeo May 25, 2024
6b073e4
๐Ÿ“docs : ci/cd ์—๋Ÿฌ ์ˆ˜์ •
DDonghyeo May 25, 2024
b9b1bf5
๐Ÿ“docs : build ์„ค์ • ์ˆ˜์ •
DDonghyeo May 25, 2024
458070f
๐Ÿ“docs : ์Šคํฌ๋ฆฝํŠธ ๋ณ€๊ฒฝ
DDonghyeo May 25, 2024
adaaabd
๐Ÿ“docs : ์Šคํฌ๋ฆฝํŠธ ๋ณ€๊ฒฝ
DDonghyeo May 25, 2024
df8ee07
๐Ÿ“docs : yml
DDonghyeo May 26, 2024
5d1043d
๐Ÿ“docs : private key path
DDonghyeo May 26, 2024
f36d4ed
๐Ÿ“docs : private key path
DDonghyeo May 26, 2024
9366c06
๐Ÿ“docs : kafka server
DDonghyeo May 26, 2024
f8911f3
๐Ÿ“docs : private key
DDonghyeo May 26, 2024
9096399
๐Ÿ“docs : private key
DDonghyeo May 26, 2024
ae95943
๐Ÿ“docs : private key
DDonghyeo May 26, 2024
8df16db
๐Ÿ“docs : yml
DDonghyeo May 26, 2024
bc64dca
๐Ÿ“docs : last test
DDonghyeo May 26, 2024
f265563
Merge pull request #79 from WaitherTeam/prod
DDonghyeo May 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 24 additions & 16 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: prod

#Setting JDK
- name: Set up JDK 17
Expand All @@ -47,13 +45,13 @@ jobs:
chmod +x ./weather-service/gradlew

#Setting yml
- name: Settings for config service
run: |
cd ./config-service/src/main/resources
touch ./bootstrap.yml
echo "${{ secrets.CONFIG_APPLICATION_YML }}" > ./bootstrap.yml
cd
# - name: Settings for config service
# run: |
# cd ./config-service/src/main/resources
# touch ./bootstrap.yml
# echo "${{ secrets.CONFIG_APPLICATION_YML }}" > ./bootstrap.yml
# cat bootstrap.yml

# DockerHub Login
- name: Docker Hub Login
uses: docker/login-action@v2
Expand Down Expand Up @@ -87,7 +85,7 @@ jobs:
run: |
cd apiGateway-service
./gradlew clean build -x test
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/waither-gateway .
docker build --no-cache -t ${{ secrets.DOCKERHUB_USERNAME }}/waither-gateway .
docker push ${{ secrets.DOCKERHUB_USERNAME }}/waither-gateway
cd ..

Expand All @@ -104,8 +102,9 @@ jobs:
- name: Build with Gradle - noti-service
run: |
cd noti-service
cat src/main/resources/bootstrap.yml
./gradlew clean build -x test
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/waither-noti .
docker build --no-cache -t ${{ secrets.DOCKERHUB_USERNAME }}/waither-noti .
docker push ${{ secrets.DOCKERHUB_USERNAME }}/waither-noti
cd ..

Expand All @@ -114,7 +113,7 @@ jobs:
run: |
cd user-service
./gradlew clean build -x test
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/waither-user .
docker build --no-cache -t ${{ secrets.DOCKERHUB_USERNAME }}/waither-user .
docker push ${{ secrets.DOCKERHUB_USERNAME }}/waither-user
cd ..

Expand All @@ -123,7 +122,7 @@ jobs:
run: |
cd weather-service
./gradlew clean build -x test
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/waither-weather .
docker build --no-cache -t ${{ secrets.DOCKERHUB_USERNAME }}/waither-weather .
docker push ${{ secrets.DOCKERHUB_USERNAME }}/waither-weather
cd ..

Expand All @@ -147,8 +146,17 @@ jobs:
export CONFIG_PASSPHRASE=${{ secrets.CONFIG_PASSPHRASE }}
export DOCKERHUB_USERNAME=${{ secrets.DOCKERHUB_USERNAME }}

bash /home/docker_init.sh
bash /home/common.sh
bash /home/deploy.sh
cd /home

docker-compose pull
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/waither-config
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/waither-gateway
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/waither-noti
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/waither-user
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/waither-weather

bash ./docker_init.sh
bash ./common.sh
bash ./deploy.sh

docker image prune -f
4 changes: 2 additions & 2 deletions apiGateway-service/src/main/resources/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ spring:
active: dev
cloud:
config:
uri: http://config:8888
uri: http://localhost:8888
name: database-apiGateway, redis, jwt
kafka:
bootstrap-servers: "localhost:9092"
bootstrap-servers: "http://localhost:9092"
consumer:
group-id: "GroupId"

Expand Down
60 changes: 57 additions & 3 deletions config-service/src/main/resources/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,68 @@ server:

spring:
profiles:
active: dev
active: prod
application:
name: config-service
name: config-services
cloud:
config:
server:
git:
uri: ${CONFIG_GIT_URI}
ignore-local-ssh-settings: true
passphrase: ${CONFIG_PASSPHRASE}
private-key: ${CONFIG_PRIVATE_KEY}
private-key: |
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-128-CBC,58151ECC53694263F35EEA88FBFA6406

2cstlc5/bYHUAJWg0PL7UbGksDp1okrJXqgBWcTqrH5qQm/iSk/LhYxF1JxGqPwt
fEWmuoGJgcJzaW80ivkBUbWUPdO5V9WHebynjFO5xUWJssGvmV4TEPGmLEKGpDSr
t1ae00AO/2YsyqTrCffDzu3S8R6A4IOSYE17Yx6P4z9xnnBJ4IG6d5Q6MVaQllMO
7wx03NCMWLc41tQA8zWlOAC1KgIvxV7XcrbhWVQpwwQ5MD10XW6lk9UDH7Zo46Dx
na3+6mAmqZ/kIKxGF2J2TImfCWyehvo+Epw9s87snXu+XDlNMrsXLW+NJ0IQ76OS
lZPpMjJVOnB0BctF4VZuzKDYkN2/+V7BgJT/Ybc2PwhYqs9aSo083ByxcsRSY0Mh
uwW6Sxbkeo8gTzWrBvbf2XLVjhuG9fLLYR2wq5+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b/tJ3Piwe9SjTMfJxQ02n1w9vu6
FvWasxcPAfhf5lKRc1cojg9w+E37G9qdwWYRAKWXiL4Fctfd05uLorXDLed16Cji
bK6/6X1xyH8o7uzxQigzct1TGk/rgaONMSv3fO+8vWJ0bj+TZOMwl4IAMD/QnR6a
Hkr5T8KjSeytETyoCRHcn3rUSX7SW9EPKxfI805SvkmETl5gtCWh1Ebj8KlO8KG/
riReQi9WCOII3v4d8+m3PgDODG7uu49zKYUnnbABqER2ONp3W4IkQXUfJbY1vmZW
XvyYMOEW42ZXs58groe299LNdUG02etMPyU6vfRaFJbAWx6cv9cUuw90A2I1I9RD
CEmp0e4aLr2JHZxuCp2sR8F2he5JEMawWgwrdp+YNkeJMLq1UEgzX7pqkpvxa06a
JS3AF8O2A++BkxE8toSQb95arbaAWC0G+ZR26FwSuMVSR2SYsyPv/72CRmuLROyG
wFwfI0YMgWCHWGli8L7Nzae/aVnPpM8rxj2QXGjcN/sdUWdGDfps63/ZDLRUuUD5
nfTYJLdW2wN67cExKjVOEJRJ01l75sCoqlZWtjuzTdoS7uFEgw9avZYtu8dqE7+R
-----END RSA PRIVATE KEY-----
73 changes: 42 additions & 31 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,76 +2,81 @@ version: '3'

services:

# nginx:
# container_name: nginx
# image: nginx:latest
# ports:
# - "80:80"
# volumes:
# - /home/ec2-user/nginx.conf:/etc/nginx/nginx.conf
# depends_on:
# - "db"
# restart: always #ํ•ญ์ƒ ์žฌ์‹คํ–‰

api-gateway:
container_name: api-gateway
image: ${DOCKERHUB_USERNAME}/waither-gateway
expose:
- "8000"
image: ${DOCKERHUB_USERNAME}/waither-gateway:latest
network_mode: host
depends_on:
- config
ports:
- "8000:8000"
# restart: always
restart: no
volumes:
- /home/ec2-user/logs/api-gateway:/logs


config:
container_name: config
image: ${DOCKERHUB_USERNAME}/waither-config
expose:
- "8888"
image: ${DOCKERHUB_USERNAME}/waither-config:latest
network_mode: host
ports:
- "8888:8888"
depends_on:
- eureka
environment:
CONFIG_GIT_URI : ${CONFIG_GIT_URI}
CONFIG_PASSPHRASE : ${CONFIG_PASSPHRASE}
# CONFIG_PRIVATE_KEY_DIR : ${CONFIG_PRIVATE_KEY_DIR}
# restart: always
restart: no
volumes:
- /home/ec2-user/logs/config:/logs

eureka:
container_name: eureka
image: ${DOCKERHUB_USERNAME}/waither-eureka
expose:
- "8761"
image: ${DOCKERHUB_USERNAME}/waither-eureka:latest
network_mode: host
ports:
- "8761:8761"
# restart: always
restart: no
volumes:
- /home/ec2-user/logs/eureka:/logs

user-service:
container_name: user-service
image: ${DOCKERHUB_USERNAME}/waither-user
expose:
- "8080"
image: ${DOCKERHUB_USERNAME}/waither-user:latest
network_mode: host
depends_on:
- config
ports:
- "8080:8080"
# restart: unless-stopped #์ˆ˜๋™์œผ๋กœ ์ค‘์ง€๋˜์ง€ ์•Š๋Š” ์ด์ƒ ํ•ญ์ƒ ์žฌ์‹คํ–‰
restart: no
volumes:
- /home/ec2-user/logs/user-service:/logs

weather-service:
container_name: weather-service
image: ${DOCKERHUB_USERNAME}/waither-weather
expose:
- "8081"
image: ${DOCKERHUB_USERNAME}/waither-weather:latest
network_mode: host
depends_on:
- config
ports:
- "8081:8081"
# restart: unless-stopped
restart: no
volumes:
- /home/ec2-user/logs/weather-service:/logs
- /home/ec2-user/logs/weather-service:/logs:latest

noti-service:
container_name: noti-service
image: ${DOCKERHUB_USERNAME}/waither-noti
expose:
- "8082"
image: ${DOCKERHUB_USERNAME}/waither-noti:latest
network_mode: host
depends_on:
- config
ports:
- "8082:8082"
# restart: unless-stopped
restart: no
volumes:
Expand All @@ -93,3 +98,9 @@ services:
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
volumes:
- /var/run/docker.sock:/var/run/docker.sock

redis:
image: redis
container_name: redis
ports:
- "6379:6379"
4 changes: 2 additions & 2 deletions noti-service/src/main/resources/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spring:
active: dev
cloud:
config:
uri: http://config:8888
uri: http://localhost:8888
name: database-noti,redis
kafka:
bootstrap-servers: "localhost:9092"
Expand All @@ -19,4 +19,4 @@ eureka:
register-with-eureka: true # register to eureka server
fetch-registry: true # Getting instances' information from eureka server
service-url:
defaultZone : http://127.0.0.1:8761/eureka #Eureka Server's address
defaultZone : http://localhost:8761/eureka #Eureka Server's address
9 changes: 9 additions & 0 deletions script/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ RUNNING_EUREKA=$(docker ps | grep eureka)
RUNNING_CONFIG=$(docker ps | grep config)
RUNNING_ZOOKEEPER=$(docker ps | grep zookeeper)
RUNNING_KAFKA=$(docker ps | grep kafka)
RUNNING_REDIS=$(docker ps | grep redis)

# Eureka ๊ฒ€์ƒ‰
if [ -z "$RUNNING_EUREKA" ]; then
Expand All @@ -22,6 +23,14 @@ else
echo "Config Service is already running"
fi

# Redis ๊ฒ€์ƒ‰
if [ -z "$RUNNING_REDIS" ]; then
echo "Starting Redis ..."
docker-compose -f /home/docker-compose.yml up -d redis
else
echo "Redis is already running"
fi

# Zookeeper ๊ฒ€์ƒ‰
if [ -z "$RUNNING_ZOOKEEPER" ]; then
echo "Starting Zookeeper ..."
Expand Down
8 changes: 4 additions & 4 deletions script/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
# -d : detached ๋ชจ๋“œ. ์ปจํ…Œ์ด๋„ˆ๋ฅผ ๋ฐฑ๊ทธ๋ผ์šด๋“œ์—์„œ ์‹คํ–‰

echo "api-gateway server start..."
docker-compose -f /home/docker-compose.yml up -d api-gateway
docker-compose -f /home/docker-compose.yml up -d api-gateway --build
echo "noti-service server start..."
docker-compose -f /home/docker-compose.yml up -d noti-service
docker-compose -f /home/docker-compose.yml up -d noti-service --build
echo "user-service server start..."
docker-compose -f /home/docker-compose.yml up -d user-service
docker-compose -f /home/docker-compose.yml up -d user-service --build
echo "weather-service server start..."
docker-compose -f /home/docker-compose.yml up -d weather-service
docker-compose -f /home/docker-compose.yml up -d weather-service --build
4 changes: 2 additions & 2 deletions user-service/src/main/resources/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spring:
active: dev
cloud:
config:
uri: http://config:8888
uri: http://localhost:8888
name: database-user,redis, jwt, smtp, apiDocs-user
kafka:
bootstrap-servers: "localhost:9092"
Expand All @@ -21,7 +21,7 @@ eureka:
register-with-eureka: true # register to eureka server
fetch-registry: true # Getting instances' information from eureka server
service-url:
defaultZone : http://127.0.0.1:8761/eureka #Eureka Server's address
defaultZone : http://localhost:8761/eureka #Eureka Server's address

#management: # Actuator
# endpoints:
Expand Down
4 changes: 2 additions & 2 deletions weather-service/src/main/resources/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spring:
active: dev
cloud:
config:
uri: http://config:8888
uri: http://localhost:8888
name: database-weather
kafka:
bootstrap-servers: "localhost:9092"
Expand All @@ -21,7 +21,7 @@ eureka:
register-with-eureka: true # register to eureka server
fetch-registry: true # Getting instances' information from eureka server
service-url:
defaultZone : http://127.0.0.1:8761/eureka #Eureka Server's address
defaultZone : http://localhost:8761/eureka #Eureka Server's address

management: # Actuator
endpoints:
Expand Down
Loading