EX0EX0 Posted July 25, 2021 Share Posted July 25, 2021 I am making a topic for the purpose of sanctifying those who have just started working on their applications and want to put them on some service that supports his application 24/7. The topic is in the Python section, because I will show it on the example of a Python application. Introduction The service itself - https://www.heroku.com/home List of supported languages: Node.js, Ruby, Java, PHP, Python, Go, Scala, Clojure Heroku is useful for free use, among other free analogues, I have not seen it better (I may be wrong, because I have not read all the analogues, but, at least in terms of availability, I liked heroku more than the others). Registration Let's start with registration. Registration may seem voluminous, however, it does not take much time-in addition to the usual mail:login: password you will also be asked to enter your first / last name, your role at your job, country and main programming language. You can answer as you like, it is unlikely that you will be checked at all. Getting started After registration and authorization, we go to your application control panel. (clickable) Create a new application by clicking the NEW button on the top right of the panel (select new app, if you already know what a pipeline is, you can select it accordingly, if necessary). (clickable) Enter the name of your application, as well as the server on which your application will be located. Great, we have created our first application. Working with the application Next, we should decide how we want to fill in our application. Using the command line (also includes a clone of the git repository) By connecting our github account Container Registry - I did not use it, I will not consider it. Go to the Deploy tab and see the Deployment method field - choose any method that you think is more convenient. I liked the method of connecting a Github account, since it has an additional relatively convenient function, which I will talk about later. There is nothing difficult in any of these methods - Heroku attaches instructions to each item. I will consider the item with a Github connection. Procfile Before you upload our application, you need to create a Procfile in the root of your repository - a kind of process engine. Create a file called Procfile without an extension with the following content: worker: python start.py where start.py - your file to run, and python is the programming language; worker - alphanumeric name for your command (Heroku description) To learn more about this material - Heroku Stackoverflow (clickable links) Github connect & Deploy We link the Github account according to the intuitive instructions from Heroku. Next, a field will appear with a repository search among the repositories of our linked Github account - in the search, write the desired one and select it; select the repository branch; Click the Deploy Branch button After a successful deployment, I advise you to pay attention to the Automatic deployments field: it will allow you to automatically update the Heroku application with each Push update of the repository. It is quite convenient and useful if you correctly fill in updates and pre-test everything. Starting the application After a successful deployment, go to the Resources tab and find this field (it will appear if you have done the Procfile correctly): The current plan is shown above-Free Dynos. A normal, stable, free tariff. I can't say anything more. Copes with small tasks with a bang. I haven't tested it on larger-scale applications. You can switch to paid tariffs-accordingly, you will receive new bonuses in the form of a server upgrade and other buns. The free tariff is enough for me. Below you will see your Procfile content: to start, click the edit button on the right, drag the switch and confirm. After a short period of time, our application will start working. After registration, only 550 free hours will be available to you, however, according to simple calculations, we can safely say that this will not be enough to support the application 24/7, and you will be right. To get another 450 hours, we need to pass verification, link the card in your account settings. This is safe, there have been no operations with the card for half a year and will not be. Now we will have 1000 hours that will be updated every month, which is just enough for us to support the application 24/7. Application logs To view the logs of your active application, you will need to install https://devcenter.heroku.com/articles/heroku-cli, which will allow you to work with Heroku in CMD. After installation, open the command line and write the 'heroku' command to check and then login. After authorization, we write the command: 'heroku logs --app APPLICATION_NAME' (well, we write our application name in the specified place). Now we have access to the logs of our application. Buildpacks Sometimes you will have to use third-party build packs that will allow you to expand the functionality of the application. For example, we will install ffmpeg for the discord music bot. Go to the Settings tab of your application and see the following: Click Add buildpack and insert the link to the buildpack (https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git for ffmpeg). You can find them simply by searching in Google. 9 Quote Link to comment Share on other sites More sharing options...
btc Posted July 25, 2021 Share Posted July 25, 2021 Hmm looks good Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.