Skip to content

Commit 01f7c7a

Browse files
Merge pull request #9 from devlopersabbir/sabbir
Sabbir
2 parents 021d9d1 + 687575a commit 01f7c7a

8 files changed

Lines changed: 25 additions & 148 deletions

File tree

.github/workflows/deploy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ jobs:
3131
cd ~/workspace/executeme
3232
3333
# make sure we are in executeme directory
34-
ls -a
34+
# ls -a
3535
3636
# Pull the latest code from the 'main' branch of the GitHub repository.
3737
git pull origin main
3838
3939
# Check git status to make sure everything is up to date
40-
git status
40+
# git status
4141
4242
# Execute your bash script.
4343
bash ./scripts.sh

app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ app.post("/run", async (req, res) => {
119119
// 3. Prepare and execute the Docker command
120120
// The -v flag uses the hostVolumePath (absolute path on host) as the source,
121121
// and mounts it to '/app' inside the executor container.
122-
const runCommand = `docker run --rm --memory=256m --cpus=0.5 -v "${hostVolumePath}:/app" ${langConfig.image} ${langConfig.cmd}`;
122+
const runCommand = `docker run --rm --memory=512m --cpus=0.5 -v "${hostVolumePath}:/app" ${langConfig.image} ${langConfig.cmd}`;
123123

124124
console.log(`[Executor] Attempting to run command: ${runCommand}`);
125125

changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@
2222
- [feat] shows a floating button for displaying online coders
2323
- [fix] Fixed mobile responsive issues
2424
- [feat] Nginx setup for getting free ssl on our server
25+
- [feat] deployment github action to automate the vps deploy
26+
- [chore] Incress the memory uses for only **Kotlin** language support

websites/src/app/_actions/execute.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,18 @@ import { Input, Output } from "@/@types";
44
import { baseUri } from "@/constants/base";
55
import axios from "axios";
66
import { performance } from "perf_hooks";
7+
import https from "https"; // Import the built-in Node.js https module
78

9+
const agent = new https.Agent({
10+
rejectUnauthorized: false, // THIS IS THE KEY LINE
11+
});
12+
const axiosInstance = axios.create({
13+
httpsAgent: agent,
14+
});
815
export async function executeCodeAction(input: Input): Promise<Output> {
916
const start = performance.now();
10-
console.log("baseurl: ", baseUri);
1117
try {
12-
const response = await axios.post(`${baseUri}/run`, input);
18+
const response = await axiosInstance.post(`${baseUri}/run`, input);
1319
const end = performance.now();
1420

1521
return {

websites/src/app/_components/editor-view/code-editor.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { Editor } from "@monaco-editor/react";
44
import { Card, CardContent } from "@/components/ui/card";
55
import { Badge } from "@/components/ui/badge";
66
import { Loader2 } from "lucide-react";
7-
import { LANGUAGE_MAP } from "@/constants";
87
import { Language } from "@/@types";
98
import { codeEditorOptions } from "@/constants";
109

@@ -58,9 +57,9 @@ export function CodeEditor({
5857
width={"100%"}
5958
// Ensure the language is correctly mapped for Monaco to provide suggestions
6059
className="w-full"
61-
language={LANGUAGE_MAP[language]}
60+
language={language}
6261
value={value ?? "// Start coding here..."}
63-
defaultLanguage={LANGUAGE_MAP[language]}
62+
defaultLanguage={language}
6463
saveViewState={true}
6564
onChange={handleEditorChange}
6665
// Force vs-dark theme for the editor

websites/src/components/shared/online-coders/online-coders.tsx

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,9 @@ type Props = {
1111
};
1212
export default function OnlineCoders({ className }: Props) {
1313
const [count, setCount] = useState(0);
14-
const [displayCount, setDisplayCount] = useState(0);
15-
const [isVisible, setIsVisible] = useState(false);
16-
17-
// Animated counter effect
18-
useEffect(() => {
19-
setIsVisible(true);
20-
const duration = 2000; // 2 seconds
21-
const steps = 60;
22-
const increment = count / steps;
23-
let current = 0;
24-
25-
const timer = setInterval(() => {
26-
current += increment;
27-
if (current >= count) {
28-
setDisplayCount(count);
29-
clearInterval(timer);
30-
} else {
31-
setDisplayCount(Math.floor(current));
32-
}
33-
}, duration / steps);
34-
35-
return () => clearInterval(timer);
36-
}, [count]);
3714

3815
useEffect(() => {
3916
const handleActiveCoders = (data: string[]) => {
40-
console.log("data: ", data);
4117
setCount(data.length || 0);
4218
};
4319
socket.on("active_coders", handleActiveCoders);
@@ -52,12 +28,9 @@ export default function OnlineCoders({ className }: Props) {
5228

5329
{/* Main container with glassmorphism */}
5430
<div
55-
className={`
56-
relative backdrop-blur-xl bg-white/10 border border-white/20
31+
className="relative backdrop-blur-xl bg-white/10 border border-white/20
5732
rounded-2xl p-6 shadow-2xl overflow-hidden
58-
transform transition-all duration-1000 ease-out
59-
${isVisible ? "translate-y-0 opacity-100" : "translate-y-4 opacity-0"}
60-
`}
33+
transform transition-all duration-1000 ease-out translate-y-0 opacity-100"
6134
>
6235
{/* Animated background gradient */}
6336
<div className="animated-background-gradient animate-gradient-xy"></div>
@@ -66,7 +39,7 @@ export default function OnlineCoders({ className }: Props) {
6639
<FloatingParticles />
6740

6841
{/* Content */}
69-
<Content displayCount={displayCount} />
42+
<Content displayCount={count} />
7043

7144
{/* Bottom accent line */}
7245
<div className="bottom-accent-line animate-gradient-x"></div>

websites/src/constants/base.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
export const BASE_URI = "http://localhost:9091";
1+
// export const baseUri = "https://145.223.97.55:9292"
22

3-
export const baseUri = "https://145.223.97.55:9292"
4-
5-
// export const baseUri =
6-
// process.env.NODE_ENV !== "development"
7-
// ? process.env.SERVER_BASE_URL
8-
// : process.env.SERVER_BASE_URL_LOCAL || BASE_URI;
3+
export const baseUri =
4+
process.env.NODE_ENV !== "development"
5+
? process.env.NEXT_PUBLIC_SERVER_BASE_URL
6+
: process.env.NEXT_PUBLIC_SERVER_BASE_URL_LOCAL;

websites/src/constants/index.ts

Lines changed: 2 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,8 @@
11
export * from "./editor";
22
export const LANGUAGE_MAP = {
33
python: "python",
4-
javascript: "nodejs",
4+
javascript: "javascript",
55
typescript: "typescript",
66
java: "java",
7-
// cpp: 'cpp',
8-
// c: 'c',
9-
// go: 'go',
10-
// rust: 'rust',
11-
// php: 'php',
12-
// ruby: 'ruby',
13-
// html: 'html',
14-
// css: 'css',
15-
// json: 'json',
16-
// xml: 'xml',
17-
// sql: 'sql',
7+
kotlin: "kotlin",
188
} as const;
19-
20-
export const SAMPLE_CODE: Record<string, string> = {
21-
python: `# Welcome to Execute Me - Python
22-
def hello_world():
23-
print("Hello, World!")
24-
return 42
25-
26-
# Your code here
27-
result = hello_world()
28-
print(f"Result: {result}")`,
29-
30-
javascript: `// Welcome to Execute Me - JavaScript
31-
function helloWorld() {
32-
console.log("Hello, World!");
33-
return 42;
34-
}
35-
36-
// Your code here
37-
const result = helloWorld();
38-
console.log(\`Result: \${result}\`);`,
39-
40-
typescript: `// Welcome to Execute Me - TypeScript
41-
function helloWorld(): number {
42-
console.log("Hello, World!");
43-
return 42;
44-
}
45-
46-
// Your code here
47-
const result: number = helloWorld();
48-
console.log(\`Result: \${result}\`);`,
49-
50-
java: `// Welcome to Execute Me - Java
51-
public class Main {
52-
public static void main(String[] args) {
53-
System.out.println("Hello, World!");
54-
int result = 42;
55-
System.out.println("Result: " + result);
56-
}
57-
}`,
58-
59-
cpp: `// Welcome to Execute Me - C++
60-
#include <iostream>
61-
using namespace std;
62-
63-
int main() {
64-
cout << "Hello, World!" << endl;
65-
int result = 42;
66-
cout << "Result: " << result << endl;
67-
return 0;
68-
}`,
69-
70-
c: `// Welcome to Execute Me - C
71-
#include <stdio.h>
72-
73-
int main() {
74-
printf("Hello, World!\\n");
75-
int result = 42;
76-
printf("Result: %d\\n", result);
77-
return 0;
78-
}`,
79-
80-
go: `// Welcome to Execute Me - Go
81-
package main
82-
83-
import "fmt"
84-
85-
func main() {
86-
fmt.Println("Hello, World!")
87-
result := 42
88-
fmt.Printf("Result: %d\\n", result)
89-
}`,
90-
91-
rust: `// Welcome to Execute Me - Rust
92-
fn main() {
93-
println!("Hello, World!");
94-
let result = 42;
95-
println!("Result: {}", result);
96-
}`,
97-
98-
php: `<?php
99-
// Welcome to Execute Me - PHP
100-
echo "Hello, World!\\n";
101-
$result = 42;
102-
echo "Result: " . $result . "\\n";
103-
?>`,
104-
105-
ruby: `# Welcome to Execute Me - Ruby
106-
puts "Hello, World!"
107-
result = 42
108-
puts "Result: #{result}"`,
109-
};

0 commit comments

Comments
 (0)