📜 ⬆️ ⬇️

Stackato: deploy Perl application in your cloud in 3 steps

stackato ActiveState is well known to developers. They are quite actively promoting their assemblies Perl (ActivePerl), Python (ActivePython), Tcl (ActiveTcl) (There used to be ActivePHP, but now it isn’t). They have a great Komodo IDE and its stripped-down free version of Komodo Edit. And recently, the company has taken steps to enter the market of nowadays cloud technologies, but not from the creation of its cloud services, but from the creation of its software platform. [Honestly, not quite my own, but more on that later :-)] This is how Stackato appeared - “the first cloud platform for creating private PaaS with support for Python, Perl, Ruby, Node.js and Java”
If you are interested in how to create your own "cloudy" Perl application, please under Cat.

Stackato is built on the basis of Cloud Foundry (and there were reasons for that ) and in fact expands Cloud Foundry, adding the ability to deploy applications written in Perl and Python.
The architecture of Stackato is no different from Cloud Foundry, and more details about some parts can be found in this translation . I just give an illustration describing the architecture, and I will not dwell in more detail.
Let us turn to the interesting - the process of deploying a perl application in Stackato.

STEP 0: Get an invite

Stackato is in the beta version (recently moved from the Developer Preview stage), and in order to try it in action you need to get an invite. You can request it here .

STEP 1: Server

In order to try Stackato, you need to download and deploy Stackato Server VM. Distributed in 3 formats: vSphere (OVF), VMware Player and Fusion (VMDK), VirtualBox VM. System requirements: x86_64 processor, 2GB + RAM, 3GB + free disk space
By default, the Stackato VM runs as a “micro-cloud”. This allows it to function as a stand-alone server without any additional settings. The default server name is stackato.local.
Immediately after the first start, there is one user stackato with the password stackato. There is also the ability to connect via ssh:
]$ ssh stackato@stackato.local
To change the settings and control the server, use the stackato-admin command. More information about the parameters can be found as follows:
]$ stackato-admin help
And the rest is Ubuntu 10.04 LTS with all the consequences. :-)
')

STEP 2: Customer

After installing the server, you need to install a client application, ready builds of which are for MAC OS X, Windows and Linux. Also, the client application can be installed using the pypm utility (ActivePython):
]$ pypm install stackato
the ability to install using ppm (ActivePerl) will appear soon.
After the client application is successfully installed, you need to make some settings:
1) Setting the target URL - this will allow the stackato client to find out where to push the application. By default, the local server should use api.stackato.local:
]$ stackato target api.stackato.local
2) Registration user Stackato. Email is used as a username:
]$ stackato add-user [EMAIL] [--passwd PASS]
3) Login. The registration command ends with an automatic login, but if you need to log in as an existing user or change the current user, use the login command:
]$ stackato login [EMAIL] [--passwd PASS]
If you need a list of available commands or information on a specific command, you must use the help command:
]$ stackato help [COMMAND]

If the client and server are installed and configured, you can begin to deploy the application.

STEP 3: Deploy

The process of deploying applications may differ slightly, depending on the dependencies of the application (sorry for the pun :-)), or rather, the presence or absence of integration with various additional services (eg databases). Therefore, it is a good idea to specify deployment features (if any) in the README file. There is a set of applications prepared specifically for deployment to Stackato, written in various languages. They can be found here . Unfortunately, among these examples there is no application using Dancer , and I prefer this particular micro web framework. So I wrote my VERY easy app. It can be viewed and downloaded here .
Before deploying the application, I will tell you a little about the features. In fact, my application ( simpleDancer ) is the default application that you will receive using the command:
]$ dancer -a appName
I just added important parts, without which the application created will not run on Stackato. The first is the requirements.txt file, which contains a list of dependencies required by the application:
Dancer<br/> YAML<br/> Plack::Request
All dependencies specified in it will be automatically installed during deployment using ppm from the ActiveState repository, and if they are not found there, then using cpanm from cpanm .
The second is the app.psgi file. All Perl applications in Stackato are launched as PSGI applications, and the startup script should be called app.psgi (or app.pl) and be in the root of the application. Because Dancer application can run as a PSGI application without any changes, it was enough to make a link to ./bin/app.pl.
Now that all the formalities are met, let's proceed to the deployment of the application.
If we are in the root folder of our application, then we need to run the following command:
]$ stackato push simpleDancer
where simpleDancer is the name of the application. It must be borne in mind that by default applications are deployed with ActivePerl 5.12.4, and if you need to use ActivePerl 5.14.1, you should write this:
]$ stackato push simpleDancer --runtime perl514
After the push command, you need to answer a few questions:
In my case, the default responses are highlighted in green. Here, special explanations are probably not required, except for the question: would you like to? SimpleDancer? It asks if your application will need access to any additional service (application), such as MongoDB or MySQL. And in the case of a positive response, you will need to choose from the list of available:
If everything went smoothly during deployment, then the apps command:
]$ stackato apps
will issue the following:
And the application can be accessed at: simpleDancer.stackato.local

If something went wrong during the deployment process, or the application is not available, you can view stdout and stderr using the logs command:
]$ stackato logs simpleDancer
If nothing useful was found, you should look at two additional log files (staging.log and ppm4.log), which can be accessed using the files command:
]$ stackato files simpleDancer logs/staging.log<br/> ]$ stackato files simpleDancer logs/ppm4.log

That's all you need to know and keep in mind when working with Stackato.
Good luck with the clouds :-)

Source: https://habr.com/ru/post/124481/


All Articles