Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"image": "temporalio/gitpod-edu:1.4",
"customizations": {
"codespaces": {
"openFiles": [
"README.md"
]
}
},
"forwardPorts": [8080, 7233],
"postCreateCommand": "python3 -m venv .env && bash -c 'source .env/bin/activate && python3 -m pip install -r requirements.txt' && echo 'source /workspaces/edu-versioning-python-code/.env/bin/activate' >> ~/.bashrc && temporal server start-dev --ui-port 8080",
"remoteEnv": {
"PROMPT_DIRTRIM": "2"
}
}
29 changes: 13 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ training course.

It's important to remember that the example code used in this course was designed to support learning a specific aspect of Temporal, not to serve as a ready-to-use template for implementing a production system.

For the exercises, make sure to run `temporal server start-dev --ui-port 8080 --db-filename clusterdata.db` in one terminal to start the Temporal server. For more details on this command, please refer to the `Setting up a Local Development Environment` chapter in the course. Note: If you're using the Gitpod environment to run this exercise, you can skip this step.
For the exercises, make sure to run `temporal server start-dev --ui-port 8080 --db-filename clusterdata.db` in one terminal to start the Temporal server. For more details on this command, please refer to the `Setting up a Local Development Environment` chapter in the course. Note: If you're using the Codespaces environment to run this exercise, you can skip this step.

## Hands-On Exercises

Expand All @@ -20,12 +20,21 @@ The following links provide additional information that you may find helpful as
- [Temporal Python SDK Documentation](https://python.temporal.io/)
- [Python Language Documentation](https://docs.python.org/3/)
- [Python Packaging and Virtual Environment Documentation](https://packaging.python.org/en/latest/tutorials/installing-packages/#creating-virtual-environments)
- [GitPod Documentation: Troubleshooting](https://www.gitpod.io/docs/troubleshooting)

## Exercise Environment for this Course

You can launch an exercise environment for this course using GitHub Codespaces by
following [this](codespaces.md) walkthrough.

Alternatively, you can follow
[these instructions](https://learn.temporal.io/getting_started/python/dev_environment/) to
set up your own Temporal Cluster with Docker Compose, which you can use as an
exercise environment.

### Set Up Your Python Virtual Environment

All Python libraries for this course should be installed in a virtual environment.
If you are running these exercises in the course's GitPod environment, there
If you are running these exercises in the course's Codespaces environment, there
is a virtual environment already setup for you and you can skip this section.
If you are running these exercises locally, be sure you are using Python 3.7+.

Expand Down Expand Up @@ -79,16 +88,4 @@ $ source env/bin/activate
$ env\Scripts\activate
```

However, the packages are already installed, so there is no need to run pip again.

## Exercise Environment for this Course

You can launch an exercise environment for this course in GitPod by
clicking the button below:

[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/temporalio/edu-versioning-python-code)

Alternatively, you can follow
[these instructions](https://learn.temporal.io/getting_started/python/dev_environment/) to
set up your own Temporal Cluster with Docker Compose, which you can use as an
exercise environment.
However, the packages are already installed, so there is no need to run pip again.
68 changes: 68 additions & 0 deletions codespaces.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Launching a Codespace

GitHub Codespaces is a browser environment that can be used to complete the exercises from this course without needing to install anything on your local machine. This `codespaces.md` document will explain how to launch and configure the Codespaces environment.

To launch the codespace, click on the green "Code" drop-down menu in the top-right corner of the repo display (to the left of the right-hand sidebar), navigate to the Codespaces sub-tab if it is not already focused, and click the **+** icon.

![1 — Launch Codespace](https://raw.githubusercontent.com/temporalio/temporal-learning/refs/heads/main/static/courses/common/codespaces/1-launch-codespace.png)

This will open a new tab containing a familiar VSCode-style interface. It may take up to a minute for the tab to populate, during which time "Opening Remote…" will be displayed in the bottom left corner.

![2 — Loading Codespace](https://raw.githubusercontent.com/temporalio/temporal-learning/refs/heads/main/static/courses/common/codespaces/2-loading-codespace.png)

Eventually, the Codespace will display the readme for the repo in the top two-thirds of the screen, and a Temporal Service running on the command line in the bottom third of the screen:

![3 — Loaded Codespace](https://raw.githubusercontent.com/temporalio/temporal-learning/refs/heads/main/static/courses/common/codespaces/3-loaded-codespace.png)

There are two things you’ll want to do before getting started: open the Web UI, and open some terminal windows to work in.

### Opening the Web UI

To open the Web UI, click on the "PORTS" tab near the middle of the screen (there may be a highlighted number next to it):

![4 — Ports Tab](https://raw.githubusercontent.com/temporalio/temporal-learning/refs/heads/main/static/courses/common/codespaces/4-ports-tab.png)

Then, on the row for Port 8080, Ctrl+click (Cmd+click on Mac) on the "Forwarded Address" link highlighted in blue like a regular URL:

![5 — Port 8080 URL](https://raw.githubusercontent.com/temporalio/temporal-learning/refs/heads/main/static/courses/common/codespaces/5-port-8080-url.png)

This will open the Temporal Web UI in a separate tab:

![6 — Web UI](https://raw.githubusercontent.com/temporalio/temporal-learning/refs/heads/main/static/courses/common/codespaces/6-webui.png)

You should navigate to this tab any time you need to access the Web UI.

### Opening more Work Terminals

To open some work terminals, navigate back to the Codespaces tab, and click on "TERMINAL" next to the "PORTS" tab that you clicked on earlier.

![7 — Terminal Tab](https://raw.githubusercontent.com/temporalio/temporal-learning/refs/heads/main/static/courses/common/codespaces/7-terminal-tab.png)

You should see "bash" in the right-hand sidebar. Click on "bash" to get a work terminal:

![8 — Bash Terminal](https://raw.githubusercontent.com/temporalio/temporal-learning/refs/heads/main/static/courses/common/codespaces/8-bash-terminal.png)

Then, to create more work terminals for this course – you’ll usually need 2 or 3 – use the drop-down arrow next to the "**+**" sign on top of where it says bash, and in that drop-down menu, navigate to "Split Terminal," and then "bash (Default)."

![9 — Split Terminal](https://raw.githubusercontent.com/temporalio/temporal-learning/refs/heads/main/static/courses/common/codespaces/9-split-terminal.png)

Repeat this for as many terminals as you need:

![10 — Working Terminals](https://raw.githubusercontent.com/temporalio/temporal-learning/refs/heads/main/static/courses/common/codespaces/10-working-terminals.png)

You’re all set. Don’t forget that you can Ctrl+click on the links displayed in the repo readme to open the readme for each individual exercise as you progress through the course:

![11 — Exercise Readme](https://raw.githubusercontent.com/temporalio/temporal-learning/refs/heads/main/static/courses/common/codespaces/11-exercise-readme.png)

Your Codespace will automatically be stopped 30 minutes after you close the browser tab. This is to prevent excessive resource utilization. It can be resumed from the same part of the Github UI if needed, within 30 days of the last time it was used.

![12 — Resume Codespace](https://raw.githubusercontent.com/temporalio/temporal-learning/refs/heads/main/static/courses/common/codespaces/12-resume-codespace.png)

### Delete Your Codespaces

Once you are done with this course or the exercises, manually delete your codespaces. There are costs associated with storing codespaces. You should therefore delete any codespaces you no longer need. Here are the steps you need to take to delete your codespaces:

1. Visit your codespaces page [here](https://github.com/codespaces).
2. To the right of the codespace you want to delete, click the three dots, then click `Delete`:

![Delete codespace](https://learn.temporal.io/courses/common/codespaces/13-delete-codespaces.png "Delete codespace")
2 changes: 1 addition & 1 deletion exercises/version-workflow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ course is activated as detailed in the course [README](../../README.md#setup-you
**Decode Event History** toggle, and then click **Download**. Save
the file as `history_for_original_execution.json` in your
`practice` directory.
* NOTE: If you are running this exercise in GitPod, you may
* NOTE: If you are running this exercise in Codespaces, you may
be unable to download the file, due to the embedded browser
used in that environment. In this case, run the following
command from the `practice/tests` directory `temporal workflow show --workflow-id=loan-processing-workflow-customer-a100 --fields long --output json > history_for_original_execution.json` to
Expand Down