Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,46 @@ on:
branches:
- main
- dev
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

permissions:
contents: read
packages: read

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '23'
registry-url: 'https://npm.pkg.github.com'
scope: '@modl-gg'

- name: Install root dependencies
run: npm install
- name: Configure npm for GitHub Packages
run: |
rm .npmrc
echo "@modl-gg:registry=https://npm.pkg.github.com" >> .npmrc
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install client dependencies
run: |
cd client
npm install
npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies
run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run build
run: npm run build
run: npm run build
61 changes: 42 additions & 19 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,50 @@ on:
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 10

environment: staging

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H ${{ secrets.STAGING_IP }} >> ~/.ssh/known_hosts

- name: Deploy via SSH
run: |
ssh ${{ secrets.SERVER_USER }}@${{ secrets.STAGING_IP }} << 'EOF'
- name: Checkout code
uses: actions/checkout@v4

- name: Setup SSH
uses: webfactory/ssh-agent@v0.7.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

- name: Add server to known hosts
run: |
ssh-keyscan -H ${{ secrets.STAGING_IP }} >> ~/.ssh/known_hosts

- name: Deploy via SSH
run: |
ssh -o StrictHostKeyChecking=no ${{ secrets.SERVER_USER }}@${{ secrets.STAGING_IP }} '
set -e
export GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}"
cd /home/modl/modl-admin
git stash
git pull origin dev
npm install
cd client
npm install
cd ..
if git diff --name-only HEAD@{1} HEAD | grep -q "^package.*\.json$"; then
npm ci
fi
if git diff --name-only HEAD@{1} HEAD | grep -q "^client/package.*\.json$"; then
cd client
npm ci
cd ..
fi
npm run build
pm2 reload modl-admin
EOF
pm2 reload modl-admin --wait-ready
if pm2 describe modl-admin | grep -q "online"; then
echo "PM2 process is running successfully"
else
echo "Error: PM2 process failed to start"
exit 1
fi
'

- name: Notify on failure
if: failure()
run: |
echo "Deployment failed! Check the logs."
61 changes: 42 additions & 19 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,50 @@ on:
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 10

environment: production

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H ${{ secrets.SERVER_IP }} >> ~/.ssh/known_hosts

- name: Deploy via SSH
run: |
ssh ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }} << 'EOF'
- name: Checkout code
uses: actions/checkout@v4

- name: Setup SSH
uses: webfactory/ssh-agent@v0.7.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

- name: Add server to known hosts
run: |
ssh-keyscan -H ${{ secrets.SERVER_IP }} >> ~/.ssh/known_hosts

- name: Deploy via SSH
run: |
ssh -o StrictHostKeyChecking=no ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }} '
set -e
export GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}"
cd /home/modl/modl-admin
git stash
git pull origin main
npm install
cd client
npm install
cd ..
if git diff --name-only HEAD@{1} HEAD | grep -q "^package.*\.json$"; then
npm ci
fi
if git diff --name-only HEAD@{1} HEAD | grep -q "^client/package.*\.json$"; then
cd client
npm ci
cd ..
fi
npm run build
pm2 reload modl-admin
EOF
pm2 reload modl-admin --wait-ready
if pm2 describe modl-admin | grep -q "online"; then
echo "PM2 process is running successfully"
else
echo "Error: PM2 process failed to start"
exit 1
fi
'

- name: Notify on failure
if: failure()
run: |
echo "Production deployment failed! Check the logs."
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@modl-gg:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
3 changes: 2 additions & 1 deletion client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions client/src/components/EditServerModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import {
DialogTitle,
DialogFooter,
DialogClose,
} from 'modl-shared-web/components/ui/dialog';
import { Button } from 'modl-shared-web/components/ui/button';
import { Input } from 'modl-shared-web/components/ui/input';
import { Label } from 'modl-shared-web/components/ui/label';
} from '@modl-gg/shared-web/components/ui/dialog';
import { Button } from '@modl-gg/shared-web/components/ui/button';
import { Input } from '@modl-gg/shared-web/components/ui/input';
import { Label } from '@modl-gg/shared-web/components/ui/label';
import { useForm } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
import { z } from 'zod';
Expand Down
14 changes: 7 additions & 7 deletions client/src/components/SystemLogs.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React, { useState, useEffect } from 'react';
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import { Button } from 'modl-shared-web/components/ui/button';
import { Input } from 'modl-shared-web/components/ui/input';
import { Badge } from 'modl-shared-web/components/ui/badge';
import { Card, CardContent } from 'modl-shared-web/components/ui/card';
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from 'modl-shared-web/components/ui/select';
import { Checkbox } from 'modl-shared-web/components/ui/checkbox';
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from 'modl-shared-web/components/ui/alert-dialog';
import { Button } from '@modl-gg/shared-web/components/ui/button';
import { Input } from '@modl-gg/shared-web/components/ui/input';
import { Badge } from '@modl-gg/shared-web/components/ui/badge';
import { Card, CardContent } from '@modl-gg/shared-web/components/ui/card';
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@modl-gg/shared-web/components/ui/select';
import { Checkbox } from '@modl-gg/shared-web/components/ui/checkbox';
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from '@modl-gg/shared-web/components/ui/alert-dialog';
import { apiClient } from '@/lib/api';
import { formatDate, formatDateRelative } from '@/lib/utils';
import { useSocket } from '@/hooks/use-socket';
Expand Down
8 changes: 4 additions & 4 deletions client/src/pages/AnalyticsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useState, useEffect } from 'react';
import { Link } from 'wouter';
import { useQuery } from '@tanstack/react-query';
import { Button } from 'modl-shared-web/components/ui/button';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from 'modl-shared-web/components/ui/card';
import { Badge } from 'modl-shared-web/components/ui/badge';
import { Tabs, TabsContent, TabsList, TabsTrigger } from 'modl-shared-web/components/ui/tabs';
import { Button } from '@modl-gg/shared-web/components/ui/button';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@modl-gg/shared-web/components/ui/card';
import { Badge } from '@modl-gg/shared-web/components/ui/badge';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@modl-gg/shared-web/components/ui/tabs';
import { useAuth } from '@/hooks/useAuth';
import { apiClient } from '@/lib/api';
import { formatDate, formatDateRelative } from '@/lib/utils';
Expand Down
6 changes: 3 additions & 3 deletions client/src/pages/DashboardPage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Link } from 'wouter';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from 'modl-shared-web/components/ui/card';
import { Button } from 'modl-shared-web/components/ui/button';
import { Badge } from 'modl-shared-web/components/ui/badge';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@modl-gg/shared-web/components/ui/card';
import { Button } from '@modl-gg/shared-web/components/ui/button';
import { Badge } from '@modl-gg/shared-web/components/ui/badge';
import { useAuth } from '@/hooks/useAuth';
import { useRealTimeMetrics } from '@/hooks/useMonitoring';
import { formatDateRelative } from '@/lib/utils';
Expand Down
8 changes: 4 additions & 4 deletions client/src/pages/LoginPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { useForm } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
import { z } from 'zod';
import { useAuth } from '@/hooks/useAuth';
import { Button } from 'modl-shared-web/components/ui/button';
import { Input } from 'modl-shared-web/components/ui/input';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from 'modl-shared-web/components/ui/card';
import { Alert, AlertDescription } from 'modl-shared-web/components/ui/alert';
import { Button } from '@modl-gg/shared-web/components/ui/button';
import { Input } from '@modl-gg/shared-web/components/ui/input';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@modl-gg/shared-web/components/ui/card';
import { Alert, AlertDescription } from '@modl-gg/shared-web/components/ui/alert';
import { Mail, Lock, AlertCircle } from 'lucide-react';

const emailSchema = z.object({
Expand Down
8 changes: 4 additions & 4 deletions client/src/pages/MonitoringPage.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { useState } from 'react';
import { Link } from 'wouter';
import { Button } from 'modl-shared-web/components/ui/button';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from 'modl-shared-web/components/ui/card';
import { Badge } from 'modl-shared-web/components/ui/badge';
import { Input } from 'modl-shared-web/components/ui/input';
import { Button } from '@modl-gg/shared-web/components/ui/button';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@modl-gg/shared-web/components/ui/card';
import { Badge } from '@modl-gg/shared-web/components/ui/badge';
import { Input } from '@modl-gg/shared-web/components/ui/input';
import { useAuth } from '@/hooks/useAuth';
import { useRealTimeMetrics } from '@/hooks/useMonitoring';
import { formatDateRelative } from '@/lib/utils';
Expand Down
4 changes: 2 additions & 2 deletions client/src/pages/SecurityPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Link } from 'wouter';
import { Button } from 'modl-shared-web/components/ui/button';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from 'modl-shared-web/components/ui/card';
import { Button } from '@modl-gg/shared-web/components/ui/button';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@modl-gg/shared-web/components/ui/card';
import { useAuth } from '@/hooks/useAuth';
import {
ArrowLeft,
Expand Down
10 changes: 5 additions & 5 deletions client/src/pages/ServerDetailPage.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useState } from 'react';
import { Link, useParams, useLocation } from 'wouter';
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import { Button } from 'modl-shared-web/components/ui/button';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from 'modl-shared-web/components/ui/card';
import { Badge } from 'modl-shared-web/components/ui/badge';
import { Tabs, TabsContent, TabsList, TabsTrigger } from 'modl-shared-web/components/ui/tabs';
import { Button } from '@modl-gg/shared-web/components/ui/button';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@modl-gg/shared-web/components/ui/card';
import { Badge } from '@modl-gg/shared-web/components/ui/badge';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@modl-gg/shared-web/components/ui/tabs';
import { useAuth } from '@/hooks/useAuth';
import { apiClient } from '@/lib/api';
import { formatDate, formatDateRelative, formatBytes } from '@/lib/utils';
Expand Down Expand Up @@ -35,7 +35,7 @@ import {
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from 'modl-shared-web/components/ui/alert-dialog';
} from '@modl-gg/shared-web/components/ui/alert-dialog';
import { EditServerModal } from '@/components/EditServerModal';

interface ServerDetails {
Expand Down
8 changes: 4 additions & 4 deletions client/src/pages/ServersPage.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useState } from 'react';
import { Link } from 'wouter';
import { useQuery } from '@tanstack/react-query';
import { Card, CardContent, CardHeader, CardTitle } from 'modl-shared-web/components/ui/card';
import { Button } from 'modl-shared-web/components/ui/button';
import { Input } from 'modl-shared-web/components/ui/input';
import { Badge } from 'modl-shared-web/components/ui/badge';
import { Card, CardContent, CardHeader, CardTitle } from '@modl-gg/shared-web/components/ui/card';
import { Button } from '@modl-gg/shared-web/components/ui/button';
import { Input } from '@modl-gg/shared-web/components/ui/input';
import { Badge } from '@modl-gg/shared-web/components/ui/badge';
import { apiClient } from '@/lib/api';
import { formatDate } from '@/lib/utils';
import { useAuth } from '@/hooks/useAuth';
Expand Down
14 changes: 7 additions & 7 deletions client/src/pages/SystemConfigPage.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React, { useState } from 'react';
import { Link } from 'wouter';
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import { Button } from 'modl-shared-web/components/ui/button';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from 'modl-shared-web/components/ui/card';
import { Input } from 'modl-shared-web/components/ui/input';
import { Badge } from 'modl-shared-web/components/ui/badge';
import { Switch } from 'modl-shared-web/components/ui/switch';
import { Tabs, TabsContent, TabsList, TabsTrigger } from 'modl-shared-web/components/ui/tabs';
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from 'modl-shared-web/components/ui/alert-dialog';
import { Button } from '@modl-gg/shared-web/components/ui/button';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@modl-gg/shared-web/components/ui/card';
import { Input } from '@modl-gg/shared-web/components/ui/input';
import { Badge } from '@modl-gg/shared-web/components/ui/badge';
import { Switch } from '@modl-gg/shared-web/components/ui/switch';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@modl-gg/shared-web/components/ui/tabs';
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from '@modl-gg/shared-web/components/ui/alert-dialog';
import { useAuth } from '@/hooks/useAuth';
import { apiClient } from '@/lib/api';
import {
Expand Down
10 changes: 5 additions & 5 deletions client/src/pages/SystemPromptsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useState, useEffect } from 'react';
import { Link } from 'wouter';
import { Button } from 'modl-shared-web/components/ui/button';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from 'modl-shared-web/components/ui/card';
import { Textarea } from 'modl-shared-web/components/ui/textarea';
import { Badge } from 'modl-shared-web/components/ui/badge';
import { useToast } from 'modl-shared-web/hooks/use-toast';
import { Button } from '@modl-gg/shared-web/components/ui/button';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@modl-gg/shared-web/components/ui/card';
import { Textarea } from '@modl-gg/shared-web/components/ui/textarea';
import { Badge } from '@modl-gg/shared-web/components/ui/badge';
import { useToast } from '@modl-gg/shared-web/hooks/use-toast';
import { RefreshCw, RotateCcw, Save, AlertTriangle, Brain, ShieldCheck, ArrowLeft, Settings } from 'lucide-react';
import { apiClient } from '../lib/api';

Expand Down
Loading