Skip to content

Commit 413bf2b

Browse files
authored
Merge pull request #26 from temporalio/codespaces
Codespaces
2 parents b19e0d4 + 0a47443 commit 413bf2b

File tree

7 files changed

+102
-27
lines changed

7 files changed

+102
-27
lines changed

.devcontainer/devcontainer.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"image": "temporalio/gitpod-edu:1.4",
3+
"customizations": {
4+
"codespaces": {
5+
"openFiles": [
6+
"README.md"
7+
]
8+
}
9+
},
10+
"forwardPorts": [8080, 7233, 9999],
11+
"postCreateCommand": "python3 -m venv .env && bash -c 'source .env/bin/activate && python3 -m pip install -r requirements.txt' && echo 'source /workspaces/edu-102-python-code/.env/bin/activate' >> ~/.bashrc && temporal server start-dev --ui-port 8080",
12+
"remoteEnv": {
13+
"PROMPT_DIRTRIM": "2"
14+
}
15+
}

README.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ training course.
77

88
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.
99

10-
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.
10+
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.
1111

1212
## Hands-On Exercises
1313

@@ -32,12 +32,21 @@ The following links provide additional information that you may find helpful as
3232
- [Temporal Python SDK Documentation](https://python.temporal.io/)
3333
- [Python Language Documentation](https://docs.python.org/3/)
3434
- [Python Packaging and Virtual Environment Documentation](https://packaging.python.org/en/latest/tutorials/installing-packages/#creating-virtual-environments)
35-
- [GitPod Documentation: Troubleshooting](https://www.gitpod.io/docs/troubleshooting)
35+
36+
## Exercise Environment for this Course
37+
38+
You can launch an exercise environment for this course using GitHub Codespaces by
39+
following [this](codespaces.md) walkthrough.
40+
41+
Alternatively, you can follow
42+
[these instructions](https://learn.temporal.io/getting_started/python/dev_environment/) to
43+
set up your own Temporal Cluster with Docker Compose, which you can use as an
44+
exercise environment.
3645

3746
### Setup Your Python Virtual Environment
3847

3948
All Python libraries for this course should be installed in a virtual environment.
40-
If you are running these exercises in the course's GitPod environment, there
49+
If you are running these exercises in the course's Codespaces environment, there
4150
is a virtual environment already setup for you and you can skip this section.
4251
(Be certain that you are running Python 3.7+. If you system has)
4352

@@ -95,12 +104,7 @@ However, the packages are already installed, so there is no need to run pip agai
95104

96105
## Exercise Environment for this Course
97106

98-
You can launch an exercise environment for this course in GitPod by
99-
clicking the button below:
100-
101-
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/temporalio/edu-102-python-code)
107+
You can launch an exercise environment for this course using GitHub Codespaces by
108+
following [this](codespaces.md) walkthrough.
102109

103-
Alternatively, you can follow
104-
[these instructions](https://learn.temporal.io/getting_started/python/dev_environment/) to
105-
set up your own Temporal Cluster with Docker Compose, which you can use as an
106-
exercise environment.
110+
Alternatively, you can perform these exercises directly on your computer. Refer to the instructions about setting up a local development environment, which you'll find in the "About this Course" chapter.

codespaces.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Launching a Codespace
2+
3+
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.
4+
5+
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.
6+
7+
![1 — Launch Codespace](https://raw.githubusercontent.com/temporalio/temporal-learning/refs/heads/main/static/courses/common/codespaces/1-launch-codespace.png)
8+
9+
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.
10+
11+
![2 — Loading Codespace](https://raw.githubusercontent.com/temporalio/temporal-learning/refs/heads/main/static/courses/common/codespaces/2-loading-codespace.png)
12+
13+
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:
14+
15+
<<<<<<< HEAD
16+
![3 — Loaded Codespace](https://raw.githubusercontent.com/temporalio/temporal-learning/refs/heads/main/static/courses/common/codespaces/3-loaded-codespace.png)
17+
=======
18+
![3 — Loaded Codespace](https://raw.githubusercontent.com/temporalio/temporal-learning/refs/heads/main/static/courses/common/codespaces/3-loaded-codespace.png)
19+
>>>>>>> 0efc306 (adds codespaces)
20+
21+
There are two things you’ll want to do before getting started: open the Web UI, and open some terminal windows to work in.
22+
23+
### Opening the Web UI
24+
25+
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):
26+
27+
![4 — Ports Tab](https://raw.githubusercontent.com/temporalio/temporal-learning/refs/heads/main/static/courses/common/codespaces/4-ports-tab.png)
28+
29+
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:
30+
31+
![5 — Port 8080 URL](https://raw.githubusercontent.com/temporalio/temporal-learning/refs/heads/main/static/courses/common/codespaces/5-port-8080-url.png)
32+
33+
This will open the Temporal Web UI in a separate tab:
34+
35+
![6 — Web UI](https://raw.githubusercontent.com/temporalio/temporal-learning/refs/heads/main/static/courses/common/codespaces/6-webui.png)
36+
37+
You should navigate to this tab any time you need to access the Web UI.
38+
39+
### Opening more Work Terminals
40+
41+
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.
42+
43+
![7 — Terminal Tab](https://raw.githubusercontent.com/temporalio/temporal-learning/refs/heads/main/static/courses/common/codespaces/7-terminal-tab.png)
44+
45+
You should see "bash" in the right-hand sidebar. Click on "bash" to get a work terminal:
46+
47+
![8 — Bash Terminal](https://raw.githubusercontent.com/temporalio/temporal-learning/refs/heads/main/static/courses/common/codespaces/8-bash-terminal.png)
48+
49+
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)."
50+
51+
![9 — Split Terminal](https://raw.githubusercontent.com/temporalio/temporal-learning/refs/heads/main/static/courses/common/codespaces/9-split-terminal.png)
52+
53+
Repeat this for as many terminals as you need:
54+
55+
![10 — Working Terminals](https://raw.githubusercontent.com/temporalio/temporal-learning/refs/heads/main/static/courses/common/codespaces/10-working-terminals.png)
56+
57+
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:
58+
59+
![11 — Exercise Readme](https://raw.githubusercontent.com/temporalio/temporal-learning/refs/heads/main/static/courses/common/codespaces/11-exercise-readme.png)
60+
61+
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.
62+
63+
![12 — Resume Codespace](https://raw.githubusercontent.com/temporalio/temporal-learning/refs/heads/main/static/courses/common/codespaces/12-resume-codespace.png)
64+
65+
### Delete Your Codespaces
66+
67+
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:
68+
69+
1. Visit your codespaces page [here](https://github.com/codespaces).
70+
2. To the right of the codespace you want to delete, click the three dots, then click `Delete`:
71+
72+
![Delete codespace](https://learn.temporal.io/courses/common/codespaces/13-delete-codespaces.png "Delete codespace")

exercises/debug-activity/README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ If you haven't already started the Translation Microservice used by this exercis
1919
do so in a separate terminal by navigating to `utilities/microservice`
2020
and running `python microservice.py`.
2121

22-
**Note: If you're using the Gitpod environment to run this exercise you can
23-
skip this step. An instance of the Microservice is already running in your
24-
environment**
25-
2622
### Activate the Virtual Environment
2723

2824
1. Ensure that the virtual environment you setup at the beginning of the

exercises/durable-execution/README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ Make your changes to the code in the `practice` subdirectory (look for `TODO` co
1515
If you haven't already started the Translation Microservice used by this exercise,
1616
do so in a separate terminal.
1717

18-
**Note: If you're using the Gitpod environment to run this exercise you can
19-
skip this step. An instance of the Microservice is already running in your
20-
environment**
21-
2218
### Activate the Virtual Environment
2319

2420
1. Ensure that the virtual environment you setup at the beginning of the

exercises/testing-code/README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ the complete version in the `solution` subdirectory.
1818
If you haven't already started the Translation Microservice used by this exercise,
1919
do so in a separate terminal.
2020

21-
**Note: If you're using the Gitpod environment to run this exercise you can
22-
skip this step. An instance of the Microservice is already running in your
23-
environment**
24-
2521
### Activate the Virtual Environment
2622

2723
1. Ensure that the virtual environment you setup at the beginning of the

samples/using-dataclasses-as-input-and-output/README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ and output data of Workflow and Activity Definitions.
88
If you haven't already started the Translation Microservice used by this exercise,
99
do so in a separate terminal.
1010

11-
**Note: If you're using the Gitpod environment to run this exercise you can
12-
skip this step. An instance of the Microservice is already running in your
13-
environment**
14-
1511
### Activate the Virtual Environment
1612

1713
1. Ensure that the virtual environment you setup at the beginning of the

0 commit comments

Comments
 (0)