-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from Prorupak/development
Automate Integration, Enhance Type Safety, and Optimize Deployment
- Loading branch information
Showing
26 changed files
with
2,285 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
node_modules | ||
.pnpm-store | ||
docker-compose.yml | ||
*.env | ||
dist | ||
out | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
deploy_to_dev: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js 18 | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 18.x | ||
- name: Install dependencies | ||
run: | | ||
npm install -g pnpm | ||
pnpm init-project | ||
- name: Lint | ||
run: pnpm run lint | ||
- name: Build | ||
run: pnpm build | ||
|
||
# SSH Deployment Steps | ||
- name: Set up SSH Agent | ||
uses: webfactory/ssh-agent@v0.9.0 | ||
with: | ||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
|
||
- name: Execute Remote Commands | ||
run: | | ||
ssh -o StrictHostKeyChecking=no ${{ secrets.USERNAME }}@${{ secrets.HOST }} << EOF | ||
cd rupak/plugin-sample | ||
git fetch --all | ||
git checkout master | ||
git pull origin master | ||
git reset --hard origin/master | ||
docker compose up --build | ||
EOF | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Check formatting and linting | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- edited | ||
branches: | ||
- development | ||
|
||
jobs: | ||
lint_and_format: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js 18 | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 18.x | ||
- run: npm install -g pnpm | ||
- run: pnpm i | ||
- run: pnpm run lint | ||
- run: pnpm build | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
version: "3" | ||
|
||
services: | ||
server: | ||
container_name: server | ||
build: | ||
context: . | ||
dockerfile: ./server/Dockerfile | ||
restart: always | ||
ports: | ||
- 6000:6000 | ||
networks: | ||
- app_network | ||
|
||
nginx: | ||
image: nginx:latest | ||
container_name: nginx | ||
volumes: | ||
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf | ||
ports: | ||
- "80:80" | ||
depends_on: | ||
- server | ||
networks: | ||
- app_network | ||
|
||
networks: | ||
app_network: | ||
name: app_network | ||
external: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const { cpus } = require("node:os"); | ||
const { config: dotConfig } = require("dotenv"); | ||
|
||
dotConfig({ path: ".env" }); | ||
|
||
const cpuLen = cpus().length; | ||
|
||
module.exports = { | ||
apps: [ | ||
{ | ||
name: "text-search-api", | ||
script: "./dist/index.js", | ||
autorestart: true, | ||
exec_mode: "cluster", | ||
watch: false, | ||
instances: cpuLen, | ||
max_memory_restart: "1G", | ||
args: "", | ||
env: { | ||
NODE_ENV: process.env.NODE_ENV, | ||
PORT: process.env.PORT, | ||
}, | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
server { | ||
listen 80; | ||
server_name plugin.sapkotarupak.com.np; | ||
|
||
location / { | ||
proxy_pass http://server:6000; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import globals from "globals"; | ||
import pluginJs from "@eslint/js"; | ||
import tseslint from "typescript-eslint"; | ||
import pluginReact from "eslint-plugin-react"; | ||
|
||
|
||
export default [ | ||
{files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"]}, | ||
{languageOptions: { globals: globals.browser }}, | ||
pluginJs.configs.recommended, | ||
...tseslint.configs.recommended, | ||
pluginReact.configs.flat.recommended, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.