diff --git a/README.md b/README.md index f87bd56..3ffe6be 100644 --- a/README.md +++ b/README.md @@ -52,54 +52,111 @@ A comprehensive full-stack web application for monitoring and controlling Comput ### Prerequisites -- Node.js 18+ installed on your computer -- Minecraft with ComputerCraft mod installed -- At least one turtle with a wireless modem -- A computer in Minecraft to run the bridge script +- **Docker and Docker Compose** installed on your computer +- **Minecraft** with ComputerCraft mod installed +- At least one **turtle with a wireless modem** +- A **computer in Minecraft** to run the bridge script -### Installation +### Installation (Docker - Recommended) 1. **Clone or download this project** - -2. **Install Server Dependencies** ```bash - cd server - npm install + git clone + cd remoteturtle ``` -3. **Install Client Dependencies** +2. **Start with Docker Compose** ```bash - cd client - npm install + docker-compose up -d ``` + + This will automatically: + - Build and start the backend server on port 3001 + - Build and start the frontend on port 3000 + - Create a persistent SQLite database volume + - Set up networking between containers -4. **Start the Backend Server** - ```bash - cd server - npm start - ``` - Server will run on: - - HTTP: http://localhost:3001 +3. **Access the Web Interface** + - Frontend: http://localhost:3000 + - Backend API: http://localhost:3001 - WebSocket: ws://localhost:3002 -5. **Start the React Frontend** - ```bash - cd client - npm run dev +4. **Set up Minecraft Bridge Computer** + + In Minecraft, place a computer with a wireless modem and run: + ```lua + wget https://raw.githubusercontent.com//main/startup_webbridge.lua startup + reboot ``` - Frontend will open at: http://localhost:3000 - -6. **Set up Minecraft Bridge** - - In Minecraft, place a computer with a wireless modem + + Or manually: - Copy `webbridge.lua` to the computer - - Edit the `SERVER_URL` in webbridge.lua to point to your server - (If running locally, use `http://localhost:3001`) + - Edit the `SERVER_URL` to point to your Docker host + - If Minecraft is on the same machine: `http://host.docker.internal:3001` + - If on different machine: `http://:3001` - Run: `webbridge` -7. **Deploy Turtles** - - Copy `turtle.lua` to your turtles - - Equip wireless modems on turtles - - Run: `turtle` +5. **Deploy Auto-Updating Turtles** + + On each turtle with a wireless modem, run: + ```lua + wget https://raw.githubusercontent.com//main/startup_turtle.lua startup + reboot + ``` + + This installs an auto-update system that: + - Downloads the latest `turtle.lua` on boot + - Falls back to cached version if download fails + - Keeps turtles updated automatically + +6. **Optional: Deploy Pocket Computer Control** + + For wireless pocket computer control: + ```lua + wget https://raw.githubusercontent.com//main/startup_pocket.lua startup + reboot + ``` + +### Docker Commands + +```bash +# Start services +docker-compose up -d + +# View logs +docker-compose logs -f + +# Stop services +docker-compose down + +# Rebuild after code changes +docker-compose up -d --build + +# Stop and remove volumes (resets database) +docker-compose down -v +``` + +### Alternative: Manual Installation (Without Docker) + +If you prefer not to use Docker: + +1. **Install Dependencies** + ```bash + cd server && npm install + cd ../client && npm install + ``` + +2. **Start Backend** + ```bash + cd server && npm start + ``` + +3. **Start Frontend** + ```bash + cd client && npm run dev + ``` + +4. Follow steps 4-6 from the Docker installation above ## 📁 Project Structure