Skip to content

Commit 0d97f9d

Browse files
committed
CI/CD yapılandırmasında GCP kimlik bilgileri için izinler ayarlandı; Kafka ve Redis kontrolü eklendi. Debug ve prod modları için container yapılandırmaları güncellendi.
1 parent dfbc566 commit 0d97f9d

1 file changed

Lines changed: 17 additions & 9 deletions

File tree

.github/workflows/user-service-ci-cd.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,13 @@ jobs:
109109
script: |
110110
echo "Starting deployment of User Service..."
111111
112-
# Kafka ve Redis durumunu kontrol et
112+
# Credentials dosyası için izinleri ayarla
113+
sudo mkdir -p /opt/craftpilot/gcp
114+
sudo cp /opt/craftpilot/gcp-credentials.json /opt/craftpilot/gcp/
115+
sudo chown -R 1001:1001 /opt/craftpilot/gcp
116+
sudo chmod 640 /opt/craftpilot/gcp/gcp-credentials.json
117+
118+
# Kafka ve Redis kontrolü
113119
if ! docker exec -t kafka kafka-topics --bootstrap-server localhost:9092 --list > /dev/null; then
114120
echo "Kafka is not available! Waiting for it to start..."
115121
sleep 30
@@ -143,21 +149,21 @@ jobs:
143149
144150
# Debug ve prod modları için farklı container yapılandırması
145151
if [[ "${{ github.event.inputs.environment }}" == "debug" ]]; then
146-
# Debug modu container yapılandırması
147152
docker run -d \
148153
--name user-service \
149154
--network craftpilot-network \
150155
--restart unless-stopped \
151156
-p 8060:8060 \
152157
-p 5005:5005 \
153-
-v /opt/craftpilot/gcp-credentials.json:/etc/gcp/credentials/gcp-credentials.json:ro \
158+
-v /opt/craftpilot/gcp:/gcp:ro \
154159
-e SPRING_PROFILES_ACTIVE=prod \
155160
-e KAFKA_BOOTSTRAP_SERVERS=kafka:9092 \
156161
-e KAFKA_CLIENT_ID=user-service \
157162
-e EUREKA_CLIENT_SERVICEURL_DEFAULTZONE=http://craftpilot:13579ada@eureka-server:8761/eureka/ \
158163
-e HOSTNAME=user-service \
159-
-e GOOGLE_APPLICATION_CREDENTIALS=/etc/gcp/credentials/gcp-credentials.json \
160-
-e FIREBASE_CONFIG_PATH=/etc/gcp/credentials/gcp-credentials.json \
164+
-e GOOGLE_APPLICATION_CREDENTIALS=/gcp/gcp-credentials.json \
165+
-e FIREBASE_CONFIG_PATH=/gcp/gcp-credentials.json \
166+
-e SPRING_CLOUD_GCP_CREDENTIALS_LOCATION=file:/gcp/gcp-credentials.json \
161167
-e SPRING_SECURITY_USER_NAME=craftpilot \
162168
-e SPRING_SECURITY_USER_PASSWORD=13579ada \
163169
-e REDIS_HOST=redis \
@@ -168,27 +174,28 @@ jobs:
168174
-e MANAGEMENT_ENDPOINT_HEALTH_SHOW_DETAILS=always \
169175
-e SPRING_KAFKA_ADMIN_AUTO_CREATE=false \
170176
-e "JAVA_OPTS=-XX:+UseContainerSupport -XX:MaxRAMPercentage=70.0 -XX:+UseG1GC -Djava.security.egd=file:/dev/./urandom -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005" \
177+
--user 1001:1001 \
171178
--health-cmd="curl -f http://localhost:8060/actuator/health || exit 1" \
172179
--health-interval=30s \
173180
--health-timeout=10s \
174181
--health-retries=3 \
175182
--health-start-period=90s \
176183
${{ secrets.DOCKERHUB_USERNAME }}/user-service:latest-arm64
177184
else
178-
# Prod modu container yapılandırması
179185
docker run -d \
180186
--name user-service \
181187
--network craftpilot-network \
182188
--restart unless-stopped \
183189
-p 8060:8060 \
184-
-v /opt/craftpilot/gcp-credentials.json:/etc/gcp/credentials/gcp-credentials.json:ro \
190+
-v /opt/craftpilot/gcp:/gcp:ro \
185191
-e SPRING_PROFILES_ACTIVE=prod \
186192
-e KAFKA_BOOTSTRAP_SERVERS=kafka:9092 \
187193
-e KAFKA_CLIENT_ID=user-service \
188194
-e EUREKA_CLIENT_SERVICEURL_DEFAULTZONE=http://craftpilot:13579ada@eureka-server:8761/eureka/ \
189195
-e HOSTNAME=user-service \
190-
-e GOOGLE_APPLICATION_CREDENTIALS=/etc/gcp/credentials/gcp-credentials.json \
191-
-e FIREBASE_CONFIG_PATH=/etc/gcp/credentials/gcp-credentials.json \
196+
-e GOOGLE_APPLICATION_CREDENTIALS=/gcp/gcp-credentials.json \
197+
-e FIREBASE_CONFIG_PATH=/gcp/gcp-credentials.json \
198+
-e SPRING_CLOUD_GCP_CREDENTIALS_LOCATION=file:/gcp/gcp-credentials.json \
192199
-e SPRING_SECURITY_USER_NAME=craftpilot \
193200
-e SPRING_SECURITY_USER_PASSWORD=13579ada \
194201
-e REDIS_HOST=redis \
@@ -199,6 +206,7 @@ jobs:
199206
-e MANAGEMENT_ENDPOINT_HEALTH_SHOW_DETAILS=always \
200207
-e SPRING_KAFKA_ADMIN_AUTO_CREATE=false \
201208
-e "JAVA_OPTS=-XX:+UseContainerSupport -XX:MaxRAMPercentage=70.0 -XX:+UseG1GC -Djava.security.egd=file:/dev/./urandom" \
209+
--user 1001:1001 \
202210
--health-cmd="curl -f http://localhost:8060/actuator/health || exit 1" \
203211
--health-interval=30s \
204212
--health-timeout=10s \

0 commit comments

Comments
 (0)