https://github.com/rexops/rex-application
A class to manage application deployments
https://github.com/rexops/rex-application
Last synced: about 1 year ago
JSON representation
A class to manage application deployments
- Host: GitHub
- URL: https://github.com/rexops/rex-application
- Owner: RexOps
- Created: 2015-10-29T20:24:07.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-02-15T11:10:26.000Z (about 9 years ago)
- Last Synced: 2025-01-05T06:29:26.764Z (about 1 year ago)
- Language: Perl
- Size: 76.2 KB
- Stars: 1
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
Awesome Lists containing this project
README
# Application
The Application class provides the deployment and instance management functions.
## Types
Currently the following application types are supported. It is easy to create custom ones.
### Static
For static website deployment. This deployment upload files to the webserver and link the document root with the newly uploaded files.
### PHP
PHP deployment is like static deployment.
#### FPM
PHP-FPM deployment extends the PHP deployment with the possibility to restart php-fpm service.
### Tomcat
Tomcat deployment uses the tomcat-manager to deploy war archives. Additionally it supports 2 instance deployments. With this it is possible to deploy all servers with a new version before advising mod_jk to route traffic to the new version.
Additionally it restarts tomcat after the deployment to get a clean jvm.
### JBoss
JBoss deployment uploads an ear file to the deployment directory of JBoss and uses .dodeploy file to trigger the deployment.
Additionally it restarts jboss after the deployment to get a clean jvm.
## Custom Application Types
If you need to extend the deployment you can easily create custom application classes.
For this you need to create 2 classes. One *application* and one *instance* class.
### Application Class
To create an application class you need to inherit from a provided base type. In this example we extend the *Application::PHP::FPM* type.
After this we need to register the new application type to the project class.
```perl
Project->register_app_type($order, $package_Name, $condition_CodeRef);
```
* $oder: an order of "0" will run the detection of this custom application type at first. The provided application types using an order of 100.
* $package_Name: the class name for the application.
* $condition_CodeRef: code that detects the application type.
```perl
package MyApp {
use Moose;
use MyApp::Instance;
require Rex::Commands;
extends 'Application::PHP::FPM';
Project->register_app_type(90, __PACKAGE__, sub {
if(Rex::Commands::connection()->server =~ m/^my\-appsrv/) {
return 1;
}
return 0;
});
}
1;
```
### Instance Class
The instance class must inherit from one of the provided base types.
```perl
package My::Instance {
use Moose;
use Rex::Commands::Run;
use Rex::Commands::Fs;
use Rex::Commands::File;
require Rex::Commands;
extends 'Application::PHP::FPM::Instance';
after configure_app => sub {
# do something after the configuration
};
}
1;
```
# COPYRIGHT
Copyright 2015 FILIADATA GmbH
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.