diff --git a/scripts/deploy.sh b/scripts/deploy.sh index ba13dfc4..b96abad2 100644 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -1,31 +1,36 @@ #!/bin/bash cd /home/ubuntu/app aws ecr get-login-password --region ap-northeast-2 | docker login --username AWS --password-stdin 294951093594.dkr.ecr.ap-northeast-2.amazonaws.com/frontend -EDGE_AWS_ACCESS_KEY_ID=$(aws secretsmanager get-secret-value --secret-id about/frontend --query SecretString --output text | jq -r '.EDGE_AWS_ACCESS_KEY_ID') -EDGE_AWS_SECRET_ACCESS_KEY=$(aws secretsmanager get-secret-value --secret-id about/frontend --query SecretString --output text | jq -r '.EDGE_AWS_SECRET_ACCESS_KEY') -EDGE_DISTRIBUTION_ID=$(aws secretsmanager get-secret-value --secret-id about/frontend --query SecretString --output text | jq -r '.EDGE_DISTRIBUTION_ID') -EDGE_URL=$(aws secretsmanager get-secret-value --secret-id about/frontend --query SecretString --output text | jq -r '.EDGE_URL') -KAKAO_CLIENT_ID=$(aws secretsmanager get-secret-value --secret-id about/frontend --query SecretString --output text | jq -r '.KAKAO_CLIENT_ID') -KAKAO_CLIENT_SECRET=$(aws secretsmanager get-secret-value --secret-id about/frontend --query SecretString --output text | jq -r '.KAKAO_CLIENT_SECRET') -MONGODB_URI=$(aws secretsmanager get-secret-value --secret-id about/frontend --query SecretString --output text | jq -r '.MONGODB_URI') -NEXTAUTH_SECRET=$(aws secretsmanager get-secret-value --secret-id about/frontend --query SecretString --output text | jq -r '.NEXTAUTH_SECRET') -NEXTAUTH_URL=$(aws secretsmanager get-secret-value --secret-id about/frontend --query SecretString --output text | jq -r '.NEXTAUTH_URL') -NEXT_PUBLIC_GA_MEASUREMENT_ID=$(aws secretsmanager get-secret-value --secret-id about/frontend --query SecretString --output text | jq -r '.NEXT_PUBLIC_GA_MEASUREMENT_ID') -NEXT_PUBLIC_KAKAO_CLIENT_ID=$(aws secretsmanager get-secret-value --secret-id about/frontend --query SecretString --output text | jq -r '.NEXT_PUBLIC_KAKAO_CLIENT_ID') -NEXT_PUBLIC_KAKAO_JS=$(aws secretsmanager get-secret-value --secret-id about/frontend --query SecretString --output text | jq -r '.NEXT_PUBLIC_KAKAO_JS') -NEXT_PUBLIC_KAKAO_JS_KEY=$(aws secretsmanager get-secret-value --secret-id about/frontend --query SecretString --output text | jq -r '.NEXT_PUBLIC_KAKAO_JS_KEY') -NEXT_PUBLIC_NAVER_CLIENT_ID=$(aws secretsmanager get-secret-value --secret-id about/frontend --query SecretString --output text | jq -r '.NEXT_PUBLIC_NAVER_CLIENT_ID') -NEXT_PUBLIC_NAVER_CLIENT_SECRET=$(aws secretsmanager get-secret-value --secret-id about/frontend --query SecretString --output text | jq -r '.NEXT_PUBLIC_NAVER_CLIENT_SECRET') -NEXT_PUBLIC_PWA_KEY=$(aws secretsmanager get-secret-value --secret-id about/frontend --query SecretString --output text | jq -r '.NEXT_PUBLIC_PWA_KEY') -NEXT_PUBLIC_SENTRY_DSN=$(aws secretsmanager get-secret-value --secret-id about/frontend --query SecretString --output text | jq -r '.NEXT_PUBLIC_SENTRY_DSN') -NEXT_PUBLIC_SENTRY_ORGANIZATION=$(aws secretsmanager get-secret-value --secret-id about/frontend --query SecretString --output text | jq -r '.NEXT_PUBLIC_SENTRY_ORGANIZATION') -NEXT_PUBLIC_SENTRY_PROJECT=$(aws secretsmanager get-secret-value --secret-id about/frontend --query SecretString --output text | jq -r '.NEXT_PUBLIC_SENTRY_PROJECT') -NEXT_PUBLIC_SERVER_URI=$(aws secretsmanager get-secret-value --secret-id about/frontend --query SecretString --output text | jq -r '.NEXT_PUBLIC_SERVER_URI') -SENTRY_AUTH_TOKEN=$(aws secretsmanager get-secret-value --secret-id about/frontend --query SecretString --output text | jq -r '.SENTRY_AUTH_TOKEN') -APPLE_ID=$(aws secretsmanager get-secret-value --secret-id about/frontend --query SecretString --output text | jq -r '.APPLE_ID') -APPLE_KEY_ID=$(aws secretsmanager get-secret-value --secret-id about/frontend --query SecretString --output text | jq -r '.APPLE_KEY_ID') -APPLE_PRIVATE_KEY=$(aws secretsmanager get-secret-value --secret-id about/frontend --query SecretString --output text | jq -r '.APPLE_PRIVATE_KEY') -APPLE_TEAM_ID=$(aws secretsmanager get-secret-value --secret-id about/frontend --query SecretString --output text | jq -r '.APPLE_TEAM_ID') + +# SecretsManager에서 모든 값 가져오기 +SECRETS=$(aws secretsmanager get-secret-value --secret-id about/frontend --query SecretString --output text | jq -r '.') + +# Secrets 변수에서 각 값 추출 +EDGE_AWS_ACCESS_KEY_ID=$(echo $SECRETS | jq -r '.EDGE_AWS_ACCESS_KEY_ID') +EDGE_AWS_SECRET_ACCESS_KEY=$(echo $SECRETS | jq -r '.EDGE_AWS_SECRET_ACCESS_KEY') +EDGE_DISTRIBUTION_ID=$(echo $SECRETS | jq -r '.EDGE_DISTRIBUTION_ID') +EDGE_URL=$(echo $SECRETS | jq -r '.EDGE_URL') +KAKAO_CLIENT_ID=$(echo $SECRETS | jq -r '.KAKAO_CLIENT_ID') +KAKAO_CLIENT_SECRET=$(echo $SECRETS | jq -r '.KAKAO_CLIENT_SECRET') +MONGODB_URI=$(echo $SECRETS | jq -r '.MONGODB_URI') +NEXTAUTH_SECRET=$(echo $SECRETS | jq -r '.NEXTAUTH_SECRET') +NEXTAUTH_URL=$(echo $SECRETS | jq -r '.NEXTAUTH_URL') +NEXT_PUBLIC_GA_MEASUREMENT_ID=$(echo $SECRETS | jq -r '.NEXT_PUBLIC_GA_MEASUREMENT_ID') +NEXT_PUBLIC_KAKAO_CLIENT_ID=$(echo $SECRETS | jq -r '.NEXT_PUBLIC_KAKAO_CLIENT_ID') +NEXT_PUBLIC_KAKAO_JS=$(echo $SECRETS | jq -r '.NEXT_PUBLIC_KAKAO_JS') +NEXT_PUBLIC_KAKAO_JS_KEY=$(echo $SECRETS | jq -r '.NEXT_PUBLIC_KAKAO_JS_KEY') +NEXT_PUBLIC_NAVER_CLIENT_ID=$(echo $SECRETS | jq -r '.NEXT_PUBLIC_NAVER_CLIENT_ID') +NEXT_PUBLIC_NAVER_CLIENT_SECRET=$(echo $SECRETS | jq -r '.NEXT_PUBLIC_NAVER_CLIENT_SECRET') +NEXT_PUBLIC_PWA_KEY=$(echo $SECRETS | jq -r '.NEXT_PUBLIC_PWA_KEY') +NEXT_PUBLIC_SENTRY_DSN=$(echo $SECRETS | jq -r '.NEXT_PUBLIC_SENTRY_DSN') +NEXT_PUBLIC_SENTRY_ORGANIZATION=$(echo $SECRETS | jq -r '.NEXT_PUBLIC_SENTRY_ORGANIZATION') +NEXT_PUBLIC_SENTRY_PROJECT=$(echo $SECRETS | jq -r '.NEXT_PUBLIC_SENTRY_PROJECT') +NEXT_PUBLIC_SERVER_URI=$(echo $SECRETS | jq -r '.NEXT_PUBLIC_SERVER_URI') +SENTRY_AUTH_TOKEN=$(echo $SECRETS | jq -r '.SENTRY_AUTH_TOKEN') +APPLE_ID=$(echo $SECRETS | jq -r '.APPLE_ID') +APPLE_KEY_ID=$(echo $SECRETS | jq -r '.APPLE_KEY_ID') +APPLE_PRIVATE_KEY=$(echo $SECRETS | jq -r '.APPLE_PRIVATE_KEY') +APPLE_TEAM_ID=$(echo $SECRETS | jq -r '.APPLE_TEAM_ID') docker pull 294951093594.dkr.ecr.ap-northeast-2.amazonaws.com/frontend:latest docker stop next-app || true