This doc is for contributors to Temporal Server (hopefully that's you!)
Note: All contributors also need to fill out the Temporal Contributor License Agreement before we can merge in any of your changes.
- Go Lang (minimum version required listed in
go.modfile):- Install on macOS with
brew install go. - Install on Ubuntu with
sudo apt install golang.
- Install on macOS with
- Protocol buffers compiler (only if you are going to change
protofiles):- Install on macOS with
brew install protobuf. - Download all other versions from protoc release page.
- Install on macOS with
- Temporal CLI
- Homebrew
brew install temporal - Or download it from here https://github.com/temporalio/cli
- Homebrew
Note: it is possible to run Temporal server without a
docker. If for some reason (for example, performance on macOS) you want to run dependencies on the host OS, please follow the doc.
- Runtime dependencies are optional support services that can be helpful during development and testing, providing: 1) UI, 2)
databases, and 3) metrics services via
docker compose. By default, the server utilizes SQLite as an in-memory database, so the runtime dependencies are optional. To start dependencies, open new terminal window and run:
make start-dependenciesTo stop the dependencies:
make stop-dependenciesFor developing on Windows, install Windows Subsystem for Linux 2 (WSL2) and Ubuntu. After that, follow the guidance for installing prerequisites, building, and testing on Ubuntu.
Temporal uses go modules, there is no dependency on $GOPATH variable. Clone the repo into the preferred location:
git clone https://github.com/temporalio/temporal.gitFor the very first time build temporal-server and helper tools with simple make command:
makeIt will install all other build dependencies and build the binaries.
Further you can build binaries without running tests with:
make binsPlease check the top of our Makefile for other useful build targets.
We defined three categories of tests.
- Unit test: Those tests should not have dependencies other than the test target and go mock. We should have unit test coverage as much as possible.
- Integration test: Those tests cover the integration between the server and the dependencies (Cassandra, SQL, ES etc.).
- Functional test: Those tests cover the E2E functionality of Temporal server. They are all under ./tests directory.
Integration and functional tests require runtime dependencies, when running with a persistence option that is not SQLite. If running unit tests, no need to start the dependencies.
Run unit tests:
make unit-testRun all integration tests:
make integration-testRun all functional tests:
make functional-testOr run all the tests at once:
make testYou can also run a single test:
go test -v <path> -run <TestSuite> -testify.m <TestSpecificTaskName>for example:
go test -v github.com/temporalio/temporal/common/persistence -run TestCassandraPersistenceSuite -testify.m TestPersistenceStartWorkflowWhen you are done, don't forget to stop docker compose (with Ctrl+C) and clean up all dependencies:
make stop-dependenciesFirst, start the optional runtime dependencies if needed for the desired persistence option.
Then run the server:
make startThis will start the server using SQLite as an in-memory database. You can choose other databases as well.
If you want to run with Cassandra and Elasticsearch, then run these commands:
make install-schema-cass-es
make start-cass-esTo run with SQLite with a persisted file:
make start-sqlite-fileTo run with Postgres:
make install-schema-postgresql
make start-postgresqlTo run with MySQL:
make install-schema-mysql
make start-mysqlNow you can create a namespace with the Temporal CLI (While you can select any name for a namespace, we reccomend using default while learning, because a number of samples assume there is a namespace named default):
temporal operator namespace create -n defaultand run samples from the samples repos (Go | Java | TypeScript | .NET | Python | Ruby). If you are new to Temporal, helloworld (Go | Java | TypeScript | .NET | Python | Ruby) is a very good sample to start with. Also, if you have started the runtime dependencies, you can access the web UI at localhost:8080 which is a good way to visualize work done by the server and deepen your knowledge of Temporal.
When you are done, press Ctrl+C to stop the server.
If you started runtime dependencies, don't forget to stop dependencies
(with Ctrl+C) and clean up resources:
make stop-dependenciesSee the developer documentation on testing to learn more about writing tests.
For general instructions, see GoLand Debugging.
First, start the optional runtime dependencies if needed for the desired persistence option.
To run the server, ensure the Run Type is package. In "Package path", enter go.temporal.io/server/cmd/server.
In the "Program arguments" field, add the following:
--env <database dev environment> --allow-no-auth start
For example, to run with Postgres:
--env development-postgres12 --allow-no-auth start
See Makefile for other environments.
gRPC / protobuf changes merged to the api repo automatically trigger a commit in api-go.
To bring such changes into your feature branch, use make update-go-api.
If you need to make changes to the gRPC / protobuf definitions while also working on code in this repo, do the following:
- Checkout api, api-go, and sdk-go
- Make your changes to
api, commit to a branch. - In your copy of
api-go:- Initialize submodules:
git submodule update --init --recursive - Point api submodule at your branch. If you make more commits to the api repo, run the last command again.
git submodule set-url proto/api ../api git submodule set-branch --branch mystuff proto/api git submodule update --remote proto/api
- Compile protos:
make proto
- Initialize submodules:
- (Optional, if SDK changes are required:) In your copy of
sdk-go:- Point
go.modat localapi-go:replace ( go.temporal.io/api => ../api-go ) - Compile & fix errors:
make bins
- Point
- In this repo:
- Point
go.modat localapi-goandsdk-go:replace ( go.temporal.io/api => ../api-go go.temporal.io/sdk => ../sdk-go ) - Build & fix errors:
make proto && make bins
- Point
This project is Open Source Software, and requires a header at the beginning of all source files. To verify that all files contain the header execute:
make copyrightOvercommit adds some requirements to your commit messages. At Temporal, we follow the Chris Beams guide to writing git commit messages. Read it, follow it, learn it, love it.
All commit messages are from the titles of your pull requests. So make sure follow the rules when titling them. Please don't use very generic titles like "bug fixes".
All PR titles should start with Upper case and have no dot at the end.
- In this repository, update
goingo.mod. In docker-builds, update the base images: base-ci-builder and base-builderNote: The docker-builds repository is now deprecated and will be archived.
MIT License, please see LICENSE for details.