Commit d49f99e2 by Arjun Jhukal

updated the firekirin new deployment pipeline

parent af2d9222
...@@ -3,7 +3,7 @@ name: getFirekirin Deployment Pipeline ...@@ -3,7 +3,7 @@ name: getFirekirin Deployment Pipeline
on: on:
push: push:
branches: branches:
- fixes/linting - main
jobs: jobs:
build-and-deploy: build-and-deploy:
...@@ -48,8 +48,8 @@ jobs: ...@@ -48,8 +48,8 @@ jobs:
- name: Setup SSH - name: Setup SSH
run: | run: |
mkdir -p ~/.ssh mkdir -p ~/.ssh
echo "${{ secrets.SERVER_SSH_KEY }}" > ~/.ssh/id_ed25519 echo "${{ secrets.SERVER_SSH_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_ed25519 chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H ${{ secrets.SERVER_HOST }} >> ~/.ssh/known_hosts ssh-keyscan -H ${{ secrets.SERVER_HOST }} >> ~/.ssh/known_hosts
- name: Deploy build to server - name: Deploy build to server
...@@ -58,120 +58,141 @@ jobs: ...@@ -58,120 +58,141 @@ jobs:
--exclude '.git' \ --exclude '.git' \
--exclude '.env*' \ --exclude '.env*' \
--exclude 'node_modules' \ --exclude 'node_modules' \
--exclude 'conf' \
--exclude 'logs' \
--exclude 'ssl' \
--exclude 'tmp' \
--exclude 'private_html' \
--exclude 'public_html' \
./ \ ./ \
${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }}:/var/www/getFirekirin/ ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }}:/home/1522942.cloudwaysapps.com/swsjapwyjk/
# - name: Restart application - name: Restart application
# run: | run: |
# ssh ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }} << 'EOF' ssh ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }} << 'EOF'
# cd /var/www/getFirekirin # Load NVM
# pm2 reload ecosystem.config.js --update-env --env production || \ export NVM_DIR="$HOME/.nvm"
# pm2 start ecosystem.config.js --env production [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
# EOF
# Go to app directory
# - name: Notify Slack on Success cd /home/1522942.cloudwaysapps.com/swsjapwyjk
# if: success()
# uses: slackapi/slack-github-action@v1.27.0 # Install dependencies (production only, no dev dependencies)
# with: npm ci --prefer-offline --no-audit --production=false
# payload: |
# { # Reload or start PM2
# "text": "✅ getFirekirin Deployment Successful!", pm2 reload ecosystem.config.js --update-env --env production || \
# "blocks": [ pm2 start ecosystem.config.js --env production
# {
# "type": "header", # Save PM2 process list
# "text": { pm2 save
# "type": "plain_text",
# "text": "✅ getFirekirin Deployment Successful" # Show status
# } pm2 list
# }, EOF
# { - name: Notify Slack on Success
# "type": "section", if: success()
# "fields": [ uses: slackapi/slack-github-action@v1.27.0
# { with:
# "type": "mrkdwn", payload: |
# "text": "*Repository:*\n${{ github.repository }}" {
# }, "text": "✅ getFirekirin Deployment Successful!",
# { "blocks": [
# "type": "mrkdwn", {
# "text": "*Branch:*\n${{ github.ref_name }}" "type": "header",
# }, "text": {
# { "type": "plain_text",
# "type": "mrkdwn", "text": "✅ getFirekirin Deployment Successful"
# "text": "*Commit:*\n<${{ github.event.head_commit.url }}|${{ github.sha }}>" }
# }, },
# { {
# "type": "mrkdwn", "type": "section",
# "text": "*Author:*\n${{ github.actor }}" "fields": [
# } {
# ] "type": "mrkdwn",
# }, "text": "*Repository:*\n${{ github.repository }}"
# { },
# "type": "section", {
# "text": { "type": "mrkdwn",
# "type": "mrkdwn", "text": "*Branch:*\n${{ github.ref_name }}"
# "text": "*Message:* ${{ github.event.head_commit.message }}" },
# } {
# }, "type": "mrkdwn",
# { "text": "*Commit:*\n<${{ github.event.head_commit.url }}|${{ github.sha }}>"
# "type": "context", },
# "elements": [ {
# { "type": "mrkdwn",
# "type": "mrkdwn", "text": "*Author:*\n${{ github.actor }}"
# "text": "Deployed to production at <!date^${{ github.event.head_commit.timestamp }}^{date_num} {time_secs}|${{ github.event.head_commit.timestamp }}>" }
# } ]
# ] },
# } {
# ] "type": "section",
# } "text": {
# env: "type": "mrkdwn",
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} "text": "*Message:* ${{ github.event.head_commit.message }}"
# SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK }
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Deployed to production at <!date^${{ github.event.head_commit.timestamp }}^{date_num} {time_secs}|${{ github.event.head_commit.timestamp }}>"
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
# - name: Notify Slack on Failure - name: Notify Slack on Failure
# if: failure() if: failure()
# uses: slackapi/slack-github-action@v1.27.0 uses: slackapi/slack-github-action@v1.27.0
# with: with:
# payload: | payload: |
# { {
# "text": "❌ getFirekirin Deployment Failed!", "text": "❌ getFirekirin Deployment Failed!",
# "blocks": [ "blocks": [
# { {
# "type": "header", "type": "header",
# "text": { "text": {
# "type": "plain_text", "type": "plain_text",
# "text": "❌ getFirekirin Deployment Failed" "text": "❌ getFirekirin Deployment Failed"
# } }
# }, },
# { {
# "type": "section", "type": "section",
# "fields": [ "fields": [
# { {
# "type": "mrkdwn", "type": "mrkdwn",
# "text": "*Repository:*\n${{ github.repository }}" "text": "*Repository:*\n${{ github.repository }}"
# }, },
# { {
# "type": "mrkdwn", "type": "mrkdwn",
# "text": "*Branch:*\n${{ github.ref_name }}" "text": "*Branch:*\n${{ github.ref_name }}"
# }, },
# { {
# "type": "mrkdwn", "type": "mrkdwn",
# "text": "*Commit:*\n<${{ github.event.head_commit.url }}|${{ github.sha }}>" "text": "*Commit:*\n<${{ github.event.head_commit.url }}|${{ github.sha }}>"
# }, },
# { {
# "type": "mrkdwn", "type": "mrkdwn",
# "text": "*Author:*\n${{ github.actor }}" "text": "*Author:*\n${{ github.actor }}"
# } }
# ] ]
# }, },
# { {
# "type": "section", "type": "section",
# "text": { "text": {
# "type": "mrkdwn", "type": "mrkdwn",
# "text": "*Action:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Workflow Run>" "text": "*Action:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Workflow Run>"
# } }
# } }
# ] ]
# } }
# env: env:
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
# SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
...@@ -2,9 +2,10 @@ module.exports = { ...@@ -2,9 +2,10 @@ module.exports = {
apps: [{ apps: [{
name: 'getFirekirin', name: 'getFirekirin',
script: 'node_modules/next/dist/bin/next', script: 'node_modules/next/dist/bin/next',
args: 'start -p 3000', args: 'start',
cwd: '/var/www/getFirekirin', cwd: '/home/1522942.cloudwaysapps.com/swsjapwyjk',
instances: 1, instances: 1,
exec_mode: 'cluster',
autorestart: true, autorestart: true,
watch: false, watch: false,
max_memory_restart: '1G', max_memory_restart: '1G',
...@@ -12,8 +13,11 @@ module.exports = { ...@@ -12,8 +13,11 @@ module.exports = {
NODE_ENV: 'production', NODE_ENV: 'production',
PORT: 3000 PORT: 3000
}, },
error_file: '/var/www/getFirekirin/logs/pm2-error.log', error_file: '/home/1522942.cloudwaysapps.com/swsjapwyjk/logs/pm2-error.log',
out_file: '/var/www/getFirekirin/logs/pm2-out.log', out_file: '/home/1522942.cloudwaysapps.com/swsjapwyjk/logs/pm2-out.log',
log_date_format: 'YYYY-MM-DD HH:mm:ss Z' log_date_format: 'YYYY-MM-DD HH:mm:ss Z',
merge_logs: true,
max_restarts: 10,
min_uptime: '10s'
}] }]
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment