Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
10eb7cb
Initial setup.
JacobLef Oct 14, 2025
5424540
Initial setup.
JacobLef Oct 14, 2025
ee9f7ea
Merge branch '170-database-refactor' of https://github.com/sandboxnu/…
JacobLef Oct 17, 2025
99cef98
Docker compose file is updated with MongoDB configuration. Dump and s…
JacobLef Oct 17, 2025
f28d89f
Boot file started.
JacobLef Oct 17, 2025
e9dfea9
Initial setup.
JacobLef Oct 14, 2025
c02ac54
Docker compose file is updated with MongoDB configuration. Dump and s…
JacobLef Oct 17, 2025
a4b3f7d
Boot file started.
JacobLef Oct 17, 2025
b43f358
Merge branch '170-database-refactor' of https://github.com/sandboxnu/…
JacobLef Oct 17, 2025
870056f
Initial attempt at boot and start scripts completed. General structur…
JacobLef Oct 18, 2025
78922fa
Boot script is completed. Automatically launches and configures conta…
JacobLef Oct 18, 2025
850a1e7
Updated pacakge.json scripts and README file to relfect script changes.
JacobLef Oct 18, 2025
be26203
Updated boot script to correctly shut down everything without having …
JacobLef Oct 18, 2025
b33739e
Updated boot script to shut down containers only once. Removed SIGINT…
JacobLef Oct 18, 2025
d43102b
Updated boot script with docstrings.
JacobLef Oct 18, 2025
c25b61a
Started dump file.
JacobLef Oct 18, 2025
3653b7e
Initial setup.
JacobLef Oct 14, 2025
7f696c0
Docker compose file is updated with MongoDB configuration. Dump and s…
JacobLef Oct 17, 2025
a43315a
Boot file started.
JacobLef Oct 17, 2025
f60644e
Initial attempt at boot and start scripts completed. General structur…
JacobLef Oct 18, 2025
5c0840f
Boot script is completed. Automatically launches and configures conta…
JacobLef Oct 18, 2025
0a9b421
Updated pacakge.json scripts and README file to relfect script changes.
JacobLef Oct 18, 2025
1275a67
Updated boot script to correctly shut down everything without having …
JacobLef Oct 18, 2025
4087c58
Updated boot script to shut down containers only once. Removed SIGINT…
JacobLef Oct 18, 2025
358aa66
Updated boot script with docstrings.
JacobLef Oct 18, 2025
36a7c0c
Started dump file.
JacobLef Oct 18, 2025
14b9e67
Merge branch '170-database-refactor' of https://github.com/sandboxnu/…
JacobLef Oct 19, 2025
9856587
Changed boot.py to rely on whatever your OS finds to be the python ex…
JacobLef Oct 19, 2025
fa073ed
Updated scripts to be wrapped in node script.
JacobLef Oct 23, 2025
46a8db5
Updated pnpm scripts.
JacobLef Oct 23, 2025
f869c97
Updated start.py to not display error messages when shutting down the…
JacobLef Oct 24, 2025
72862f8
Removed unused imports.
JacobLef Oct 24, 2025
c2ed035
Attempt to fix Windows compatability with SIBREAK.
JacobLef Oct 26, 2025
c661c5d
Updated wrapper to find the absolute path of your OS's python executa…
JacobLef Oct 26, 2025
21e4f76
Commits to attempt to fix. Doesn't work rn.
JacobLef Oct 26, 2025
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
16 changes: 2 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,14 @@
pnpm install
```

### Boot the Infrastructure (Redis Server)

```bash
pnpm run dev:infra
```

### Run the Program

```bash
pnpm run dev
```

### Cleanup Docker Infrastructure

```bash
pnpm run dev:infra:stop
```

### To see if you have a Docker container currently running
### To see if you have any containers currently running

```bash
docker ps
docker compose ps
```
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,16 @@ services:
command: redis-server --appendonly yes
restart: unless-stopped

mongodb:
image: mongodb/mongodb-community-server:6.0-ubi8
ports:
- "27017:27017"
environment:
- MONGO_INITDB_ROOT_USERNAME=devuser
- MONGO_INITDB_ROOT_PASSWORDdevpassword123=
volumes:
- mongodb_data:/data/db

volumes:
redis_data:
mongodb_data:
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@
"husky": "^8.0.0",
"typescript": "^5.0.2"
},
"type": "module",
"scripts": {
"lint": "eslint . --ext .ts,.vue",
"lint:fix": "eslint . --fix --ext .ts,.vue",
"prettier": "prettier . --check",
"prettier:fix": "prettier . --write",
"format": "pnpm prettier:fix && pnpm lint:fix",
"prepare": "husky install",
"dev": "pnpm --stream -r dev",
"dev:infra": "docker-compose up -d redis",
"dev:infra:stop": "docker-compose down redis"
"dev": "node ./scripts/wrapper.js ./scripts/boot.py"
},
"dependencies": {
"@element-plus/icons-vue": "^2.3.1",
Expand Down
35 changes: 35 additions & 0 deletions scripts/boot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import subprocess
import sys

def cleanup() -> None:
"""
Shuts down any docker infrastructure that is currently running. Does not propagate any errors, only error messages if there are issues shutting down the infrastructure.
"""

print("Shutting down docker infrastructure...")
try:
subprocess.run(["docker", "compose", "down"], check=True)
print("Docker infrastructure stopped successfully!")
except subprocess.CalledProcessError:
print("Error shutting down docker infrastructure!")
raise subprocess.CalledProcessError()

def start_infrastructure() -> None:
"""
Starts the Docker infrastructure such that both redis and mongodb containers are launched. Does not propagate any errors, only prints an error message and than exits with an error code.
"""

print("Booting up redis and mongodb...")
try:
subprocess.run(["docker", "compose", "up", "-d"], check=True)
except subprocess.CalledProcessError:
print("Error starting docker infrastructure!")
raise subprocess.CalledProcessError()

start_infrastructure()
try:
subprocess.run([sys.executable, "scripts/start.py"], check=True)
except (KeyboardInterrupt, subprocess.CalledProcessError):
pass
finally:
cleanup()
9 changes: 9 additions & 0 deletions scripts/start.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import subprocess

def init() -> None:
try:
subprocess.run(["pnpm", "--stream", "-r", "dev"])
except subprocess.CalledProcessError:
print("Error starting application!")

init()
35 changes: 35 additions & 0 deletions scripts/wrapper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env node

import { spawn } from "child_process";
import { platform } from "process";

const pythonCmd = platform === "win32" ? "python" : "python3";
const scriptPath = process.argv[2];

if (!scriptPath) {
console.error("Usage: node run-python.js <path-to-python-script>");
process.exit(1);
}

console.log(`Running ${scriptPath} with ${pythonCmd}...`);

const pythonProcess = spawn(pythonCmd, [scriptPath], {
stdio: "inherit",
});

pythonProcess.on("error", (error) => {
console.error(`Failed to start Python: ${error.message}`);
process.exit(1);
});

pythonProcess.on("close", (code) => {
process.exit(code || 0);
});

process.on("SIGINT", () => {
pythonProcess.kill("SIGINT");
});

process.on("SIGTERM", () => {
pythonProcess.kill("SIGTERM");
});