Configuration: Presets - ChrisMavrommatis/Binacle.Net GitHub Wiki

Running Binacle.Net with your own presets is highly desirable, especially if your bin configurations are constant.

This way, you avoid the need to send all of the bins in every request.

Contents

  1. Step 1: Modify Presets
  2. Step 2: Use a Bind Mount to Replace Default Presets
  3. Docker Compose File Template

Step 1: Modify Presets

  • Download the Presets.json file.
  • Modify the file according to your requirements.

[!Caution]

While Binacle.Net assumes the use of centimeters, you can use any measurement system as long as the dimensions are integers and consistent across bins and items.

Step 2: Use a Bind Mount to Replace Default Presets

Replace the default Presets.json located at /app/Config_Files/Presets.json with your customized version by using a bind mount.

There are 2 options to achieve that locally using docker.

Option 1: Command Line

  1. Place the updated Presets.json file anywhere on your system.
  2. Open your terminal and navigate to the directory containing your Presets.json file.
  3. Run the following command:
docker run --name binacle-net -p 8080:8080 -e SWAGGER_UI=True -v $(pwd)/Presets.json:/app/Config_Files/Presets.json:ro binacle/binacle-net:latest

[!Tip]

If you are running under Windows replace $(pwd) with %cd%, so the command looks like this:

docker run --name binacle-net -p 8080:8080 -e SWAGGER_UI=True -v %cd%/Presets.json:/app/Config_Files/Presets.json:ro binacle/binacle-net:latest

[!Note]

Since we are using a bind mount for a single file, the full path must be provided.

Option 2: Docker Compose

  1. Create a Docker Compose file named compose.yaml using the template below if you don't already have one.

  2. Place the modified Presets.json file in the same directory as your Docker Compose file.

  3. From the directory containing both the Docker Compose file and Presets.json, run the following command:

docker compose up

Docker Compose File Template

[!Note] Using the long syntax in the Docker Compose file allows you to specify a relative path rather than an absolute one.

services:
  binacle-net:
    image: binacle/binacle-net:latest
    ports:
      - "8080:8080"
    volumes:
      - type: bind
        source: ./Presets.json
        target: /app/Config_Files/Presets.json
        read_only: true
    environment:
      - SWAGGER_UI=True

By following these steps, you can easily run Binacle.Net with your customized presets, ensuring optimal performance and avoiding the need to send bin data with every request.