diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 644da00..9f65a18 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -31,13 +31,13 @@ jobs: cd ~/workspace/executeme # make sure we are in executeme directory - ls -a + # ls -a # Pull the latest code from the 'main' branch of the GitHub repository. git pull origin main # Check git status to make sure everything is up to date - git status + # git status # Execute your bash script. bash ./scripts.sh diff --git a/app.js b/app.js index fecc25f..3464f0c 100644 --- a/app.js +++ b/app.js @@ -119,7 +119,7 @@ app.post("/run", async (req, res) => { // 3. Prepare and execute the Docker command // The -v flag uses the hostVolumePath (absolute path on host) as the source, // and mounts it to '/app' inside the executor container. - const runCommand = `docker run --rm --memory=256m --cpus=0.5 -v "${hostVolumePath}:/app" ${langConfig.image} ${langConfig.cmd}`; + const runCommand = `docker run --rm --memory=512m --cpus=0.5 -v "${hostVolumePath}:/app" ${langConfig.image} ${langConfig.cmd}`; console.log(`[Executor] Attempting to run command: ${runCommand}`); diff --git a/changelog.md b/changelog.md index 1b5c63f..8615224 100644 --- a/changelog.md +++ b/changelog.md @@ -22,3 +22,5 @@ - [feat] shows a floating button for displaying online coders - [fix] Fixed mobile responsive issues - [feat] Nginx setup for getting free ssl on our server +- [feat] deployment github action to automate the vps deploy +- [chore] Incress the memory uses for only **Kotlin** language support diff --git a/websites/src/app/_actions/execute.ts b/websites/src/app/_actions/execute.ts index 95321cc..7672f47 100644 --- a/websites/src/app/_actions/execute.ts +++ b/websites/src/app/_actions/execute.ts @@ -4,12 +4,18 @@ import { Input, Output } from "@/@types"; import { baseUri } from "@/constants/base"; import axios from "axios"; import { performance } from "perf_hooks"; +import https from "https"; // Import the built-in Node.js https module +const agent = new https.Agent({ + rejectUnauthorized: false, // THIS IS THE KEY LINE +}); +const axiosInstance = axios.create({ + httpsAgent: agent, +}); export async function executeCodeAction(input: Input): Promise { const start = performance.now(); - console.log("baseurl: ", baseUri); try { - const response = await axios.post(`${baseUri}/run`, input); + const response = await axiosInstance.post(`${baseUri}/run`, input); const end = performance.now(); return { diff --git a/websites/src/app/_components/editor-view/code-editor.tsx b/websites/src/app/_components/editor-view/code-editor.tsx index 7754510..e9be21c 100644 --- a/websites/src/app/_components/editor-view/code-editor.tsx +++ b/websites/src/app/_components/editor-view/code-editor.tsx @@ -4,7 +4,6 @@ import { Editor } from "@monaco-editor/react"; import { Card, CardContent } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; import { Loader2 } from "lucide-react"; -import { LANGUAGE_MAP } from "@/constants"; import { Language } from "@/@types"; import { codeEditorOptions } from "@/constants"; @@ -58,9 +57,9 @@ export function CodeEditor({ width={"100%"} // Ensure the language is correctly mapped for Monaco to provide suggestions className="w-full" - language={LANGUAGE_MAP[language]} + language={language} value={value ?? "// Start coding here..."} - defaultLanguage={LANGUAGE_MAP[language]} + defaultLanguage={language} saveViewState={true} onChange={handleEditorChange} // Force vs-dark theme for the editor diff --git a/websites/src/components/shared/online-coders/online-coders.tsx b/websites/src/components/shared/online-coders/online-coders.tsx index 34f1211..111d4e6 100644 --- a/websites/src/components/shared/online-coders/online-coders.tsx +++ b/websites/src/components/shared/online-coders/online-coders.tsx @@ -11,33 +11,9 @@ type Props = { }; export default function OnlineCoders({ className }: Props) { const [count, setCount] = useState(0); - const [displayCount, setDisplayCount] = useState(0); - const [isVisible, setIsVisible] = useState(false); - - // Animated counter effect - useEffect(() => { - setIsVisible(true); - const duration = 2000; // 2 seconds - const steps = 60; - const increment = count / steps; - let current = 0; - - const timer = setInterval(() => { - current += increment; - if (current >= count) { - setDisplayCount(count); - clearInterval(timer); - } else { - setDisplayCount(Math.floor(current)); - } - }, duration / steps); - - return () => clearInterval(timer); - }, [count]); useEffect(() => { const handleActiveCoders = (data: string[]) => { - console.log("data: ", data); setCount(data.length || 0); }; socket.on("active_coders", handleActiveCoders); @@ -52,12 +28,9 @@ export default function OnlineCoders({ className }: Props) { {/* Main container with glassmorphism */}
{/* Animated background gradient */}
@@ -66,7 +39,7 @@ export default function OnlineCoders({ className }: Props) { {/* Content */} - + {/* Bottom accent line */}
diff --git a/websites/src/constants/base.ts b/websites/src/constants/base.ts index be322cb..f842e3b 100644 --- a/websites/src/constants/base.ts +++ b/websites/src/constants/base.ts @@ -1,8 +1,6 @@ -export const BASE_URI = "http://localhost:9091"; +// export const baseUri = "https://145.223.97.55:9292" -export const baseUri = "https://145.223.97.55:9292" - -// export const baseUri = -// process.env.NODE_ENV !== "development" -// ? process.env.SERVER_BASE_URL -// : process.env.SERVER_BASE_URL_LOCAL || BASE_URI; +export const baseUri = + process.env.NODE_ENV !== "development" + ? process.env.NEXT_PUBLIC_SERVER_BASE_URL + : process.env.NEXT_PUBLIC_SERVER_BASE_URL_LOCAL; diff --git a/websites/src/constants/index.ts b/websites/src/constants/index.ts index 2163b4f..f974030 100644 --- a/websites/src/constants/index.ts +++ b/websites/src/constants/index.ts @@ -1,109 +1,8 @@ export * from "./editor"; export const LANGUAGE_MAP = { python: "python", - javascript: "nodejs", + javascript: "javascript", typescript: "typescript", java: "java", - // cpp: 'cpp', - // c: 'c', - // go: 'go', - // rust: 'rust', - // php: 'php', - // ruby: 'ruby', - // html: 'html', - // css: 'css', - // json: 'json', - // xml: 'xml', - // sql: 'sql', + kotlin: "kotlin", } as const; - -export const SAMPLE_CODE: Record = { - python: `# Welcome to Execute Me - Python - def hello_world(): - print("Hello, World!") - return 42 - - # Your code here - result = hello_world() - print(f"Result: {result}")`, - - javascript: `// Welcome to Execute Me - JavaScript - function helloWorld() { - console.log("Hello, World!"); - return 42; - } - - // Your code here - const result = helloWorld(); - console.log(\`Result: \${result}\`);`, - - typescript: `// Welcome to Execute Me - TypeScript - function helloWorld(): number { - console.log("Hello, World!"); - return 42; - } - - // Your code here - const result: number = helloWorld(); - console.log(\`Result: \${result}\`);`, - - java: `// Welcome to Execute Me - Java - public class Main { - public static void main(String[] args) { - System.out.println("Hello, World!"); - int result = 42; - System.out.println("Result: " + result); - } - }`, - - cpp: `// Welcome to Execute Me - C++ - #include - using namespace std; - - int main() { - cout << "Hello, World!" << endl; - int result = 42; - cout << "Result: " << result << endl; - return 0; - }`, - - c: `// Welcome to Execute Me - C - #include - - int main() { - printf("Hello, World!\\n"); - int result = 42; - printf("Result: %d\\n", result); - return 0; - }`, - - go: `// Welcome to Execute Me - Go - package main - - import "fmt" - - func main() { - fmt.Println("Hello, World!") - result := 42 - fmt.Printf("Result: %d\\n", result) - }`, - - rust: `// Welcome to Execute Me - Rust - fn main() { - println!("Hello, World!"); - let result = 42; - println!("Result: {}", result); - }`, - - php: ``, - - ruby: `# Welcome to Execute Me - Ruby - puts "Hello, World!" - result = 42 - puts "Result: #{result}"`, -};