This guide will help you get up and running with the Synapse Go project on your local machine. We'll cover the prerequisites, installation, build process, and basic usage.
Before you begin, ensure you have the following installed:
You can check your Go version with:
go version
If you need to install or update Go, visit the official Go download page.
git clone https://github.com/apache/synapse-go.git
cd synapse-go
The project includes a comprehensive Makefile with several useful targets:
bin/ directory):make build
make build-debug
make test
Create a distributable package containing the compiled binary and the required directory structure:
make package
This command:
synapse.zipYou can run all steps (dependency resolution, build, and package) with a single command:
make
or
make all
To clean up all build artifacts:
make clean
After building and packaging, follow these steps to run the application:
unzip synapse.zip
This creates a synapse directory with the following structure:
synapse/
├── bin/
│ └── synapse # Compiled binary
├── conf/ # Configuration directory
└── artifacts/
├── APIs/ # API definitions
├── Endpoints/ # Endpoint definitions
├── Sequences/ # Sequence definitions
└── Inbounds/ # Inbound definitions
Place your Synapse configuration files in their respective directories:
synapse/conf/synapse/artifacts/APIs/synapse/artifacts/Endpoints/synapse/artifacts/Sequences/synapse/artifacts/Inbounds/Ensure you have a LoggerConfig.toml file in the synapse/conf/ directory to configure logging.
cd synapse/bin ./synapse
The logger configuration file (LoggerConfig.toml) should be placed in the synapse/conf/ directory. Here's a basic example:
# Sample LoggerConfig.toml [logger] level.default = "warn" [logger.level.packages] mediation = "error" deployers = "error" router = "info" [logger.handler] format = "json" outputPath = "stdout"
The main configuration file (deployment.toml) should be placed in the synapse/conf/ directory. This file defines the core behavior of your Synapse HTTP server configurations.
Here's a basic example:
[server] hostname = "localhost" offset = 10
If you encounter any issues:
synapse/conf/ directorychmod +x synapse/bin/synapse
If you need assistance: