Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
6 changes: 5 additions & 1 deletion .coderabbit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ language: ko-KR

reviews:
auto_review:
enabled: false
enabled: true

tools:
github-checks:
timeout_ms: 300000

path_instructions:
- path: "**/*.tf"
Expand Down
40 changes: 0 additions & 40 deletions .github/workflows/terraform-plan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -437,43 +437,3 @@ jobs:
if: steps.plan.outputs.exitcode == '1'
run: exit 1

trigger-coderabbit:
needs: [plan-bootstrap, plan-global, plan-prod, plan-stage, plan-monitoring]
if: |
always() &&
(
needs.plan-bootstrap.result == 'success' || needs.plan-bootstrap.result == 'failure' ||
needs.plan-global.result == 'success' || needs.plan-global.result == 'failure' ||
needs.plan-prod.result == 'success' || needs.plan-prod.result == 'failure' ||
needs.plan-stage.result == 'success' || needs.plan-stage.result == 'failure' ||
needs.plan-monitoring.result == 'success' || needs.plan-monitoring.result == 'failure'
)
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
script: |
const marker = '<!-- coderabbit-review-trigger -->';
const body = `${marker}\n@coderabbitai review`;

const { data: comments } = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
});
const existing = comments.find(c => c.body.includes(marker));
if (existing) {
await github.rest.issues.updateComment({
comment_id: existing.id,
owner: context.repo.owner,
repo: context.repo.repo,
body,
});
} else {
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body,
});
}
2 changes: 1 addition & 1 deletion config/secrets
19 changes: 14 additions & 5 deletions modules/app_stack/scripts/nginx_setup.sh.tftpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set -e
DOMAIN="${domain_name}"
EMAIL="${email}"
CONF_NAME="${conf_file_name}"
UPSTREAM_CONF="/etc/nginx/conf.d/upstream.conf"

echo "Start Nginx Setup for $DOMAIN with config file: $CONF_NAME"

Expand All @@ -30,7 +31,15 @@ certbot certonly --standalone \

echo "Certificate obtained successfully."

# 4. Create Nginx configuration file
# 4. Create upstream config file (initial active slot: blue on port 8080)
# Blue-Green 배포 시 이 파일만 교체하고 nginx -s reload 로 트래픽 전환
cat <<UPSTREAM_EOF > $UPSTREAM_CONF
upstream app_backend {
server 127.0.0.1:8080;
}
UPSTREAM_EOF
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

# 5. Create Nginx configuration file
cat <<EOF > /etc/nginx/sites-available/$CONF_NAME
map \$http_upgrade \$connection_upgrade {
default upgrade;
Expand Down Expand Up @@ -63,7 +72,7 @@ server {
ssl_stapling_verify on;

location / {
proxy_pass http://127.0.0.1:8080;
proxy_pass http://app_backend;
proxy_http_version 1.1;
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
Expand All @@ -75,14 +84,14 @@ server {
}
EOF

# 5. Create symbolic link and remove default configuration
# 6. Create symbolic link and remove default configuration
ln -sf /etc/nginx/sites-available/$CONF_NAME /etc/nginx/sites-enabled/$CONF_NAME
rm -f /etc/nginx/sites-enabled/default

# 6. Register auto-renewal cron job
# 7. Register auto-renewal cron job
echo "0 0,12 * * * root /opt/certbot/bin/python -c 'import random; import time; time.sleep(random.random() * 3600)' && certbot renew -q" | tee -a /etc/crontab > /dev/null

# 7. Nginx restart
# 8. Nginx restart
nginx -t
systemctl restart nginx

Expand Down
Loading