Launch
There is more then one way to start and run Axon Server:
Starting Axon Server locally
The Axon Server ZIP download contains executable JAR files for the server itself and the CLI. Copy axonserver.jar
to a directory of your choice. Because Axon Server uses sensible defaults, you are now ready to go. Start the Axon Server using the following command:
or when not running bash shell:
When you see a log line announcing "Started Axon Server in some-value seconds (JVM running for some-other-value)", the server is ready for action. To verify that the server is started correctly, open the page http://localhost:8024.
Starting Axon Server in a Docker container
To run Axon Server in Docker you can use the image provided on Docker Hub:
Note: This is not a supported image for production purposes. Please use with caution.
If you want to run the clients in Docker containers as well, and are not using something like Kubernetes, use the --hostname
option of the docker
command to set a useful name like axonserver
, and pass the AXONSERVER_HOSTNAME
environment variable to adjust the properties accordingly:
When you start the client containers, you can now use --link axonserver
to provide them with the correct DNS entry. The Axon Server-connector looks at the axon.axonserver.servers
property to determine where Axon Server lives, so don't forget to set it to axonserver
and pass it to your app. For more information on the environment variables you can use to tweak settings, see Customizing the Docker image of Axon Server.
Starting Axon Server in Kubernetes and Minikube
Warning: Although you can get a pretty functional cluster running locally using Minikube, you can run into trouble when you want to let it serve clients outside of the cluster. Minikube can provide access to HTTP servers running in the cluster, for other protocols you have to run a special protocol-agnostic proxy like you can with kubectl port-forward <pod-name> <port-number>
. For non-development scenarios, we do not recommend using Minikube.
Deployment requires the use of a YAML descriptor, defining a StatefulSet for Axon Server, with two Services to provide access to the HTTP and gRPC ports:
To run it, use the following commands:
You can now run the Giftcard app, which will connect throught the proxied gRPC port. To see the Axon Server Web GUI, use minikube service --url axonserver-gui
to obtain the URL for your browser. Actually, if you leave out the --url
, Minikube will open the the GUI in your default browser for you.
To clean up the deployment, use:
If you are using a 'real' Kubernetes cluster, you will naturally not want to use localhost
as hostname for Axon Server, so you need to add three lines to the container spec to specify the AXONSERVER_HOSTNAME
s setting:
Use axonserver
(as that is the name of the Kubernetes service) if you're going to deploy the client next to the server in the cluster, which is what you'ld probably want. Running the client outside the cluster, with Axon Server inside, entails extra work to enable and secure this, and is definitely beyond the scope of this example.
Last updated