Ruby: 4. Create the service
This documentation is part of the Automate with the CLI guide. You can view the complete guide here: Start Ruby, retrieve its credentials, and modify its configuration programmatically using the Stackhero CLI.
👋 Welcome to the Stackhero documentation!
Stackhero provides a ready-to-use Ruby cloud solution that delivers numerous advantages, including:
- Deploy your application in just a few seconds with a simple
git push.- Use your own domain name and take advantage of automatic configuration of HTTPS certificates for enhanced security.
- Benefit from automatic backups, one-click updates, and clear, transparent, and predictable pricing.
- Enjoy optimal performance and enhanced security thanks to a private, dedicated VM.
Save time and make your life easier: it only takes 5 minutes to try Stackhero's Ruby cloud hosting solution!
Below is a sample script that creates a stack, adds your Ruby service to it, waits for it to start, retrieves its configuration (including generated credentials), and then applies a new configuration.
#!/bin/bash
set -e
export STACKHERO_TOKEN="usr-xxxxxx:your-token"
serviceStore="ruby" # The Ruby service store name (see step 2)
instance="..." # An instance size from step 3
region="europe" # A region name from step 3
# Create a stack for your service (uses your default organization; add --organization if needed)
stackId=$(stackhero --format=script stack-create \
--name="My Ruby stack")
echo "Stack created: ${stackId}"
# Add Ruby to the stack (names are resolved automatically)
serviceId=$(stackhero --format=script service-add \
--stack="My Ruby stack" \
--service-store="${serviceStore}" \
--instance="${instance}" \
--region="${region}")
echo "Service added: ruby"
# Wait for the service to be fully operational (this may take a few minutes)
stackhero service-wait-for --service="ruby"
# Retrieve the service configuration, including generated credentials
stackhero service-configuration-get --service="ruby" --format=json