Skip to content

A sample Rust service to test out Google Cloud Run

License

Notifications You must be signed in to change notification settings

gsquire/rust_bin

Repository files navigation

rust_bin

CI

This is a stateless HTTP application used to try out Google's Cloud Run environment. It is a simple service similar to httpbin with far fewer features.

Disclosure

I am in no way affiliated with Google and just wanted to give this service a spin. Being able to use any language and Linux OS without having to worry about provisioning was appealing to me and I wanted to test it out.

There is no guarantee that the sample URL will always be available as well. If it becomes costly, then I will delete the project but code will remain in this repository.

Trying it Out

If you want to test a running instance, you can see the API by hitting the index page here. It will display a few routes that you can then use curl or your favorite HTTP library to run requests against.

Sample Request:

# If you have `jq` installed:
curl -s https://rustbin-j5pswym3zq-uw.a.run.app/user-agent | jq .

# Response:
{
  "user-agent": "curl/7.54.0"
}

Setup

If you wish to run the service locally, you can use the specified Dockerfile and build it with the following command:

docker build -t rustbin:latest .
docker run -it -e PORT=8080 -p 8080:8080 rustbin:latest

If you have a nightly Rust compiler locally you can build and test the service via these commands:

cargo +nightly build && cargo +nightly test

Guide

I followed this guide to configure the Dockerfile and deploy it to GCP.

License

MIT

About

A sample Rust service to test out Google Cloud Run

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published