From b2602facf77767f49072d09a74635de198cac168 Mon Sep 17 00:00:00 2001 From: can kurttekin Date: Tue, 19 Nov 2024 10:56:22 +0300 Subject: [PATCH] removed EOF replaced with inline SSH command --- .github/workflows/deploy.yml | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 317622e8..5c11d988 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -44,6 +44,7 @@ jobs: echo "Copying files to EC2..." scp -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no -r backend/docker-compose.yml $EC2_USER@$EC2_HOST:~/job-application-tracker/ + # Create .env file on EC2 - name: Configure Environment Variables env: @@ -61,24 +62,21 @@ jobs: MAIL_PASS: ${{ secrets.MAIL_PASS }} TURNSTILE_SECRET: ${{ secrets.TURNSTILE_SECRET }} run: | - ssh -o StrictHostKeyChecking=no $EC2_USER@$EC2_HOST << 'EOF' - mkdir -p ~/job-application-tracker - cat < ~/job-application-tracker/.env - APP_URL=${APP_URL} - PORT=${PORT} - ALLOWED_ORIGINS=${ALLOWED_ORIGINS} - DB_USER=${DB_USER} - DB_PASS=${DB_PASS} - GEMINI_API_KEY=${GEMINI_API_KEY} - KEY_STORE_PASS=${KEY_STORE_PASS} - KEY_STORE_ALIAS=${KEY_STORE_ALIAS} - MAIL_HOST=${MAIL_HOST} - MAIL_PORT=${MAIL_PORT} - MAIL_USER=${MAIL_USER} - MAIL_PASS=${MAIL_PASS} - TURNSTILE_SECRET=${TURNSTILE_SECRET} - EOT - EOF + echo "Configuring environment variables on EC2..." + ssh -o StrictHostKeyChecking=no $EC2_USER@$EC2_HOST "mkdir -p ~/job-application-tracker && \ + echo 'APP_URL=${APP_URL}' > ~/job-application-tracker/.env && \ + echo 'PORT=${PORT}' >> ~/job-application-tracker/.env && \ + echo 'ALLOWED_ORIGINS=${ALLOWED_ORIGINS}' >> ~/job-application-tracker/.env && \ + echo 'DB_USER=${DB_USER}' >> ~/job-application-tracker/.env && \ + echo 'DB_PASS=${DB_PASS}' >> ~/job-application-tracker/.env && \ + echo 'GEMINI_API_KEY=${GEMINI_API_KEY}' >> ~/job-application-tracker/.env && \ + echo 'KEY_STORE_PASS=${KEY_STORE_PASS}' >> ~/job-application-tracker/.env && \ + echo 'KEY_STORE_ALIAS=${KEY_STORE_ALIAS}' >> ~/job-application-tracker/.env && \ + echo 'MAIL_HOST=${MAIL_HOST}' >> ~/job-application-tracker/.env && \ + echo 'MAIL_PORT=${MAIL_PORT}' >> ~/job-application-tracker/.env && \ + echo 'MAIL_USER=${MAIL_USER}' >> ~/job-application-tracker/.env && \ + echo 'MAIL_PASS=${MAIL_PASS}' >> ~/job-application-tracker/.env && \ + echo 'TURNSTILE_SECRET=${TURNSTILE_SECRET}' >> ~/job-application-tracker/.env" # Start Application on EC2 - name: Start Application