From 09b2c23cc1d1d98e6ff422c1e84d1dcf2006c338 Mon Sep 17 00:00:00 2001 From: bartek Date: Wed, 23 Oct 2024 11:03:50 +0200 Subject: [PATCH 01/15] Update README.md run in docker instruction --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index d2ef957..7aa15be 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,12 @@ You can configure the agent's name, model, and prompts in their profile like `an You can configure project details in `settings.js`. [See file for more details](settings.js) +### Run in docker to reduce some of the risks + +``` +docker run -i -t --rm -v $(pwd):/usr/src/app -w /usr/src/app node:latest npm start +``` + ### Online Servers To connect to online servers your bot will need an official Microsoft/Minecraft account. You can use your own personal one, but will need another account if you want to connect with it. Here are example settings for this: ``` From 1b690c00cf4c47f0f7a8539aa32e963dd582c250 Mon Sep 17 00:00:00 2001 From: bartek Date: Fri, 25 Oct 2024 10:30:32 +0200 Subject: [PATCH 02/15] Update README.md more instruction --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 7aa15be..c0e46da 100644 --- a/README.md +++ b/README.md @@ -48,10 +48,18 @@ You can configure project details in `settings.js`. [See file for more details]( ### Run in docker to reduce some of the risks +If you intent to `allow_insecure_coding` it might be a good idea to put the whole app into a docker container to reduce risks of damaging your system via a malicious code. + ``` docker run -i -t --rm -v $(pwd):/usr/src/app -w /usr/src/app node:latest npm start ``` +When running in docker, if you want the bot to join your local minecraft server, you have to use special host address to call your localhost from your docker container: `host.docker.internal`. Put this into your `settings.json`: + +``` +"host": "host.docker.internal", // instead of "localhost", to join your local miecraft from inside the docker container +``` + ### Online Servers To connect to online servers your bot will need an official Microsoft/Minecraft account. You can use your own personal one, but will need another account if you want to connect with it. Here are example settings for this: ``` From c0fbcb27aa095e83840102fe54be33c9806b502d Mon Sep 17 00:00:00 2001 From: bartek Date: Fri, 25 Oct 2024 10:45:49 +0200 Subject: [PATCH 03/15] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c0e46da..c9b102c 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ If you intent to `allow_insecure_coding` it might be a good idea to put the whol docker run -i -t --rm -v $(pwd):/usr/src/app -w /usr/src/app node:latest npm start ``` -When running in docker, if you want the bot to join your local minecraft server, you have to use special host address to call your localhost from your docker container: `host.docker.internal`. Put this into your `settings.json`: +When running in docker, if you want the bot to join your local minecraft server, you have to use a special host address to call your localhost from inside your docker container: `host.docker.internal`. Put this into your [settings.js](settings.js): ``` "host": "host.docker.internal", // instead of "localhost", to join your local miecraft from inside the docker container From 44350d3c243825f5e90b502feb94e01899c5cd5c Mon Sep 17 00:00:00 2001 From: bartek Date: Fri, 25 Oct 2024 10:52:58 +0200 Subject: [PATCH 04/15] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c9b102c..1e9f5cd 100644 --- a/README.md +++ b/README.md @@ -48,16 +48,16 @@ You can configure project details in `settings.js`. [See file for more details]( ### Run in docker to reduce some of the risks -If you intent to `allow_insecure_coding` it might be a good idea to put the whole app into a docker container to reduce risks of damaging your system via a malicious code. +If you intent to `allow_insecure_coding`, it might be a good idea to put the whole app into a docker container to reduce risks of running unknown code. ``` -docker run -i -t --rm -v $(pwd):/usr/src/app -w /usr/src/app node:latest npm start +docker run -i -t --rm -v $(pwd):/app -w /app node:latest node main.js ``` -When running in docker, if you want the bot to join your local minecraft server, you have to use a special host address to call your localhost from inside your docker container: `host.docker.internal`. Put this into your [settings.js](settings.js): +When running in docker, if you want the bot to join your local minecraft server, you have to use a special host address `host.docker.internal` to call your localhost from inside your docker container. Put this into your [settings.js](settings.js): ``` -"host": "host.docker.internal", // instead of "localhost", to join your local miecraft from inside the docker container +"host": "host.docker.internal", // instead of "localhost", to join your local minecraft from inside the docker container ``` ### Online Servers From 60bc2299eab5f87cb2a5deb09adb52a6e7b1c482 Mon Sep 17 00:00:00 2001 From: bartek Date: Tue, 29 Oct 2024 09:11:02 +0100 Subject: [PATCH 05/15] Create docker-compose.yml added docker-compose.yml --- docker-compose.yml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7d6243e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +version: '3.8' + +services: + app: + image: node:latest + working_dir: /app + volumes: + - .:/app + command: node main.js From 906df6f6e4585227c5dc136b451f8730aea0c7d0 Mon Sep 17 00:00:00 2001 From: bartek Date: Tue, 29 Oct 2024 09:17:44 +0100 Subject: [PATCH 06/15] Updated README.md: updated docker instruction plus some formatting --- README.md | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 1e9f5cd..484d68f 100644 --- a/README.md +++ b/README.md @@ -50,19 +50,23 @@ You can configure project details in `settings.js`. [See file for more details]( If you intent to `allow_insecure_coding`, it might be a good idea to put the whole app into a docker container to reduce risks of running unknown code. -``` +```bash docker run -i -t --rm -v $(pwd):/app -w /app node:latest node main.js ``` +or simply +```bash +docker-compose up +``` When running in docker, if you want the bot to join your local minecraft server, you have to use a special host address `host.docker.internal` to call your localhost from inside your docker container. Put this into your [settings.js](settings.js): -``` +```javascript "host": "host.docker.internal", // instead of "localhost", to join your local minecraft from inside the docker container ``` ### Online Servers To connect to online servers your bot will need an official Microsoft/Minecraft account. You can use your own personal one, but will need another account if you want to connect with it. Here are example settings for this: -``` +```javascript "host": "111.222.333.444", "port": 55920, "auth": "microsoft", @@ -83,13 +87,15 @@ Bot profiles are json files (such as `andy.json`) that define: By default, the program will use the profiles specified in `settings.js`. You can specify one or more agent profiles using the `--profiles` argument: -`node main.js --profiles ./profiles/andy.json ./profiles/jill.json` +```bash +node main.js --profiles ./profiles/andy.json ./profiles/jill.json +``` ### Model Specifications LLM backends can be specified as simply as `"model": "gpt-3.5-turbo"`. However, for both the chat model and the embedding model, the bot profile can specify the below attributes: -``` +```json "model": { "api": "openai", "url": "https://api.openai.com/v1/", @@ -108,15 +114,15 @@ If the embedding field is not specified, then it will use the default embedding Thus, all the below specifications are equivalent to the above example: -``` +```json "model": "gpt-3.5-turbo" ``` -``` +```json "model": { "api": "openai" } ``` -``` +```json "model": "gpt-3.5-turbo", "embedding": "openai" ``` From 2628f1a4dedc99bbff3fd4c944fa9f018da4bfc6 Mon Sep 17 00:00:00 2001 From: bartek szabat Date: Tue, 29 Oct 2024 11:35:41 +0100 Subject: [PATCH 07/15] run in docker-compose: open prismarine viewer ports --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 7d6243e..0bef712 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,3 +7,5 @@ services: volumes: - .:/app command: node main.js + ports: + - "3000-3003:3000-3003" From 2ee94d7b60a10a0c91541198df7786212ad172e5 Mon Sep 17 00:00:00 2001 From: bartek szabat Date: Tue, 29 Oct 2024 11:40:18 +0100 Subject: [PATCH 08/15] run in docker-compose: open prismarine viewer ports: update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5c26b92..414887c 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ You can configure project details in `settings.js`. [See file for more details]( If you intent to `allow_insecure_coding`, it might be a good idea to put the whole app into a docker container to reduce risks of running unknown code. ```bash -docker run -i -t --rm -v $(pwd):/app -w /app node:latest node main.js +docker run -i -t --rm -v $(pwd):/app -w /app -p 3000-3003:3000-3003 node:latest node main.js ``` or simply ```bash From af53f854f8910584e1e8a7db2786cf1f330ab8a0 Mon Sep 17 00:00:00 2001 From: bartek szabat Date: Tue, 29 Oct 2024 11:58:11 +0100 Subject: [PATCH 09/15] run in docker-compose: open prismarine viewer ports: update readme --- README.md | 2 ++ docker-compose.yml | 9 ++++++++- services/viaproxy/README.md | 25 +++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 services/viaproxy/README.md diff --git a/README.md b/README.md index 414887c..018d144 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,8 @@ When running in docker, if you want the bot to join your local minecraft server, "host": "host.docker.internal", // instead of "localhost", to join your local minecraft from inside the docker container ``` +To connect to an unsupported minecraft version, you can try to use [viaproxy](services/viaproxy/README.md) + ### Online Servers To connect to online servers your bot will need an official Microsoft/Minecraft account. You can use your own personal one, but will need another account if you want to connect with it. Here are example settings for this: ```javascript diff --git a/docker-compose.yml b/docker-compose.yml index 0bef712..b37cef5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,5 +7,12 @@ services: volumes: - .:/app command: node main.js + + viaproxy: #use this service to connect to an unsupported minecraft server versions. more info: ./services/viaproxy/README.md + image: ghcr.io/viaversion/viaproxy:latest + volumes: + - ./services/viaproxy:/app/run ports: - - "3000-3003:3000-3003" + - "25568:25568" + profiles: + - viaproxy diff --git a/services/viaproxy/README.md b/services/viaproxy/README.md new file mode 100644 index 0000000..5a9f0cc --- /dev/null +++ b/services/viaproxy/README.md @@ -0,0 +1,25 @@ +Use this service to connect your bot to unsupported minecraft server versions. + +Run: + +```bash +docker-compose --profile viaproxy up +``` + +After first start it will create config file `viaproxy.yml` in this directory. + +Edit this file, and change your desired target `target-address`, + +then point to your `settings.js` `host` and `port` to viaproxy: + +```javascript + "host": "host.docker.internal", + "port": 25568, +``` + +This easily works with "offline" servers. + +Connecting to "online" servers involves more configuration: see `auth-method` in `viaproxy.yml` (TODO describe) + + + From 62550aa2c825534f739c2be0662a7b4d7225248e Mon Sep 17 00:00:00 2001 From: bartek szabat Date: Tue, 29 Oct 2024 11:58:11 +0100 Subject: [PATCH 10/15] run in docker-compose: added viaproxy service to connect to unsupported minecraft versions --- README.md | 2 ++ docker-compose.yml | 9 ++++++++- services/viaproxy/README.md | 25 +++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 services/viaproxy/README.md diff --git a/README.md b/README.md index 414887c..018d144 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,8 @@ When running in docker, if you want the bot to join your local minecraft server, "host": "host.docker.internal", // instead of "localhost", to join your local minecraft from inside the docker container ``` +To connect to an unsupported minecraft version, you can try to use [viaproxy](services/viaproxy/README.md) + ### Online Servers To connect to online servers your bot will need an official Microsoft/Minecraft account. You can use your own personal one, but will need another account if you want to connect with it. Here are example settings for this: ```javascript diff --git a/docker-compose.yml b/docker-compose.yml index 0bef712..b37cef5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,5 +7,12 @@ services: volumes: - .:/app command: node main.js + + viaproxy: #use this service to connect to an unsupported minecraft server versions. more info: ./services/viaproxy/README.md + image: ghcr.io/viaversion/viaproxy:latest + volumes: + - ./services/viaproxy:/app/run ports: - - "3000-3003:3000-3003" + - "25568:25568" + profiles: + - viaproxy diff --git a/services/viaproxy/README.md b/services/viaproxy/README.md new file mode 100644 index 0000000..5a9f0cc --- /dev/null +++ b/services/viaproxy/README.md @@ -0,0 +1,25 @@ +Use this service to connect your bot to unsupported minecraft server versions. + +Run: + +```bash +docker-compose --profile viaproxy up +``` + +After first start it will create config file `viaproxy.yml` in this directory. + +Edit this file, and change your desired target `target-address`, + +then point to your `settings.js` `host` and `port` to viaproxy: + +```javascript + "host": "host.docker.internal", + "port": 25568, +``` + +This easily works with "offline" servers. + +Connecting to "online" servers involves more configuration: see `auth-method` in `viaproxy.yml` (TODO describe) + + + From a58f14e3dea3e841adb19dc34d8cf71e570a3577 Mon Sep 17 00:00:00 2001 From: bartek szabat Date: Tue, 29 Oct 2024 12:04:56 +0100 Subject: [PATCH 11/15] run in docker-compose: viaproxy readme --- services/viaproxy/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/viaproxy/README.md b/services/viaproxy/README.md index 5a9f0cc..ada93c0 100644 --- a/services/viaproxy/README.md +++ b/services/viaproxy/README.md @@ -6,7 +6,7 @@ Run: docker-compose --profile viaproxy up ``` -After first start it will create config file `viaproxy.yml` in this directory. +After first start it will create config file `services/viaproxy/viaproxy.yml`. Edit this file, and change your desired target `target-address`, From 0c162e3ce3a670dffff21d6f08aeec3e2939311e Mon Sep 17 00:00:00 2001 From: bartek szabat Date: Tue, 29 Oct 2024 12:35:05 +0100 Subject: [PATCH 12/15] run in docker-compose: ports lost and found --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index b37cef5..72e3ab9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,6 +7,8 @@ services: volumes: - .:/app command: node main.js + ports: + - "3000-3003:3000-3003" # see what your bot see: http://localhost:3000/ viaproxy: #use this service to connect to an unsupported minecraft server versions. more info: ./services/viaproxy/README.md image: ghcr.io/viaversion/viaproxy:latest From 04c6fdc13b97e8ace62fbb458390552a654751b0 Mon Sep 17 00:00:00 2001 From: bartek szabat Date: Tue, 29 Oct 2024 12:45:54 +0100 Subject: [PATCH 13/15] run in docker-compose: viaproxy: ignore files, fix readme --- .gitignore | 8 +++++++- services/viaproxy/README.md | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index a2aee7e..6dc4554 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,10 @@ code_records/ scratch.js bots/**/action-code/** bots/**/ -keys.json \ No newline at end of file +keys.json +services/viaproxy/jars/** +services/viaproxy/logs/** +services/viaproxy/plugins/** +services/viaproxy/ViaLoader/** +services/viaproxy/saves.json +services/viaproxy/viaproxy.yml diff --git a/services/viaproxy/README.md b/services/viaproxy/README.md index ada93c0..d6e53ba 100644 --- a/services/viaproxy/README.md +++ b/services/viaproxy/README.md @@ -19,7 +19,7 @@ then point to your `settings.js` `host` and `port` to viaproxy: This easily works with "offline" servers. -Connecting to "online" servers involves more configuration: see `auth-method` in `viaproxy.yml` (TODO describe) +Connecting to "online" servers with viaproxy involves more configuration: see `auth-method` in `services/viaproxy/viaproxy.yml` (TODO describe) From 678504767fea5e93e4d381cba6cb3b5f1af71d36 Mon Sep 17 00:00:00 2001 From: bartek szabat Date: Tue, 29 Oct 2024 14:27:22 +0100 Subject: [PATCH 14/15] run in docker-compose: funny comment --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 72e3ab9..d9822f1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: - .:/app command: node main.js ports: - - "3000-3003:3000-3003" # see what your bot see: http://localhost:3000/ + - "3000-3003:3000-3003" # see the view from the camera mounted on your bot head: http://localhost:3000/ viaproxy: #use this service to connect to an unsupported minecraft server versions. more info: ./services/viaproxy/README.md image: ghcr.io/viaversion/viaproxy:latest From a1a8a38576e8078bd10707d22c6dd0ed3d34cabc Mon Sep 17 00:00:00 2001 From: bartek szabat Date: Wed, 30 Oct 2024 09:31:21 +0100 Subject: [PATCH 15/15] run in docker-compose: readme --- services/viaproxy/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/viaproxy/README.md b/services/viaproxy/README.md index d6e53ba..d1ed687 100644 --- a/services/viaproxy/README.md +++ b/services/viaproxy/README.md @@ -1,4 +1,4 @@ -Use this service to connect your bot to unsupported minecraft server versions. +Use this service to connect your bot to an unsupported minecraft server versions. Run: @@ -10,7 +10,7 @@ After first start it will create config file `services/viaproxy/viaproxy.yml`. Edit this file, and change your desired target `target-address`, -then point to your `settings.js` `host` and `port` to viaproxy: +then point your `settings.js` `host` and `port` to viaproxy endpoint: ```javascript "host": "host.docker.internal", @@ -19,7 +19,7 @@ then point to your `settings.js` `host` and `port` to viaproxy: This easily works with "offline" servers. -Connecting to "online" servers with viaproxy involves more configuration: see `auth-method` in `services/viaproxy/viaproxy.yml` (TODO describe) +Connecting to "online" servers via viaproxy involves more effort: see `auth-method` in `services/viaproxy/viaproxy.yml` (TODO describe)