feat: Update README for Docker installation; add setup instructions and commands
This commit is contained in:
123
README.md
123
README.md
@@ -52,54 +52,111 @@ A comprehensive full-stack web application for monitoring and controlling Comput
|
|||||||
|
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
|
|
||||||
- Node.js 18+ installed on your computer
|
- **Docker and Docker Compose** installed on your computer
|
||||||
- Minecraft with ComputerCraft mod installed
|
- **Minecraft** with ComputerCraft mod installed
|
||||||
- At least one turtle with a wireless modem
|
- At least one **turtle with a wireless modem**
|
||||||
- A computer in Minecraft to run the bridge script
|
- A **computer in Minecraft** to run the bridge script
|
||||||
|
|
||||||
### Installation
|
### Installation (Docker - Recommended)
|
||||||
|
|
||||||
1. **Clone or download this project**
|
1. **Clone or download this project**
|
||||||
|
|
||||||
2. **Install Server Dependencies**
|
|
||||||
```bash
|
```bash
|
||||||
cd server
|
git clone <repository-url>
|
||||||
npm install
|
cd remoteturtle
|
||||||
```
|
```
|
||||||
|
|
||||||
3. **Install Client Dependencies**
|
2. **Start with Docker Compose**
|
||||||
```bash
|
```bash
|
||||||
cd client
|
docker-compose up -d
|
||||||
npm install
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
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**
|
3. **Access the Web Interface**
|
||||||
```bash
|
- Frontend: http://localhost:3000
|
||||||
cd server
|
- Backend API: http://localhost:3001
|
||||||
npm start
|
|
||||||
```
|
|
||||||
Server will run on:
|
|
||||||
- HTTP: http://localhost:3001
|
|
||||||
- WebSocket: ws://localhost:3002
|
- WebSocket: ws://localhost:3002
|
||||||
|
|
||||||
5. **Start the React Frontend**
|
4. **Set up Minecraft Bridge Computer**
|
||||||
```bash
|
|
||||||
cd client
|
In Minecraft, place a computer with a wireless modem and run:
|
||||||
npm run dev
|
```lua
|
||||||
|
wget https://raw.githubusercontent.com/<your-repo>/main/startup_webbridge.lua startup
|
||||||
|
reboot
|
||||||
```
|
```
|
||||||
Frontend will open at: http://localhost:3000
|
|
||||||
|
Or manually:
|
||||||
6. **Set up Minecraft Bridge**
|
|
||||||
- In Minecraft, place a computer with a wireless modem
|
|
||||||
- Copy `webbridge.lua` to the computer
|
- Copy `webbridge.lua` to the computer
|
||||||
- Edit the `SERVER_URL` in webbridge.lua to point to your server
|
- Edit the `SERVER_URL` to point to your Docker host
|
||||||
(If running locally, use `http://localhost:3001`)
|
- If Minecraft is on the same machine: `http://host.docker.internal:3001`
|
||||||
|
- If on different machine: `http://<your-ip>:3001`
|
||||||
- Run: `webbridge`
|
- Run: `webbridge`
|
||||||
|
|
||||||
7. **Deploy Turtles**
|
5. **Deploy Auto-Updating Turtles**
|
||||||
- Copy `turtle.lua` to your turtles
|
|
||||||
- Equip wireless modems on turtles
|
On each turtle with a wireless modem, run:
|
||||||
- Run: `turtle`
|
```lua
|
||||||
|
wget https://raw.githubusercontent.com/<your-repo>/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/<your-repo>/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
|
## 📁 Project Structure
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user