-
Notifications
You must be signed in to change notification settings - Fork 0
Implement full end-to-end integration and repository setup #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Copilot
wants to merge
7
commits into
fahad
Choose a base branch
from
copilot/add-integration-repository-setup
base: fahad
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9bda15f
Initial plan
Copilot 8d67a24
Add providers, modeSwitcher, prisma schema, and environment files
Copilot b109d17
Make smoke.sh executable
Copilot 397869e
Address code review feedback and security improvements
Copilot 81c3d31
feat: Add CI/CD auto-deployment and setup scripts for onlainee.space
wasalstor-web 029170a
Add HTTPS setup script and update deployment docs for onlainee.space
Copilot 92cdf13
Fix code review issues: add NODE_ENV, remove duplicate health endpoin…
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,31 @@ | ||
| # Gemini API key for AI services (used in vite and backend) | ||
| GEMINI_API_KEY=your_gemini_api_key_here | ||
| # Duplicate alias for services/geminiService.ts (API_KEY fallback) | ||
| API_KEY=${GEMINI_API_KEY} | ||
|
|
||
| # Database connection URL (SQLite for local dev / production volume) | ||
| # For Docker volume mount use: DATABASE_URL="file:/app/data/data.db" | ||
| DATABASE_URL="file:./data.db" | ||
|
|
||
| # Mapit shipping provider | ||
| MAPIT_API_KEY=your_mapit_api_key_here | ||
| MAPIT_API_URL=https://api.mapit.example/v1/shipments | ||
| MAPIT_WEBHOOK_SECRET=your_mapit_webhook_secret_here | ||
|
|
||
| # MyFatora payment provider | ||
| MYFATORA_API_KEY=your_myfatora_api_key_here | ||
| MYFATORA_API_URL=https://api.myfatora.example/v1/payments | ||
| MYFATORA_WEBHOOK_SECRET=your_myfatora_webhook_secret_here | ||
|
|
||
| # Telegram bot for notifications | ||
| TELEGRAM_BOT_TOKEN=your_telegram_bot_token_here | ||
| TELEGRAM_TEST_CHAT_ID=your_telegram_chat_id_here | ||
|
|
||
| # Server configuration | ||
| # Adjust PORT to match Dockerfile or systemd service | ||
| PORT=3000 | ||
| CORS_ORIGIN=https://onlainee.space | ||
| NODE_ENV=development | ||
|
|
||
| # Optional Telegram default chat id for testing notifications | ||
| TELEGRAM_DEFAULT_CHAT_ID= | ||
This file contains hidden or 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,69 @@ | ||
| name: Auto Deploy to onlainee.space | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - copilot/add-integration-repository-setup | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| deploy: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| cache: 'npm' | ||
|
|
||
| - name: Install and build frontend | ||
| run: | | ||
| npm ci | ||
| npm run build | ||
|
|
||
| - name: Deploy to Hostinger via SSH | ||
| uses: appleboy/ssh-action@v1.0.1 | ||
| with: | ||
| host: ${{ secrets.VPS_HOST }} | ||
| username: ${{ secrets.VPS_USER }} | ||
| key: ${{ secrets.VPS_SSH_KEY }} | ||
| script: | | ||
| set -e | ||
| cd /srv/logisa | ||
| echo "Pulling latest code..." | ||
| git fetch --all --prune | ||
| git checkout copilot/add-integration-repository-setup | ||
| git pull origin copilot/add-integration-repository-setup | ||
|
|
||
| echo "Installing dependencies..." | ||
| npm ci | ||
|
|
||
| echo "Generating Prisma..." | ||
| npx prisma generate | ||
|
|
||
| echo "Running migrations..." | ||
| npx prisma migrate deploy || true | ||
|
|
||
| echo "Building frontend..." | ||
| npm run build | ||
|
|
||
| echo "Restarting service..." | ||
| systemctl restart logisa | ||
|
|
||
| echo "✅ Deployment successful!" | ||
| systemctl status logisa --no-pager || true | ||
|
|
||
| - name: Notify on Success | ||
| if: success() | ||
| run: | | ||
| echo "✅ Deployment to https://onlainee.space completed successfully!" | ||
| echo "Frontend: https://onlainee.space" | ||
| echo "API: https://onlainee.space/api/" | ||
|
|
||
| - name: Notify on Failure | ||
| if: failure() | ||
| run: | | ||
| echo "❌ Deployment failed. Check logs above." |
This file contains hidden or 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,55 @@ | ||
| name: Deploy to GitHub Pages | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - fahad | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pages: write | ||
| id-token: write | ||
|
|
||
| concurrency: | ||
| group: "pages" | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| cache: 'npm' | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Build frontend | ||
| run: npm run build | ||
| env: | ||
| VITE_BASE: /fahad332/ | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-pages-artifact@v3 | ||
| with: | ||
| path: ./dist | ||
|
|
||
| deploy: | ||
| environment: | ||
| name: github-pages | ||
| url: ${{ steps.deployment.outputs.page_url }} | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
|
|
||
| steps: | ||
| - name: Deploy to GitHub Pages | ||
| id: deployment | ||
| uses: actions/deploy-pages@v4 |
This file contains hidden or 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,61 @@ | ||
| name: Deploy via SSH | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - copilot/add-integration-repository-setup | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| deploy: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| cache: 'npm' | ||
|
|
||
| - name: Build frontend | ||
| run: | | ||
| npm ci | ||
| npm run build | ||
|
|
||
| - name: Package dist | ||
| run: | | ||
| tar -czf dist.tar.gz dist | ||
|
|
||
| - name: Deploy dist + backend (rsync) over SSH | ||
| uses: appleboy/scp-action@v0.2.4 | ||
| with: | ||
| host: ${{ secrets.SSH_HOST }} | ||
| username: ${{ secrets.SSH_USER }} | ||
| key: ${{ secrets.SSH_KEY }} | ||
| source: "dist.tar.gz" | ||
| target: "${{ secrets.APP_DIR }}/" | ||
|
|
||
| - name: Remote unpack + install + restart | ||
| uses: appleboy/ssh-action@v1.0.1 | ||
| with: | ||
| host: ${{ secrets.SSH_HOST }} | ||
| username: ${{ secrets.SSH_USER }} | ||
| key: ${{ secrets.SSH_KEY }} | ||
| script: | | ||
| set -e | ||
| cd ${{ secrets.APP_DIR }} | ||
| tar -xzf dist.tar.gz | ||
| rm -f dist.tar.gz | ||
| if [ ! -d node_modules ]; then npm ci; fi | ||
| npx prisma generate | ||
| npx prisma migrate deploy || true | ||
| systemctl restart logisa || echo "Service not found" | ||
| echo "Deployment finished" | ||
|
|
||
| # Required Secrets: | ||
| # SSH_HOST=147.93.120.99 | ||
| # SSH_USER=deploy (or root) | ||
| # SSH_KEY=private key content | ||
| # APP_DIR=/srv/logisa |
This file contains hidden or 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,62 @@ | ||
| name: Smoke Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - fahad | ||
| pull_request: | ||
| branches: | ||
| - fahad | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| smoke-tests: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| env: | ||
| DATABASE_URL: "file:./test.db" | ||
| PORT: 3001 | ||
| CORS_ORIGIN: "*" | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| cache: 'npm' | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Generate Prisma client | ||
| run: npx prisma generate | ||
|
|
||
| - name: Run database migrations | ||
| run: npx prisma migrate deploy || npx prisma db push | ||
|
|
||
| - name: Start backend server | ||
| run: | | ||
| npm run dev:backend & | ||
| echo $! > /tmp/server.pid | ||
| env: | ||
| TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} | ||
| TELEGRAM_TEST_CHAT_ID: ${{ secrets.TELEGRAM_TEST_CHAT_ID }} | ||
|
|
||
| - name: Run smoke tests | ||
| run: | | ||
| chmod +x scripts/test/smoke.sh | ||
| ./scripts/test/smoke.sh | ||
| env: | ||
| BASE_URL: http://localhost:3001 | ||
|
|
||
| - name: Stop backend server | ||
| if: always() | ||
| run: | | ||
| if [ -f /tmp/server.pid ]; then | ||
| kill $(cat /tmp/server.pid) || true | ||
| fi |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing important environment variables in the example file. The
NODE_ENVvariable is referenced in the health endpoint (line 28 of server.ts) but is not documented in.env.example. AddNODE_ENV=developmentto the example file for completeness.