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.
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.
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.
Based on our production deployments, here are the essential environment variables you'll need to configure for your Moose application in cloud environments:
# Logger configurationMOOSE_LOGGER__LEVEL=InfoMOOSE_LOGGER__STDOUT=trueMOOSE_LOGGER__FORMAT=Json # Telemetry configurationMOOSE_TELEMETRY__ENABLED=falseMOOSE_TELEMETRY__EXPORT_METRICS=true # For debuggingRUST_BACKTRACE=1# HTTP server settingsMOOSE_HTTP_SERVER_CONFIG__HOST=0.0.0.0MOOSE_HTTP_SERVER_CONFIG__PORT=4000For detailed configuration of the external services, refer to the Preparing ClickHouse and Redpanda page.
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=9440Moose requires Redis for caching and message passing:
MOOSE_REDIS_CONFIG__URL=<your_redis_url>MOOSE_REDIS_CONFIG__KEY_PREFIX=<your_key_prefix>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=3If 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.cloudWhen deploying to cloud environments, it's important to handle sensitive information like passwords and API keys securely. Each cloud provider offers mechanisms for this:
Never hardcode sensitive values directly in your deployment configuration files.
Please share your feedback about Moose monitoring capabilities through our GitHub repository.