Skip to content

Commit 2ad4424

Browse files
committed
filling in set up your local environment
1 parent 74f5b21 commit 2ad4424

1 file changed

Lines changed: 43 additions & 6 deletions

File tree

docs/develop/ruby/set-up-local-ruby.mdx

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ tags:
1212
- Temporal SDKs
1313
---
1414

15-
# Quick Start – Ruby SDK
16-
17-
This guide walks you through setting up the Temporal Ruby SDK and running your first Workflow.
18-
In just a few steps, you'll install the SDK, start a local development server, and see a Workflow in action.
15+
This guide walks you through setting up the Temporal Ruby SDK and running your first Workflow.
16+
In just a few steps, you'll install the SDK and start a local development server.
17+
To validate that your local environment is correctly installed, we will execute a Workflow that will output "Hello, Temporal".
1918

2019
## 1. Installation
2120

@@ -107,6 +106,7 @@ This will:
107106
- Use an in-memory database (data is lost when you stop the server)
108107

109108
Leave this running in a separate terminal tab or window while you develop.
109+
You'll be able to monitor your Workflows through the Web UI as they execute.
110110

111111
> **Optional:** To retain data between runs, use:
112112
>
@@ -115,6 +115,8 @@ Leave this running in a separate terminal tab or window while you develop.
115115
> ```
116116
117117
## 3. Write Your First Activity and Workflow
118+
Now that you have the server running, it's time to create your first Temporal application.
119+
In Temporal, you'll create two files an Activity file labeled `say_hello_activity.rb` and a Workflow file labeled `say_hello_workflow.rb`.
118120
119121
<Tabs>
120122
<TabItem value="activity" label="Activity (say_hello_activity.rb)">
@@ -153,7 +155,17 @@ require_relative 'say_hello_activity'
153155
</TabItem>
154156
</Tabs>
155157

158+
A Temporal Workflow is your business logic, defined in code, outlining each step in your process.
159+
Activities are the individual units of work in your Workflow.
160+
Activities often involve interacting with the outside world, such as sending emails, making network requests, writing to a database, or calling an API, which are prone to failure.
161+
You can call Activities directly from your Workflow code.
162+
If an Activity fails, Temporal automatically retries it based on your configuration.
163+
164+
156165
## 4. Run a Worker
166+
With your Activity and Workflow defined, you need a Worker to execute them.
167+
Create a file labeled `worker.rb`.
168+
Workers, which are part of your application and provided by the Temporal SDK, then carry out the tasks defined in your Workflow.
157169

158170
<Tabs>
159171
<TabItem value="worker" label="Worker (worker.rb)">
@@ -179,10 +191,23 @@ worker.run(shutdown_signals: ['SIGINT'])
179191
</TabItem>
180192
</Tabs>
181193

182-
Workers, which are part of your application and provided by the Temporal SDK, then carry out the tasks defined in your Workflow.
194+
Workers are a crucial part of your Temporal application as they're what actually execute the tasks defined in your Workflows and Activities.
183195
For more information on Workers, see [Understanding Temporal](/evaluate/understanding-temporal#workers) and a [deep dive into Workers](/workers).
184196

197+
::: note
198+
Start your Worker by running:
199+
`ruby worker.rb`
200+
201+
Keep this running in another terminal window.
202+
You should see output indicating that the Worker has started and is polling for tasks.
203+
204+
:::
205+
185206
## 5. Execute a Workflow and See the Result
207+
With your Worker running and listening for tasks, you can now trigger a Workflow execution.
208+
This final step will validate that everything is working correctly with your file labeled `execute_workflow.rb`.
209+
210+
Run this script in a new terminal window with the following command: `ruby execute_workflow.rb`
186211

187212
<Tabs>
188213
<TabItem value="execute" label="Execute Workflow (execute_workflow.rb)">
@@ -212,4 +237,16 @@ puts "Result: #{result}"
212237
Result: Hello, Temporal!
213238
```
214239

215-
To follow more Ruby tutorials, visit learn.temporal.io/ruby.
240+
You've successfully executed your first Temporal Workflow.
241+
If you check the Temporal Web UI at http://localhost:8233, you'll gain visibility into your Workflow Execution with details listed about its progress and completion.
242+
243+
## Next Steps
244+
245+
Now that your local environment is set up, you can explore the full capabilities of Temporal by following the [Getting Started with Ruby tutorials](https://learn.temporal.io/getting_started/ruby/).
246+
These tutorials will walk you through building and running your first Workflows using the Ruby SDK.
247+
248+
If you would like to better understand the underlying concepts behind what you have built, visit [Understanding Temporal](/understanding-temporal), which provides a basic high level overview of how the Temporal works.
249+
For more learning by doing, you can also explore our collection of [Ruby code samples](https://github.com/temporalio/samples-ruby) on GitHub.
250+
251+
To take the next step toward building production-ready applications, check out the [Core Application section](/develop/ruby/core-application) of the Ruby Developer Guide.
252+
This will help you understand how Temporal applications are structured.

0 commit comments

Comments
 (0)