From 7a58012af532b1caf6dc2861fcac5912b2e6872f Mon Sep 17 00:00:00 2001 From: Alex Garnett Date: Wed, 29 Jan 2025 13:21:09 -0800 Subject: [PATCH] port to codespaces --- .devcontainer/devcontainer.json | 15 ++++++ README.md | 9 ++-- codespaces.md | 59 ++++++++++++++++++++++++ exercises/debug-activity/README.md | 13 ------ exercises/durable-execution/README.md | 4 -- exercises/testing-code/README.md | 4 -- samples/using-classes-for-data/README.md | 4 -- 7 files changed, 77 insertions(+), 31 deletions(-) create mode 100644 .devcontainer/devcontainer.json create mode 100644 codespaces.md diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..8a42873 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,15 @@ +{ + "image": "temporalio/gitpod-edu:1.4", + "customizations": { + "codespaces": { + "openFiles": [ + "README.md" + ] + } + }, + "forwardPorts": [8080, 7233, 9999], + "postStartCommand": "temporal server start-dev --ui-port 8080", + "remoteEnv": { + "PROMPT_DIRTRIM": "2" + } +} diff --git a/README.md b/README.md index efe7c15..73ae01d 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,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 @@ -31,14 +31,11 @@ The following links provide additional information that you may find helpful as - [General Temporal Documentation](https://docs.temporal.io/) - [Temporal Java SDK Documentation](https://www.javadoc.io/doc/io.temporal/temporal-sdk/latest/index.html) - [Java Language Documentation](https://docs.oracle.com/en/java/) -- [GitPod Documentation: Troubleshooting](https://www.gitpod.io/docs/troubleshooting) ## 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-102-java-code) +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/java/dev_environment/) to diff --git a/codespaces.md b/codespaces.md new file mode 100644 index 0000000..cfb74e0 --- /dev/null +++ b/codespaces.md @@ -0,0 +1,59 @@ +# 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) \ No newline at end of file diff --git a/exercises/debug-activity/README.md b/exercises/debug-activity/README.md index 7033325..079defa 100644 --- a/exercises/debug-activity/README.md +++ b/exercises/debug-activity/README.md @@ -13,19 +13,6 @@ Make your changes to the code in the `practice` subdirectory (look for the code). If you need a hint or want to verify your changes, look at the complete version in the `solution` subdirectory. -### GitPod Environment Shortcuts - -If you are executing the exercises in the provided GitPod environment, you -can take advantage of certain aliases to aid in navigation and execution of -the code. - -| Command | Action | -| :------ | :------------------------------------------------------------------------------------------------------------------------------ | -| `ex3` | Change to Exercise 3 Practice Directory | -| `ex3s` | Change to Exercise 3 Solution Directory | -| `ex3w` | Execute the Exercise 3 Worker. Must be within the appropriate directory for this to succeed. (either `practice` or `solution`) | -| `ex3st` | Execute the Exercise 3 Starter. Must be within the appropriate directory for this to succeed. (either `practice` or `solution`) | - ## Part A: Run the Workflow In this part of the exercise, you will start two Workers and run the diff --git a/exercises/durable-execution/README.md b/exercises/durable-execution/README.md index 283b93d..8efaed8 100644 --- a/exercises/durable-execution/README.md +++ b/exercises/durable-execution/README.md @@ -15,10 +15,6 @@ Make your changes to the code in the `practice` subdirectory (look for `TODO` co If you haven't already started the Microservice in previous exercises, do so in a separate terminal. -**Note: If you're using the Gitpod environment to run this exercise you can -skip this step. An instance of the Microservice is already running in your -environment** - 1. Navigate to the `utilities` directory at the root level of the course 2. Change directoryies into the `microservice directory` 1. `cd utilities/microservice` diff --git a/exercises/testing-code/README.md b/exercises/testing-code/README.md index a49b409..a16572e 100644 --- a/exercises/testing-code/README.md +++ b/exercises/testing-code/README.md @@ -18,10 +18,6 @@ the complete version in the `solution` subdirectory. If you haven't already started the Translation Microservice used by this exercise, do so in a separate terminal. -**Note: If you're using the Gitpod environment to run this exercise you can -skip this step. An instance of the Microservice is already running in your -environment** - 1. Navigate to the `utilities` directory at the root level of the course 2. Change into the `microservice` directory 1. `cd utilities/microservice` diff --git a/samples/using-classes-for-data/README.md b/samples/using-classes-for-data/README.md index 75de096..c6d81c8 100644 --- a/samples/using-classes-for-data/README.md +++ b/samples/using-classes-for-data/README.md @@ -8,10 +8,6 @@ data of Workflow and Activity Definitions. If you haven't already started the Translation Microservice used by this exercise, do so in a separate terminal. -**Note: If you're using the Gitpod environment to run this exercise you can -skip this step. An instance of the Microservice is already running in your -environment** - 1. Navigate to the `utilities` directory at the root level of the course 2. Change directoryies into the `microservice directory` 1. `cd utilities/microservice`