Shock is actively being developed at github.com/MG-RAST/Shock.
- Go 1.22+
- MongoDB 3.6+
The simplest way to build Shock is with the provided script, which automatically sets the version from git tags:
./compile-server.shShock uses vendored dependencies. You must pass -mod=vendor to all Go commands:
CGO_ENABLED=0 go install -mod=vendor -installsuffix cgo -v \
-ldflags="-X github.com/MG-RAST/Shock/shock-server/conf.VERSION=$(git describe --tags --long)" \
./shock-server/All dependencies are checked into the vendor/ directory and the build requires -mod=vendor. This ensures reproducible builds regardless of upstream module changes. Do not remove the vendor/ directory.
docker pull mgrast/shockgit clone https://github.com/MG-RAST/Shock.git
cd Shock
docker build -t mgrast/shock .If you only need the statically compiled binary:
docker create --name shock mgrast/shock
mkdir -p bin
docker cp shock:/go/bin/shock-server ./bin/
docker rm shockShock requires MongoDB for metadata storage. The easiest way to run MongoDB is with Docker Compose:
docker-compose up -dThis starts both Shock and MongoDB 3.6 using the included docker-compose.yml.
With Docker:
docker run --rm --name shock-mongo -p 27017:27017 mongo:3.6Or install MongoDB via your system package manager and start it:
mongod --dbpath /data/dbThe Shock configuration file uses INI format. A template is included at the root of the repository. See the configuration guide for all available options.
shock-server -conf <path_to_config_file>With Docker Compose (recommended):
docker-compose up -dTests run in Docker with MongoDB:
# Run all tests
./run-tests.sh all
# Run tests for a specific package
./run-tests.sh package ./shock-server/node
# Generate coverage report
./run-tests.sh coverage
# Clean test environment
./run-tests.sh cleanFor S3 integration tests using MinIO:
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
docker-compose -f docker-compose.minio.yml up --abort-on-container-exit shock-test
docker-compose -f docker-compose.minio.yml down -vFor further information about Shock's functionality, see the documentation index.