The Hellodeno Application
Our example will be a basic “hello world” example using Deno and Dinatra. You can get the code for the example from the hellodeno GitHub repository. Justgit clone https://github.com/fly-apps/hellodeno to get a local copy. Here’s all the code:
main.ts. We also want a deps.ts file for dependencies, here it is:
Running The Application
Rundeno run --allow-net main.ts to start the application:
Install Flyctl and Login
We are ready to start working with Fly.io, and that means we needflyctl, our CLI app for managing apps on Fly.io. If you’ve already installed it, carry on. If not, hop over to our installation guide. Once that’s installed you’ll want to log in to Fly.io.
Configuring the App for Fly.io
Each Fly App needs afly.toml file to tell the system how we’d like to deploy it.
That file can be automatically generated with the command fly launch command. This command will also generate a Dockerfile for deployment.
Inside fly.toml
The fly.toml file now contains a default configuration for deploying your app. While creating that file, fly has also created a Fly-side application slot with the same name, “hellodeno”. If we look at the fly.toml configuration file we can see the name in there:
run command for the main web process. We can change that to refer to ./main.ts.
The flyctl command will always refer to this file in the current directory if it exists, specifically for the app name/value at the start. That name will be used to identify the application to the Fly.io platform.
The rest of the file contains settings to be applied to the application when it deploys.
Deploying to Fly.io
We are now ready to deploy our containerized app to Fly.io. At the command line, just run:empty-sea-2541 from our fly.toml file.
Then, fly will start deploying our application to Fly.io using the Dockerfile. fly will return you to the command line when it’s done.
Viewing the Deployed App
If you want to find out more about the deployment. The commandfly status will give you all the essential details.
Connecting to the App
The quickest way to view your application is to runfly apps open which will open your browser on the URL for your application. Run fly apps open /name to get an extra greeting from the app.
If you want to manually enter a URL to check, remember to replace empty-sea-2541.fly.dev with the hostname you got from fly status and connect to http://hellodeno.fly.dev/ where you should find a greeting - it will normally be upgraded to a secure connection. Use https://hellodeno.fly.dev to start with a secure connection. Add /name and you’ll get an extra greeting from the hellodeno application.
Bonus Points
If you want to know what IP addresses the app is using, tryfly ips list: