{"id":28024721,"url":"https://github.com/okteto/deno-getting-started","last_synced_at":"2025-05-11T02:28:57.712Z","repository":{"id":52835880,"uuid":"358776039","full_name":"okteto/deno-getting-started","owner":"okteto","description":"Getting Started with Okteto and Deno","archived":false,"fork":false,"pushed_at":"2023-11-28T20:58:27.000Z","size":19,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-03T02:34:01.802Z","etag":null,"topics":["deno","developer-tools","development-environment","docker","kubernetes","microservices","okteto"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/okteto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-17T03:32:16.000Z","updated_at":"2023-11-28T20:58:31.000Z","dependencies_parsed_at":"2022-08-17T15:25:08.959Z","dependency_job_id":null,"html_url":"https://github.com/okteto/deno-getting-started","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okteto%2Fdeno-getting-started","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okteto%2Fdeno-getting-started/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okteto%2Fdeno-getting-started/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okteto%2Fdeno-getting-started/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/okteto","download_url":"https://codeload.github.com/okteto/deno-getting-started/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253506878,"owners_count":21919120,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deno","developer-tools","development-environment","docker","kubernetes","microservices","okteto"],"created_at":"2025-05-11T02:28:54.331Z","updated_at":"2025-05-11T02:28:57.697Z","avatar_url":"https://github.com/okteto.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Getting Started with Okteto and Deno\n\nThis example shows how to use [Okteto](https://github.com/okteto/okteto) to develop a cloud-native app with [Deno](https://deno.land) and Kubernetes manifests.\n \n## Step 1: Deploy a Simple Deno Application to Kubernetes\n\nWe are using a straightforward Deno app in this example. Before you start running your application locally, let's confirm that you can deploy it to Kubernetes. The repository comes with a manifest you can use to deploy the app to Kubernetes. Any Kubernetes cluster works; it doesn't matter if you're using a local cluster or a remote one running a cloud provider. However, if you don't have a Kubernetes cluster, you can give [Okteto Cloud](https://okteto.com/) a try\n\nDeploy your application to Kubernetes running the following command\n\n```console\n$ kubectl apply -f k8s.yml\n```\n\nYou can confirm that the application is running by getting the pod's status, which for now is enough.\n\n## Step 2: Install the Okteto CLI Locally\n\nTo get started, you need to install the Okteto CLI on your local workstation, where you type your Deno code.\n\nThe [Okteto CLI](https://github.com/okteto/okteto) is an open-source project that accelerates the development of cloud-native apps. You write your code locally, and the  Okteto CLI detects the changes and instantly updates your Kubernetes applications.\n\nIf you're using Mac or Linux, run the following command to install the Okteto CLI:\n\n```console\n$ curl https://get.okteto.com -sSfL | sh\n```\n\nIf you're using Windows, you need to [download the executable](https://downloads.okteto.com/cli/okteto.exe) and [include its location in your $PATH variable](https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/). Or, you can also use [the Linux subsystem](https://docs.microsoft.com/en-us/windows/wsl/install-win10) and run the command from above.\n\nTo confirm that the Okteto CLI works on your machine, run the following command:\n\n```console\nokteto version\n```\n\n## Step 4: The Okteto Manifest\n\nOkteto looks for a particular file called `okteto.yml` to define the development environment for an application.\n\nThis sample already contains an `okteto.yml` that looks like this:\n```yaml\nname: hello-world\nautocreate: true\nimage: okteto/deno:1.9\ncommand: bash\nvolumes:\n  - /deno-dir/\nsync:\n  - .:/usr/src/app\nforward:\n  - 8080:8080\n  - 9229:9229\n```\n\nWithout explaining every line of the above manifest, let's highlight and explain a few of them:\n\n- `name`: the name of the Kubernetes deployment you want to put on \"development mode.\"\n- `image`: the image used by the development container, with all the tools you need to build a deno app.\n- `command`: the start command of the development container.\n- `forward`: a list of ports to forward from your local machine to your development container.\n\nYou can get more details about the Okteto manifest at our [official documentation site](https://okteto.com/docs/reference/manifest/index.html).\n\n## Step 5: Activate Your Development Container\n\nRun the following command to enter Okteto's development mode:\n\n```console\n$ okteto up\n```\n\nYou should see something like this:\n\n```\n✓  Development container activated\n✓  Files synchronized\n   Namespace: default\n   Name:      hello-world\n   Forward:   8080 -\u003e 8080\n              9229 -\u003e 9229\nWelcome to your development container. Happy coding!\ndefault:hello-world app\u003e\n```\n\nThis becomes your new terminal to run your Deno application every time you change its code. All the commands you run in this terminal are running in Kubernetes. Okteto opens a terminal in a container that has all the tooling you need for developing in Deno. To give it a try, run the following command:\n\n```console\n$ deno run --allow-net app.ts\n```\n\nYou should see an output like the following where you can see how the app is compiling and launching the webserver:\n\n```\nHTTP webserver running.  Access it at:  http://localhost:8080/\n```\n\nTo confirm that the app works, launch a new terminal, and run the following command:\n\n```console\n$ curl localhost:8080\n```\n\n```\nhello deno-world!\n```\n\nDid you notice that your application is available in port 8080? This is because the Okteto CLI automatically forwarding port 8080 to your remote development container. \n\n## Step 6: See Application Changes in Kubernetes\n\nDon't close the Okteto terminal, and let's change something in the Deno sample app.\n\nFor instance, head over to the server.rs file, and in line #10 change the response text, like this:\n\n```deno\nfor await (const request of server) {\n   let bodyContent = \"hello okteto-world!\";\n   request.respond({ status: 200, body: bodyContent });\n }\n```\n\nGo back to the Okteto terminal, cancel the command (Ctrl + C) and rerun the deno command (as you would typically do if you were testing your application locally):\n\n```console\n$ deno run --allow-net app.ts\n```\n\nGo back to the other terminal where you're testing your application, and rerun the curl command:\n\n```console\n$ curl localhost:8080\n```\n\n```\nhello okteto-world!\n```\n\nSee? You didn't need any additional steps to see the changes reflected in Kubernetes!\n\n## Step 7: Remote Debugging\n\nOkteto enables you to debug your applications directly from your favorite IDE. Let's look at how that works in VS Code, one of the most popular IDEs for Deno development. The Deno debugger is not yet available, but luckily, the Node one works just fine. If you haven't done it yet, install the Node extension available from Visual Studio marketplace.\n\nGo back to the Okteto terminal, cancel the command (Ctrl + C) and run the following deno command:\n\n```console\n$ deno run --inspect --allow-net app.ts\n```\n\n```\nDebugger listening on ws://127.0.0.1:9229/ws/b533aca6-8066-4055-9458-803d8d6fd78f\nHTTP webserver running.  Access it at:  http://localhost:8080/\n```\n\nOpen the **Debug extension** and run the **Remote Debugging** debug configuration (or press the F5 shortcut):\n\n```json\n{\n  \"version\": \"0.2.0\",\n  \"configurations\": [\n      {\n          \"name\": \"Remote Debugger\",\n          \"type\": \"node\",\n          \"request\": \"attach\",\n          \"address\": \"localhost\",\n          \"port\": 9229,\n          \"localRoot\": \"${workspaceFolder}\",\n          \"remoteRoot\": \"/usr/src/app\",\n          \"skipFiles\": [\n              \"\u003cnode_internals\u003e/**\"\n          ]\n      },\n  ]\n}\n```\n\nAdd a breakpoint on `app.ts`, line 10. Go back to the local terminal, and call the application again. This time, the execution will halt at your breakpoint. You can then inspect the request, the available variables, etc.\n\nYour deno code runs in Kubernetes, but you can debug it from your local machine without any extra services or tools. Pretty cool, no? 😉\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fokteto%2Fdeno-getting-started","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fokteto%2Fdeno-getting-started","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fokteto%2Fdeno-getting-started/lists"}