feat: expand development environment with multiple Garage instances and add configuration template

- Updated `docker-compose.dev.yml` to include four Garage instances (garage, garage2, garage3, garage4) with separate configurations and volumes.
- Introduced `garage.toml.template` for easier configuration management.
- Enhanced README with instructions for setting up the development environment and running multiple instances.
This commit is contained in:
Adekabang 2025-07-31 14:11:22 -04:00
parent 4de96071d4
commit 2158b5a528
4 changed files with 113 additions and 11 deletions

View File

@ -186,6 +186,37 @@ $ cd garage-webui && pnpm install
$ cd backend && pnpm install && cd .. $ cd backend && pnpm install && cd ..
``` ```
### Development with Docker
For development with Docker, a `docker-compose.dev.yml` file is provided with 4 Garage instances:
```sh
# Create necessary directories for Garage data
$ mkdir -p dev.local/data-garage/meta dev.local/data-garage/data
$ mkdir -p dev.local/data-garage2/meta dev.local/data-garage2/data
$ mkdir -p dev.local/data-garage3/meta dev.local/data-garage3/data
$ mkdir -p dev.local/data-garage4/meta dev.local/data-garage4/data
# Copy the template configuration files and replace CONTAINER_NAME with the actual container name
$ cp garage.toml.template dev.local/garage.toml && sed -i 's/CONTAINER_NAME/garage/g' dev.local/garage.toml
$ cp garage.toml.template dev.local/garage2.toml && sed -i 's/CONTAINER_NAME/garage2/g' dev.local/garage2.toml
$ cp garage.toml.template dev.local/garage3.toml && sed -i 's/CONTAINER_NAME/garage3/g' dev.local/garage3.toml
$ cp garage.toml.template dev.local/garage4.toml && sed -i 's/CONTAINER_NAME/garage4/g' dev.local/garage4.toml
# Setup environment variables
$ cp .env.example .env
$ cp backend/.env.example backend/.env
# Start the Garage containers
$ docker-compose -f docker-compose.dev.yml up -d
```
You can then run the web UI with the environment variables from your .env files:
```sh
$ pnpm run dev
```
### Running ### Running
Start both the client and server concurrently: Start both the client and server concurrently:

View File

@ -1,6 +1,9 @@
# #
BASE_PATH="" BASE_PATH=""
AUTH_USER_PASS='username:$2y$10$DSTi9o0uQPEHSNlf66xMEOgm9KgVNBP3vHxA3SK0Xha2EVMb3mTXm' AUTH_USER_PASS='admin:$2y$10$2i1DScIpTap7oB6KEYLP7um9/ms6LBf.TBzuqfSWRdRMvWRe35Y0S'
API_BASE_URL="http://garage:3903" API_BASE_URL="http://localhost:3903"
S3_ENDPOINT_URL="http://garage:3900" S3_ENDPOINT_URL="http://localhost:3900"
API_ADMIN_KEY="" S3_REGION=garage
API_ADMIN_KEY="dev-admin-token"
PORT=3909
CONFIG_PATH="../dev.local/garage.toml"

View File

@ -2,14 +2,56 @@ services:
garage: garage:
image: dxflrs/garage:v2.0.0 image: dxflrs/garage:v2.0.0
container_name: garage container_name: garage
hostname: garage
volumes: volumes:
- ./dev.local/garage.toml:/etc/garage.toml - ./dev.local/garage.toml:/etc/garage.toml
- ./dev.local/meta:/var/lib/garage/meta - ./dev.local/data-garage/meta:/var/lib/garage/meta
- ./dev.local/data:/var/lib/garage/data - ./dev.local/data-garage/data:/var/lib/garage/data
restart: unless-stopped restart: unless-stopped
ports: ports:
- 3900:3900 - 3900:3900
- 3901:3901 - 3901:3901
- 3902:3902 - 3902:3902
- 3903:3903 - 3903:3903
garage2:
image: dxflrs/garage:v2.0.0
container_name: garage2
hostname: garage2
volumes:
- ./dev.local/garage2.toml:/etc/garage.toml
- ./dev.local/data-garage2/meta:/var/lib/garage/meta
- ./dev.local/data-garage2/data:/var/lib/garage/data
restart: unless-stopped
ports:
- 3900
- 3901
- 3902
- 3903
garage3:
image: dxflrs/garage:v2.0.0
container_name: garage3
hostname: garage3
volumes:
- ./dev.local/garage3.toml:/etc/garage.toml
- ./dev.local/data-garage3/meta:/var/lib/garage/meta
- ./dev.local/data-garage3/data:/var/lib/garage/data
restart: unless-stopped
ports:
- 3900
- 3901
- 3902
- 3903
garage4:
image: dxflrs/garage:v2.0.0
container_name: garage4
hostname: garage4
volumes:
- ./dev.local/garage4.toml:/etc/garage.toml
- ./dev.local/data-garage4/meta:/var/lib/garage/meta
- ./dev.local/data-garage4/data:/var/lib/garage/data
restart: unless-stopped
ports:
- 3900
- 3901
- 3902
- 3903

26
garage.toml.template Normal file
View File

@ -0,0 +1,26 @@
data_dir = "/var/lib/garage/data"
db_engine = "lmdb"
metadata_auto_snapshot_interval = "6h"
metadata_dir = "/var/lib/garage/meta"
compression_level = 2
replication_factor = 3
rpc_bind_addr = "[::]:3901"
rpc_public_addr = "CONTAINER_NAME:3901"
rpc_secret = "dev-garage-secret"
[s3_api]
api_bind_addr = "[::]:3900"
root_domain = ".s3.garage.local"
s3_region = "garage"
[s3_web]
bind_addr = "[::]:3902"
index = "index.html"
root_domain = ".web.garage.local"
[admin]
admin_token = "dev-admin-token"
api_bind_addr = "[::]:3903"
metrics_token = "dev-metrics-token"