feat(deployment): Add Google Cloud Run support #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces comprehensive support for deploying the
mcp-domain-availabilityserver to Google Cloud Run. Previously, running the server in a containerized environment or on serverless platforms required manual configuration. This enhancement provides a streamlined, zero-clone deployment process for Cloud Run, leveraging Docker for containerization and a dedicated deployment script.Changes Made
PORT).Dockerfileto create a production-ready Docker image for themcp-domain-availabilityserver.ENTRYPOINTto execute the application within the container.deploy.shscript to automate the build and deployment process to Google Cloud Run, simplifying the user experience.README.mdto include detailed instructions for building the Docker image and deploying the application to Google Cloud Run.Technical Implementation
The core of this implementation revolves around adapting the application for containerized serverless deployment and providing an automated deployment mechanism.
1. Dynamic Port Binding (
src/mcp_domain_availability/main.py):The application now retrieves the listening port from the
PORTenvironment variable, defaulting to8080if not set. This is crucial for Cloud Run, which assigns a dynamic port to containers.2. Dockerfile for Cloud Run:
The
Dockerfileis configured to build a lightweight image, install dependencies, and set the entry point for the application.3. Google Cloud Run Deployment Script (
deploy.sh):The
deploy.shscript automates the container image build, tagging, and deployment to Google Cloud Run.Breaking Changes / Important Notes
mcp-domain-availabilityserver. Existing methods of running the server (e.g., locally viauvx) remain unaffected.gcloudCLI installed and configured.deploy.shscript requires modification of thePROJECT_IDandREGIONvariables to match the user's GCP setup.Testing
To test these changes, follow these steps:
gcloudCLI, authenticating to your Google Cloud project.docker build -t mcp-domain-availability .http://localhost:8080by sending a test request.deploy.shscript and replaceyour-gcp-project-idwith your actual GCP project ID. Adjust theREGIONvariable if desired.chmod +x deploy.shgcloudCLI during the deployment process.gcloudCLI will output the service URL (e.g.,https://mcp-domain-availability-xxxxxx-uc.a.run.app).curlto confirm themcp-domain-availabilityserver is running and responsive.Impact
This enhancement significantly broadens the deployment options for
mcp-domain-availability, making it easier for users to host a highly available and scalable instance without managing underlying infrastructure. By leveraging Google Cloud Run, users benefit from:deploy.shscript provides a one-command deployment experience after initial setup, streamlining the CI/CD process.Co-authored-by: nilsreichardt nilsreichardt@users.noreply.github.com
Original implementation and GCP deploy process by @nilsreichardt (see referenced commits)