- Branch:
feature/UI
- Full React SPA at
clients/shock-ui/— Vite + React 18 + TypeScript + TailwindCSS v4 - Embedded in Go binary via
go:embedatshock-server/ui/ - Served at
/ui/with SPA fallback routing - All phases implemented: auth, node CRUD, upload/download, ACLs, indexes, admin dashboard
Key commands:
cd clients/shock-ui && npm run dev # Dev mode (Vite proxy → :7445)
./build-ui.sh && ./compile-server.sh # Build embedded binaryshock-ts updates: added authType (basic/oauth), admin methods (locker, locked/*, trace, location info), deleteIndex, corresponding React hooks
docker-compose.local.yml— Shock + MongoDB + user seed- Shock API: http://localhost:7445
- MongoDB: localhost:27017
- Docker network:
shock-net(named, other compose setups can join as external)
Auth Credentials (Basic Auth):
| User | Password | Admin | Authorization Header |
|---|---|---|---|
| admin | secret | yes | Basic YWRtaW46c2VjcmV0 |
| user1 | secret | no | Basic dXNlcjE6c2VjcmV0 |
Commands:
docker compose -f docker-compose.local.yml up --build -d # start
docker compose -f docker-compose.local.yml down # stop
docker compose -f docker-compose.local.yml down -v # stop + destroy data
docker compose -f docker-compose.local.yml logs -f shock-server # logsvendor/github.com/MG-RAST/golib/httpclient/restclient.go—Get()andDelete()were missingio.Readerparameter (addednil)
shock-server/integration/s3_location_test.go— 10 new integration tests for S3/location endpoints
shock-server/integration/helpers_test.go— AddednodeLocationstruct,locationConfigDatastruct,Locationsfield tonodeData, 4 helper functions (parseLocationConfigData,parseLocationList,parseSingleLocation,waitForLocation)
- Config:
TestLocationS3ConfigInfo,TestLocationInfoRequiresAdmin - Auto-upload:
TestAutoUploadCreatesLocation,TestAutoUploadMultipleFiles - CRUD:
TestViewNodeLocations,TestViewSpecificLocation,TestAdminDeleteLocation,TestDeleteLocationRequiresAdmin - Edge cases:
TestEmptyNodeHasNoLocations,TestLocationNotFoundOnNode
- Only
testify/assertis vendored (notrequire); usedif !assert.X() { return }pattern instead waitForLocationuses exponential backoff (500ms→4s cap, 30s total timeout)nodeLocation.RequestedDateis*stringto avoid fragile time parsing- Skipped
/location/s3/present(has bson bug: string "true" vs bool true)
docker-compose.minio.yml— Full compose stack: MinIO + MongoDB + Shock server + test runnertest/shock-server-minio.conf— Shock config with[Cache]section (TTL=5M, auto_upload=true, default_location=s3)test/config.d-minio/Locations.yaml— S3 location pointing to MinIO (minioadmin/minioadmin, bucket=shock-data)test/config.d-minio/Types.yaml— Copied from test/config.d/Types.yaml
Dockerfile— Added boto-s3-*.py to /usr/local/bin/ + created /var/cache/shock
- MinIO as S3 backend (port 9000 API, 9001 console)
- minio-init one-shot creates
shock-databucket - mongo-seed creates admin/user1 accounts in shock_integration_test DB
- Shock server reads config from /etc/shock.d/ (conf + Locations.yaml + Types.yaml mounted individually)
- Test runner uses SHOCK_SERVER_URL=http://shock-server:7445
- CONFIG_PATH = dir of config file → Locations.yaml/Types.yaml must be in same dir as .conf
- Volume mounts: individual file mounts into /etc/shock.d/ rather than directory mount
- Uses modern MINIO_ROOT_USER/MINIO_ROOT_PASSWORD (not deprecated MINIO_ACCESS_KEY)
- Healthchecks on all stateful services; depends_on with conditions for proper startup ordering
- Shared config: test runner reads server config via
SHOCK_CONFIGenv var usinggoconfiglibrary (single source of truth for MongoDB host/database) - Backward compatible: falls back to
MONGO_HOSTenv var + hardcoded defaults whenSHOCK_CONFIGis not set - No additional services needed: auth is built-in basic, metadata is MongoDB-only, S3 via boto3 scripts
docker-compose -f docker-compose.minio.yml build --no-cache
docker-compose -f docker-compose.minio.yml up -d shock-mongo shock-minio shock-minio-init shock-server
curl http://localhost:7445/
docker-compose -f docker-compose.minio.yml up --abort-on-container-exit shock-test
docker-compose -f docker-compose.minio.yml down -v| Issue | Priority | Description |
|---|---|---|
| #403 | Medium | anonymize.Reader: test-specific logic + goroutine race conditions |
| #404 | Low | QueueUpload race: called before node persisted to DB |
| #405 | Low | 3 remaining go vet warnings (oauth struct tag, 2 unreachable code) |
| #406 | Medium | 9 packages missing test files |
- Always build with
-mod=vendor— golib and tinyftp vendored APIs differ from upstream - Go version: 1.22 (per go.mod)
- Router: Chi (go-chi/chi/v5)
- Test infra: Docker Compose with MongoDB 3.6, test server on port 7445, basic auth
- 2 packages require Docker:
integration(needs Shock server),node(needs MongoDB)