Configuring Moose for cloud environments
In the Packaging Moose for deployment page, we looked at how to package your moose
application into Docker containers (using the moose build --docker command), and you've pushed them to your container repository.
We can connect and configure your container image with remote ClickHouse and Redis-hosted services. You can also optionally use Redpanda for event streaming and Temporal for workflow orchestration.
The methods used to accomplish this are generally similar, but the specific details depend on your target cloud infrastructure. So, we'll look at the overarching concepts and provide some common examples.
Specifying your repository container
Earlier, we created two local containers and pushed them to a docker repository.
>docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEmoose-df-deployment-aarch64-unknown-linux-gnu 0.3.175 c50674c7a68a About a minute ago 155MBmoose-df-deployment-x86_64-unknown-linux-gnu 0.3.175 e5b449d3dea3 About a minute ago 163MBWe pushed the containers to the 514labs Docker Hub account. So, we have these two containers available for use:
514labs/moose-df-deployment-aarch64-unknown-linux-gnu:0.3.175514labs/moose-df-deployment-x86_64-unknown-linux-gnu:0.3.175In later examples, we'll use an AMD64 (x86_64) based machine, so we'll stick to using the following container image: 514labs/moose-df-deployment-x86_64-unknown-linux-gnu:0.3.175
We'll also examine how the container image name can be used in various cloud providers and scenarios.
General overview
The general approach is to use a cloud provider that supports specifying a container image to launch your application. Examples include the Google Kubernetes Engine (GKE), Amazon's Elastic Kubernetes Service (EKS), and Elastic Container Service (ECS). Each provider also offers a way of configuring container environment variables that your container application will have access to.
Essential Environment Variables
Based on our production deployments, here are the essential environment variables you'll need to configure for your Moose application in cloud environments:
Logging and Telemetry
# Logger configurationMOOSE_LOGGER__LEVEL=InfoMOOSE_LOGGER__STDOUT=trueMOOSE_LOGGER__FORMAT=Json # Telemetry configurationMOOSE_TELEMETRY__ENABLED=falseMOOSE_TELEMETRY__EXPORT_METRICS=true # For debuggingRUST_BACKTRACE=1HTTP Server Configuration
# HTTP server settingsMOOSE_HTTP_SERVER_CONFIG__HOST=0.0.0.0MOOSE_HTTP_SERVER_CONFIG__PORT=4000External Service Connections
For detailed configuration of the external services, refer to the Preparing ClickHouse and Redpanda page.
ClickHouse
MOOSE_CLICKHOUSE_CONFIG__DB_NAME=<your_database_name>MOOSE_CLICKHOUSE_CONFIG__USER=<your_clickhouse_user>MOOSE_CLICKHOUSE_CONFIG__PASSWORD=<your_clickhouse_password>MOOSE_CLICKHOUSE_CONFIG__HOST=<your_clickhouse_host>MOOSE_CLICKHOUSE_CONFIG__HOST_PORT=8443MOOSE_CLICKHOUSE_CONFIG__USE_SSL=1MOOSE_CLICKHOUSE_CONFIG__NATIVE_PORT=9440Redis
Moose requires Redis for caching and message passing:
MOOSE_REDIS_CONFIG__URL=<your_redis_url>MOOSE_REDIS_CONFIG__KEY_PREFIX=<your_key_prefix>Redpanda (Optional)
If you choose to use Redpanda for event streaming:
MOOSE_REDPANDA_CONFIG__BROKER=<your_redpanda_broker>MOOSE_REDPANDA_CONFIG__NAMESPACE=<your_namespace>MOOSE_REDPANDA_CONFIG__MESSAGE_TIMEOUT_MS=10043MOOSE_REDPANDA_CONFIG__SASL_USERNAME=<your_redpanda_username>MOOSE_REDPANDA_CONFIG__SASL_PASSWORD=<your_redpanda_password>MOOSE_REDPANDA_CONFIG__SASL_MECHANISM=SCRAM-SHA-256MOOSE_REDPANDA_CONFIG__SECURITY_PROTOCOL=SASL_SSLMOOSE_REDPANDA_CONFIG__REPLICATION_FACTOR=3Temporal (Optional)
If you choose to use Temporal for workflow orchestration:
MOOSE_TEMPORAL_CONFIG__CA_CERT=/etc/ssl/certs/ca-certificates.crtMOOSE_TEMPORAL_CONFIG__API_KEY=<your_temporal_api_key>MOOSE_TEMPORAL_CONFIG__TEMPORAL_HOST=<your_temporal_namespace>.tmprl.cloudSecuring Sensitive Information
When deploying to cloud environments, it's important to handle sensitive information like passwords and API keys securely. Each cloud provider offers mechanisms for this:
- Kubernetes: Use Secrets to store sensitive data. See our Kubernetes deployment guide for examples.
- Amazon ECS: Use AWS Secrets Manager or Parameter Store to securely inject environment variables.
- Other platforms: Use the platform's recommended secrets management approach.
Never hardcode sensitive values directly in your deployment configuration files.
Please share your feedback about Moose monitoring capabilities through our GitHub repository.