Introduction
The lifecycle of a web application has several stages. At first, you decide what you want to do. Then you write the code of your program. And then comes the time to deploy your application to make it public. Although your laptop is great for development purposes, it's not enough to grant public access to your app. You need a platform, where you can launch it. In this topic, we'll observe how you can do it with Heroku.
Heroku platform
Heroku is a cloud platform supporting different programming languages to launch web applications. It supports such programming languages as:
- Python
- Java
- Scala
- JavaScript (Node.js)
- Go
Heroku provides both free and business accounts. It means that you can use some Heroku services for free, but with limited capabilities, or switch to a paid account to explore more features and get guarantees from the platform.
How it works
As with any other online service, you need to register to start using it. After successful registration, you can browse detailed tutorials and find one with the language you're using for the development.
We assume that you stick to a free account and want to launch your fresh app on the Heroku platform. At this stage, you need to install the official Heroku CLI and have a git repository with the code of your program on your local computer. After you've finished these preparations, you can run several commands in your terminal, and Heroku starts a Dyno with your app:
$ heroku create
Creating app... done, ⬢ fierce-atoll-36151
https://fierce-atoll-36151.herokuapp.com/ # Public address of your app
$ git push heroku your-main-branch
building and deploying logs...
That's all. Your application is ready and you can access it at the address given by the heroku create command.
Integration with other services
Of course, your perfect app not only needs the code in the git repository but also may use other resources as a database, file storage, or key-value store. All of them are also available on Heroku with limited capabilities for free:
You can read about each of them by yourself and explore many others on the page of available add-ons. You can install add-ons through the web interface or by running a command from a terminal:
$ heroku addons:create heroku-postgresql:hobby-dev
Now your application can use the launched service. To read more about suitable methods to configure your application, refer to the official documentation for your language.
Conclusion
In this topic, we've explored some features of the Heroku platform, such as:
- Official guides and documentation
- Commands to launch a web application on Heroku
- Integration with other services on a platform
Now you are ready to start using Heroku by yourself, but we recommend you to look through the official tutorials to ease your experience with the platform.