├── .gitmodules ├── ssh └── .gitignore ├── log └── .gitignore ├── www └── default │ ├── public │ ├── php-info.php │ └── index.php │ ├── assets │ ├── css │ │ ├── global │ │ │ └── _variables.scss │ │ ├── components │ │ │ ├── _dialog.scss │ │ │ ├── _toolbar.scss │ │ │ ├── _content.scss │ │ │ └── _sidenav.scss │ │ └── app.scss │ └── js │ │ ├── controllers │ │ ├── home.js │ │ ├── env.js │ │ ├── frame.js │ │ ├── app.js │ │ └── site.js │ │ └── application.js │ ├── bower.json │ ├── package.json │ ├── app │ ├── views │ │ ├── index.phtml │ │ ├── index │ │ │ ├── index.phtml │ │ │ ├── _list.phtml │ │ │ ├── _edit-site.phtml │ │ │ ├── _new-site.phtml │ │ │ └── _homepage.phtml │ │ └── layouts │ │ │ └── index.phtml │ ├── controllers │ │ └── IndexController.php │ └── config │ │ ├── phalconvm.yml │ │ ├── services.php │ │ └── fields.yml │ ├── Gruntfile.js │ └── data │ └── defaults.json ├── provision ├── puppet │ ├── setup.pp │ ├── modules │ │ └── phalconvm │ │ │ ├── manifests │ │ │ ├── tools │ │ │ │ ├── opcache.pp │ │ │ │ ├── webgrind.pp │ │ │ │ ├── npm.pp │ │ │ │ └── composer.pp │ │ │ ├── utils │ │ │ │ ├── known_host.pp │ │ │ │ └── puppet_modules.pp │ │ │ ├── php │ │ │ │ ├── phalcon.pp │ │ │ │ ├── zephir.pp │ │ │ │ └── pecl.pp │ │ │ ├── memcached │ │ │ │ └── phpmemcacheadmin.pp │ │ │ ├── mongodb.pp │ │ │ ├── sphinxsearch.pp │ │ │ ├── gearman.pp │ │ │ ├── rabbitmq.pp │ │ │ ├── memcached.pp │ │ │ ├── redis.pp │ │ │ ├── postgres │ │ │ │ └── phppgadmin.pp │ │ │ ├── postgres.pp │ │ │ ├── elasticsearch.pp │ │ │ ├── mysql │ │ │ │ └── phpmyadmin.pp │ │ │ ├── website.pp │ │ │ ├── varnish.pp │ │ │ ├── mysql.pp │ │ │ ├── init.pp │ │ │ ├── nginx.pp │ │ │ └── php.pp │ │ │ └── templates │ │ │ ├── phpmyadmin │ │ │ └── config.inc.php.erb │ │ │ ├── varnish │ │ │ └── default.vcl.erb │ │ │ └── phppgadmin │ │ │ └── config.inc.php.erb │ └── modules.pp ├── startup.sh └── provision.sh ├── .gitignore ├── LICENSE ├── Vagrantfile └── README.md /.gitmodules: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ssh/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /log/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /www/default/public/php-info.php: -------------------------------------------------------------------------------- 1 | deep_merge( 3 | loadjson( '/srv/www/default/data/defaults.json', {} ), 4 | loadjson( '/srv/www/default/data/settings.json', {} ) 5 | ) 6 | } 7 | -------------------------------------------------------------------------------- /www/default/assets/js/controllers/home.js: -------------------------------------------------------------------------------- 1 | (function(phalconvm) { 2 | phalconvm.app.controller('HomeCtrl', ['$rootScope', function($rootScope) { 3 | $rootScope.saveButton = false; 4 | $rootScope.title = 'Introduction'; 5 | }]); 6 | })(phalconvm); -------------------------------------------------------------------------------- /www/default/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "phalcon-vm", 3 | "private": true, 4 | "dependencies": { 5 | "angular-material": "^1.1.1", 6 | "angular-route": "^1.5.8", 7 | "angular-sanitize": "^1.5.8", 8 | "angular-messages": "^1.5.8" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /www/default/assets/css/app.scss: -------------------------------------------------------------------------------- 1 | @import 'global/variables'; 2 | 3 | @import '../../bower_components/angular-material/modules/scss/angular-material.scss'; 4 | 5 | @import 'components/sidenav'; 6 | @import 'components/toolbar'; 7 | @import 'components/content'; 8 | @import 'components/dialog'; 9 | -------------------------------------------------------------------------------- /provision/puppet/modules/phalconvm/manifests/tools/opcache.pp: -------------------------------------------------------------------------------- 1 | class phalconvm::tools::opcache { 2 | vcsrepo { '/srv/www/default/public/opcache-status': 3 | ensure => 'present', 4 | provider => 'git', 5 | source => 'https://github.com/rlerdorf/opcache-status.git', 6 | depth => 1, 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /www/default/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "phalcon-vm", 3 | "devDependencies": { 4 | "grunt": "^1.0.1", 5 | "grunt-contrib-concat": "^1.0.1", 6 | "grunt-contrib-jshint": "^1.0.0", 7 | "grunt-sass": "^1.2.1", 8 | "grunt-contrib-watch": "^1.0.0", 9 | "matchdep": "^1.0.1" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /provision/puppet/modules/phalconvm/manifests/utils/known_host.pp: -------------------------------------------------------------------------------- 1 | define phalconvm::utils::known_host() { 2 | exec { "${name}-to-known-hosts": 3 | command => "ssh-keyscan -H ${name} >> /etc/ssh/ssh_known_hosts", 4 | onlyif => "test -z `ssh-keygen -F ${name} -f /etc/ssh/ssh_known_hosts`", 5 | path => '/bin:/usr/bin', 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /provision/puppet/modules/phalconvm/manifests/php/phalcon.pp: -------------------------------------------------------------------------------- 1 | class phalconvm::php::phalcon { 2 | packagecloud::repo { 'phalcon/stable': 3 | type => 'deb', 4 | } 5 | 6 | package { 'php7.0-phalcon': 7 | ensure => 'installed', 8 | notify => Service['php7.0-fpm'], 9 | require => Packagecloud::Repo['phalcon/stable'], 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /www/default/assets/js/controllers/env.js: -------------------------------------------------------------------------------- 1 | (function(phalconvm) { 2 | phalconvm.app.controller('EnvCtrl', ['$scope', '$rootScope', '$routeParams', function($scope, $rootScope, $routeParams) { 3 | $rootScope.title = phalconvm.menu.environment['/env/' + $routeParams.service].label; 4 | $rootScope.saveButton = true; 5 | 6 | $scope.data = phalconvm.data; 7 | }]); 8 | })(phalconvm); -------------------------------------------------------------------------------- /provision/puppet/modules/phalconvm/manifests/tools/webgrind.pp: -------------------------------------------------------------------------------- 1 | class phalconvm::tools::webgrind { 2 | package { 'graphviz': 3 | ensure => 'installed', 4 | } 5 | 6 | vcsrepo { '/srv/www/default/public/webgrind': 7 | ensure => 'present', 8 | provider => 'git', 9 | source => 'https://github.com/michaelschiller/webgrind.git', 10 | depth => 1, 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /provision/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | restart() { 4 | if service --status-all | grep -Fq ${1}; then 5 | service ${1} restart 6 | fi 7 | } 8 | 9 | restart nginx 10 | restart varnish 11 | restart php7.0-fpm 12 | restart mysql 13 | restart postgresql 14 | restart mongodb 15 | restart redis-server 16 | restart memcached 17 | restart gearman-job-server 18 | restart rabbitmq-server 19 | restart sphinxsearch -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.vagrant/ 2 | /.data/ 3 | /nbproject/ 4 | /www/* 5 | !/www/default/ 6 | /www/default/bower_components/ 7 | /www/default/node_modules/ 8 | /www/default/public/opcache-status/ 9 | /www/default/public/webgrind/ 10 | /www/default/public/phpmyadmin/ 11 | /www/default/public/phppgadmin/ 12 | /www/default/public/phpmemcachedadmin/ 13 | /www/default/data/settings.json 14 | /ubuntu-xenial-16.04-cloudimg-console.log 15 | .DS_Store 16 | -------------------------------------------------------------------------------- /provision/puppet/modules/phalconvm/manifests/utils/puppet_modules.pp: -------------------------------------------------------------------------------- 1 | define phalconvm::utils::puppet_modules( $modules ) { 2 | $modules.each |$module, $version| { 3 | $command = $version ? { 4 | false => "/opt/puppetlabs/bin/puppet module install ${name}-${module}", 5 | default => "/opt/puppetlabs/bin/puppet module install ${name}-${module} --version ${version}", 6 | } 7 | 8 | exec { "${name}-${module}": 9 | command => $command, 10 | creates => "/etc/puppetlabs/code/environments/production/modules/${module}/", 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /provision/puppet/modules/phalconvm/manifests/memcached/phpmemcacheadmin.pp: -------------------------------------------------------------------------------- 1 | class phalconvm::memcached::phpmemcacheadmin( $enabled = false ) { 2 | if $enabled == true { 3 | vcsrepo { '/srv/www/default/public/phpmemcachedadmin': 4 | ensure => 'present', 5 | provider => 'git', 6 | source => 'https://github.com/wp-cloud/phpmemcacheadmin.git', 7 | revision => '1.2.2.1', 8 | depth => 1, 9 | } 10 | } else { 11 | file { '/srv/www/default/public/phpmemcachedadmin': 12 | ensure => 'absent', 13 | force => true, 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /provision/puppet/modules/phalconvm/manifests/mongodb.pp: -------------------------------------------------------------------------------- 1 | class phalconvm::mongodb( $enabled = false ) { 2 | if $enabled == true { 3 | class { '::mongodb::server': } 4 | } else { 5 | service { 'mongodb': 6 | ensure => 'stopped', 7 | } 8 | 9 | package { 'mongodb-server': 10 | ensure => 'purged', 11 | require => Service['mongodb'], 12 | } 13 | 14 | exec { 'mongodb-remove': 15 | command => '/usr/bin/apt-get autoremove --purge -y', 16 | refreshonly => true, 17 | subscribe => Package['mongodb-server'], 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /provision/puppet/modules/phalconvm/manifests/php/zephir.pp: -------------------------------------------------------------------------------- 1 | class phalconvm::php::zephir() { 2 | vcsrepo { '/usr/local/src/zephir': 3 | ensure => 'present', 4 | provider => 'git', 5 | source => 'https://github.com/phalcon/zephir.git', 6 | depth => 1, 7 | revision => '0.9.4', 8 | } 9 | 10 | exec { 'zephir-install': 11 | command => '/usr/local/src/zephir/install -c', 12 | cwd => '/usr/local/src/zephir/', 13 | refreshonly => true, 14 | subscribe => Vcsrepo['/usr/local/src/zephir'], 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /www/default/assets/js/controllers/frame.js: -------------------------------------------------------------------------------- 1 | (function(phalconvm) { 2 | phalconvm.app.controller('FrameCtrl', ['$rootScope', '$routeParams', function($rootScope, $routeParams) { 3 | var key = '/iframe' + encodeURIComponent($routeParams.href).split('%2F').join('/'); 4 | 5 | $rootScope.saveButton = false; 6 | $rootScope.title = false; 7 | 8 | if (phalconvm.menu.miscellaneous[key]) { 9 | $rootScope.title = phalconvm.menu.miscellaneous[key].label; 10 | } else if (phalconvm.menu.tools[key]) { 11 | $rootScope.title = phalconvm.menu.tools[key].label; 12 | } 13 | }]); 14 | })(phalconvm); -------------------------------------------------------------------------------- /www/default/assets/css/components/_toolbar.scss: -------------------------------------------------------------------------------- 1 | #toolbar { 2 | box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.14), 0px 0px 2px 2px rgba(0, 0, 0, 0.098), 0px 0px 5px 1px rgba(0, 0, 0, 0.084); 3 | background-color: #f6f6f6; 4 | 5 | .md-toolbar-tools { 6 | width: auto; 7 | max-width: $content-width; 8 | margin: 0 ; 9 | } 10 | 11 | .md-breadcrumb { 12 | margin: 0; 13 | padding: 0; 14 | color: black; 15 | font-size: 24px !important; 16 | font-weight: 400 !important; 17 | 18 | .md-breadcrumb-page { 19 | display: inline-block; 20 | word-wrap: break-word; 21 | } 22 | } 23 | 24 | .md-icon-button { 25 | color: black; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /www/default/app/views/index.phtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | tag->getTitle(); ?> 8 | 9 | assets->outputCss(); ?> 10 | assets->outputInlineCss(); ?> 11 | 12 | getContent(); 14 | $this->assets->outputInlineJs(); 15 | $this->assets->outputJs(); 16 | ?> 17 | -------------------------------------------------------------------------------- /provision/puppet/modules/phalconvm/manifests/tools/npm.pp: -------------------------------------------------------------------------------- 1 | class phalconvm::tools::npm { 2 | package { ['nodejs', 'npm']: 3 | ensure => 'installed', 4 | } 5 | 6 | -> 7 | 8 | file { '/usr/bin/node': 9 | ensure => 'link', 10 | target => '/usr/bin/nodejs', 11 | } 12 | 13 | -> 14 | 15 | exec { 'bower': 16 | command => '/usr/bin/npm install -g bower', 17 | creates => '/usr/local/bin/bower', 18 | } 19 | 20 | -> 21 | 22 | exec { 'grunt': 23 | command => '/usr/bin/npm install -g grunt-cli', 24 | creates => '/usr/local/bin/grunt', 25 | } 26 | 27 | -> 28 | 29 | exec { 'gulp': 30 | command => '/usr/bin/npm install -g gulp-cli', 31 | creates => '/usr/local/bin/gulp', 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /provision/puppet/modules/phalconvm/manifests/sphinxsearch.pp: -------------------------------------------------------------------------------- 1 | # https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-sphinx-on-ubuntu-14-04 2 | 3 | class phalconvm::sphinxsearch( $enabled = false ) { 4 | if $enabled == true { 5 | package { 'sphinxsearch': 6 | ensure => 'installed', 7 | } 8 | } else { 9 | service { 'sphinxsearch': 10 | ensure => 'stopped', 11 | } 12 | 13 | package { 'sphinxsearch': 14 | ensure => 'purged', 15 | require => Service['sphinxsearch'], 16 | } 17 | 18 | exec { 'sphinxsearch-remove': 19 | command => '/usr/bin/apt-get autoremove --purge -y', 20 | refreshonly => true, 21 | subscribe => Package['sphinxsearch'], 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /www/default/public/index.php: -------------------------------------------------------------------------------- 1 | getConfig(); 15 | 16 | $loader = new \Phalcon\Loader(); 17 | $loader->registerDirs( array( $config->application->controllersDir ) ); 18 | $loader->register(); 19 | 20 | $application = new \Phalcon\Mvc\Application( $di ); 21 | 22 | $response = $application->handle(); 23 | $response->send(); 24 | } catch ( \Exception $e ) { 25 | echo $e->getMessage() . '
'; 26 | echo '
' . $e->getTraceAsString() . '
'; 27 | } -------------------------------------------------------------------------------- /provision/puppet/modules/phalconvm/manifests/gearman.pp: -------------------------------------------------------------------------------- 1 | class phalconvm::gearman( $enabled = false ) { 2 | if $enabled == true { 3 | package { 'gearman-job-server': 4 | ensure => 'installed', 5 | } 6 | 7 | service { 'gearman-job-server': 8 | ensure => 'running', 9 | require => Package['gearman-job-server'], 10 | } 11 | } else { 12 | service { 'gearman-job-server': 13 | ensure => 'stopped', 14 | } 15 | 16 | package { 'gearman-job-server': 17 | ensure => 'purged', 18 | require => Service['gearman-job-server'], 19 | } 20 | 21 | exec { 'gearman-remove': 22 | command => '/usr/bin/apt-get autoremove --purge -y', 23 | refreshonly => true, 24 | subscribe => Package['gearman-job-server'], 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /provision/puppet/modules/phalconvm/manifests/php/pecl.pp: -------------------------------------------------------------------------------- 1 | class phalconvm::php::pecl { 2 | package { 'php-pear': 3 | ensure => 'installed', 4 | } 5 | 6 | exec { 'pecl-install-yaml': 7 | command => '/usr/bin/pecl install yaml-2.0.0', 8 | creates => '/usr/lib/php/20151012/yaml.so', 9 | require => Package['php-pear'], 10 | } 11 | 12 | file { '/etc/php/7.0/mods-available/yaml.ini': 13 | ensure => 'present', 14 | owner => 'root', 15 | group => 'root', 16 | content => 'extension=yaml.so', 17 | require => Exec['pecl-install-yaml'], 18 | } 19 | 20 | file { '/etc/php/7.0/fpm/conf.d/20-yaml.ini': 21 | ensure => 'link', 22 | target => '/etc/php/7.0/mods-available/yaml.ini', 23 | owner => 'root', 24 | group => 'root', 25 | require => File['/etc/php/7.0/mods-available/yaml.ini'], 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /provision/provision.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # installs puppet and its modules if it is not installed yet 4 | if [ ! -f /opt/puppetlabs/bin/puppet ]; then 5 | # install latest version of puppet 6 | pushd /tmp/ 7 | wget http://apt.puppetlabs.com/puppetlabs-release-pc1-xenial.deb 8 | dpkg -i puppetlabs-release-pc1-xenial.deb 9 | apt-get update --quiet --yes 10 | apt-get install --quiet --yes puppetserver 11 | popd 12 | 13 | # make a symlink to puppet executable 14 | ln -s /opt/puppetlabs/bin/puppet /usr/local/bin/puppet 15 | 16 | # set basemodulepath 17 | puppet config set basemodulepath "/etc/puppetlabs/code/modules:/opt/puppetlabs/puppet/modules:/srv/provision/puppet/modules" --section main 18 | fi 19 | 20 | # install puppet modules and apply server configurations 21 | puppet apply /srv/provision/puppet/modules.pp 22 | puppet apply /srv/provision/puppet/setup.pp 23 | -------------------------------------------------------------------------------- /provision/puppet/modules/phalconvm/manifests/rabbitmq.pp: -------------------------------------------------------------------------------- 1 | class phalconvm::rabbitmq( $enabled = false ) { 2 | if $enabled == true { 3 | packagecloud::repo { 'rabbitmq/rabbitmq-server': type => 'deb' } 4 | 5 | package { 'rabbitmq-server': 6 | ensure => 'installed', 7 | require => Packagecloud::Repo['rabbitmq/rabbitmq-server'], 8 | } 9 | 10 | service { 'rabbitmq-server': 11 | ensure => 'running', 12 | require => Package['rabbitmq-server'], 13 | } 14 | } else { 15 | service { 'rabbitmq-server': 16 | ensure => 'stopped', 17 | } 18 | 19 | package { 'rabbitmq-server': 20 | ensure => 'purged', 21 | require => Service['rabbitmq-server'], 22 | } 23 | 24 | exec { 'rabbitmq-remove': 25 | command => '/usr/bin/apt-get autoremove --purge -y', 26 | refreshonly => true, 27 | subscribe => Package['rabbitmq-server'], 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /provision/puppet/modules/phalconvm/manifests/memcached.pp: -------------------------------------------------------------------------------- 1 | class phalconvm::memcached( 2 | $enabled = false, 3 | $max_memory = 64, 4 | $port = 11211, 5 | $forward_port = false, 6 | ) { 7 | if $enabled == true { 8 | class { 'memcached': 9 | package_ensure => 'present', 10 | listen_ip => '127.0.0.1', 11 | tcp_port => $port, 12 | max_memory => $max_memory, 13 | user => 'memcache', 14 | } 15 | } else { 16 | # file { '/srv/log/memcached.log': 17 | # ensure => 'absent', 18 | # } 19 | 20 | service { 'memcached': 21 | ensure => 'stopped', 22 | } 23 | 24 | package { 'memcached': 25 | ensure => 'purged', 26 | require => Service['memcached'], 27 | } 28 | 29 | exec { 'memcached-removed': 30 | command => '/usr/bin/apt-get autoremove --purge -y', 31 | refreshonly => true, 32 | subscribe => Package['memcached'], 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /provision/puppet/modules.pp: -------------------------------------------------------------------------------- 1 | phalconvm::utils::puppet_modules { 'puppetlabs': 2 | modules => { 3 | 'stdlib' => '4.13.1', 4 | 'apt' => '2.3.0', 5 | 'vcsrepo' => '1.4.0', 6 | 'inifile' => '1.6.0', 7 | 'mysql' => '3.9.0', 8 | 'postgresql' => '4.8.0', 9 | 'mongodb' => '0.14.0', 10 | } 11 | } 12 | 13 | phalconvm::utils::puppet_modules { 'computology': 14 | modules => { 15 | 'packagecloud' => '0.3.1', 16 | } 17 | } 18 | 19 | phalconvm::utils::puppet_modules { 'saz': 20 | modules => { 21 | 'memcached' => '2.8.1', 22 | } 23 | } 24 | 25 | phalconvm::utils::puppet_modules { 'puppet': 26 | modules => { 27 | 'nginx' => '0.4.0', 28 | 'archive' => '1.1.2', 29 | } 30 | } 31 | 32 | phalconvm::utils::puppet_modules { 'elasticsearch': 33 | modules => { 34 | 'elasticsearch' => '0.14.0', 35 | } 36 | } 37 | 38 | phalconvm::utils::puppet_modules { 'arioch': 39 | modules => { 40 | 'redis' => '1.2.3', 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /provision/puppet/modules/phalconvm/manifests/redis.pp: -------------------------------------------------------------------------------- 1 | class phalconvm::redis( 2 | $enabled = false, 3 | $port = 6379, 4 | $forward_port = false, 5 | $maxmemory = 64, 6 | $save_db_to_disk = true, 7 | $slowlog_log_slower_than = 100, 8 | ) { 9 | if $enabled == true { 10 | class { 'redis': 11 | port => $port, 12 | maxmemory => $maxmemory << 20, 13 | maxmemory_policy => 'volatile-lru', 14 | save_db_to_disk => $save_db_to_disk, 15 | daemonize => true, 16 | slowlog_log_slower_than => $slowlog_log_slower_than * 1000, 17 | } 18 | } else { 19 | service { 'redis-server': 20 | ensure => 'stopped', 21 | } 22 | 23 | package { 'redis-server': 24 | ensure => 'purged', 25 | require => Service['redis-server'], 26 | } 27 | 28 | exec { 'redis-remove': 29 | command => '/usr/bin/apt-get autoremove --purge -y', 30 | refreshonly => true, 31 | subscribe => Package['redis-server'], 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /provision/puppet/modules/phalconvm/manifests/postgres/phppgadmin.pp: -------------------------------------------------------------------------------- 1 | class phalconvm::postgres::phppgadmin( $enabled = true ) { 2 | if $enabled == true { 3 | archive { '/tmp/phppgadmin.tar.gz': 4 | ensure => 'present', 5 | source => 'https://github.com/phppgadmin/phppgadmin/archive/REL_5-1-0.tar.gz', 6 | extract => true, 7 | extract_path => '/tmp/', 8 | creates => '/srv/www/default/public/phppgadmin/index.php', 9 | cleanup => true, 10 | } 11 | 12 | exec { 'move-phppgadmin': 13 | command => '/bin/mv /tmp/phppgadmin-REL_5-1-0 /srv/www/default/public/phppgadmin', 14 | creates => '/srv/www/default/public/phppgadmin/index.php', 15 | require => Archive['/tmp/phppgadmin.tar.gz'] 16 | } 17 | 18 | file { '/srv/www/default/public/phppgadmin/conf/config.inc.php': 19 | ensure => 'present', 20 | content => template( 'phalconvm/phppgadmin/config.inc.php.erb' ), 21 | require => Exec['move-phppgadmin'], 22 | } 23 | } else { 24 | file { '/srv/www/default/public/phppgadmin/': 25 | ensure => 'absent', 26 | force => true, 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /provision/puppet/modules/phalconvm/manifests/postgres.pp: -------------------------------------------------------------------------------- 1 | class phalconvm::postgres( 2 | $enabled = true, 3 | $password = 'postgres', 4 | $log_min_duration_statement = 250, 5 | ) { 6 | if $enabled == true { 7 | class { 'postgresql::server': 8 | postgres_password => $password, 9 | } 10 | 11 | postgresql::server::config_entry { 'logging_collector': 12 | ensure => 'present', 13 | value => 'on', 14 | } 15 | 16 | postgresql::server::config_entry { 'log_min_duration_statement': 17 | ensure => 'present', 18 | value => $log_min_duration_statement, 19 | } 20 | 21 | postgresql::server::config_entry { 'log_statement': 22 | ensure => 'present', 23 | value => 'none', 24 | } 25 | } else { 26 | service { 'postgresql': 27 | ensure => 'stopped', 28 | } 29 | 30 | package { ['postgresql-9.5', 'postgresql-client-9.5']: 31 | ensure => 'purged', 32 | require => Service['postgresql'], 33 | } 34 | 35 | exec { 'postgresql-remove': 36 | command => '/usr/bin/apt-get autoremove --purge -y', 37 | refreshonly => true, 38 | subscribe => Package['postgresql-9.5'], 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2015 the contributors of the Phalcon VM project 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /www/default/app/controllers/IndexController.php: -------------------------------------------------------------------------------- 1 | getDI(); 7 | 8 | $phalconvm = $di->getShared( 'phalconvmConfig' ); 9 | $fields = $di->getShared( 'fieldsConfig' ); 10 | 11 | $this->tag->setTitle( 'Phalcon VM' ); 12 | 13 | $this->assets->addCss( '//fonts.googleapis.com/css?family=Roboto:300,400,500,700,400italic', false ); 14 | $this->assets->addCss( '//fonts.googleapis.com/icon?family=Material+Icons', false ); 15 | $this->assets->addCss( 'css/app.css' ); 16 | 17 | $this->assets->addInlineJs( sprintf( 'var phalconvm = %s;', json_encode( $phalconvm ) ) ); 18 | $this->assets->addJs( 'js/app.js' ); 19 | 20 | $phalconvm['fields'] = $fields; 21 | $this->view->phalconvm = $phalconvm; 22 | } 23 | 24 | public function saveEnvAction() { 25 | if ( ! $this->request->isPost() ) { 26 | $this->response->redirect( '/', false ); 27 | } else { 28 | $postdata = trim( file_get_contents( "php://input" ) ); 29 | $json = json_decode( $postdata, true ); 30 | if ( ! empty( $json ) ) { 31 | file_put_contents( BASE_PATH . '/data/settings.json', json_encode( $json, JSON_PRETTY_PRINT ) ); 32 | } 33 | } 34 | 35 | return false; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /provision/puppet/modules/phalconvm/manifests/elasticsearch.pp: -------------------------------------------------------------------------------- 1 | class phalconvm::elasticsearch( 2 | $enabled = false, 3 | $port = '9200', 4 | $forward_port = false, 5 | # $xpack = false, 6 | ) { 7 | if $enabled == true { 8 | class { 'elasticsearch': 9 | manage_repo => true, 10 | repo_version => '2.x', 11 | restart_on_change => true, 12 | config => { 13 | 'http.port' => $port, 14 | }, 15 | } 16 | 17 | elasticsearch::instance { 'es-01': 18 | config => { 19 | 'network.bind_host' => '0.0.0.0', 20 | } 21 | } 22 | 23 | # if $xpack == true { 24 | # elasticsearch::plugin { 'elasticsearch/marvel': 25 | # url => 'https://download.elastic.co/elasticsearch/release/org/elasticsearch/plugin/marvel-agent/2.4.1/marvel-agent-2.4.1.zip', 26 | # module_dir => 'marvel', 27 | # instances => 'es-01', 28 | # } 29 | # } 30 | } else { 31 | service { 'elasticsearch-es-01': 32 | ensure => 'stopped', 33 | } 34 | 35 | package { 'elasticsearch': 36 | ensure => 'purged', 37 | require => Service['elasticsearch-es-01'], 38 | } 39 | 40 | exec { 'elasticsearch-remove': 41 | command => '/usr/bin/apt-get autoremove --purge -y', 42 | refreshonly => true, 43 | subscribe => Package['elasticsearch'], 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /www/default/app/views/index/index.phtml: -------------------------------------------------------------------------------- 1 | partial( 'index/_homepage' ); 4 | $this->partial( 'index/_new-site' ); 5 | $this->partial( 'index/_edit-site' ); 6 | 7 | foreach ( $phalconvm['menu']['environment'] as $env ) : 8 | ?>and up it again with --provision mode.') 20 | .ok('Got it!'); 21 | 22 | self.nasty = false; 23 | 24 | $http.post('/save/env', phalconvm.data); 25 | $mdDialog.show(alert); 26 | }; 27 | 28 | self.toggleSidenav = function() { 29 | $mdSidenav('left').toggle(); 30 | }; 31 | 32 | self.newSiteDialog = function() { 33 | $rootScope.newSite = true; 34 | 35 | $mdDialog.show({ 36 | controller: 'SiteCtrl', 37 | controllerAs: 'site', 38 | template: document.getElementById('tmpl-new-site').innerHTML 39 | }).then(function() { 40 | self.setNasty(); 41 | }); 42 | }; 43 | }; 44 | 45 | phalconvm.app.controller('AppCtrl', ['$rootScope', '$mdSidenav', '$mdDialog', '$http', controller]); 46 | })(phalconvm); 47 | -------------------------------------------------------------------------------- /www/default/assets/css/components/_content.scss: -------------------------------------------------------------------------------- 1 | #wrapper { 2 | position: relative; 3 | overflow-x: hidden 4 | } 5 | 6 | #content { 7 | position: absolute; 8 | top: 64px; 9 | left: 0; 10 | right: 0; 11 | bottom: 4px; 12 | 13 | .content-container { 14 | max-width: $content-width; 15 | margin: 16px; 16 | } 17 | 18 | .header > h2 { 19 | margin: 0; 20 | color: #164371; 21 | } 22 | 23 | p { 24 | font-size: 16px; 25 | font-weight: 400; 26 | letter-spacing: 0.010em; 27 | line-height: 1.6em; 28 | margin: 0.8em 0 1.6em; 29 | 30 | &:last-of-type { 31 | margin-bottom: 0; 32 | } 33 | } 34 | 35 | .md-title { 36 | margin-top: 1.5em; 37 | } 38 | 39 | .md-2-line { 40 | p { 41 | font-size: 11px; 42 | } 43 | } 44 | 45 | .md-secondary-container { 46 | min-width: 75px; 47 | 48 | > * { 49 | margin-left: auto; 50 | margin-right: auto; 51 | } 52 | 53 | input[type="text"] { 54 | text-align: center; 55 | width: 75px; 56 | border-width: 1px; 57 | border-color: rgba(0, 0, 0, 0.1); 58 | border-bottom-width: 2px; 59 | border-bottom-color: rgba(0, 0, 0, 0.2); 60 | padding: 5px 0; 61 | 62 | &:focus { 63 | outline-color: #106CC8; 64 | outline-width: 1px; 65 | } 66 | } 67 | } 68 | 69 | md-tabs { 70 | .md-subhead { 71 | margin: 2em 0 .5em 14px; 72 | font-weight: bold; 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /www/default/assets/css/components/_sidenav.scss: -------------------------------------------------------------------------------- 1 | #sidebar, 2 | #sidebar-menu { 3 | color: white; 4 | background-color: #106CC8; 5 | } 6 | 7 | #sidebar { 8 | #logo { 9 | text-transform: uppercase; 10 | text-align: center; 11 | display: block; 12 | padding: 0; 13 | margin: .5em 0; 14 | 15 | a { 16 | color: #fff; 17 | text-decoration: none; 18 | } 19 | 20 | small { 21 | display: block; 22 | font-size: 14px; 23 | font-weight: 400; 24 | line-height: 1em; 25 | color: #bbb; 26 | } 27 | } 28 | 29 | md-divider { 30 | border-color: #267ED5; 31 | } 32 | 33 | ul { 34 | padding: 0; 35 | margin: 0 0 1.5em; 36 | } 37 | 38 | .section-title { 39 | text-transform: uppercase; 40 | color: rgba(255, 255, 255, 0.54); 41 | display: block; 42 | margin: 1em 0 0; 43 | padding: .5em 1.5em 0; 44 | line-height: 32px; 45 | } 46 | 47 | .group-title { 48 | text-transform: uppercase; 49 | display: block; 50 | line-height: 32px; 51 | font-weight: bold; 52 | } 53 | 54 | .menu-item { 55 | margin: 0; 56 | list-style: none; 57 | 58 | a { 59 | color: #fff; 60 | text-decoration: none; 61 | font-weight: 500; 62 | display: block; 63 | padding: .5em 1.5em; 64 | 65 | &:hover { 66 | background-color: rgba(255, 255, 255, 0.25); 67 | } 68 | } 69 | } 70 | 71 | .material-icons { 72 | font-size: 14px; 73 | font-weight: bold; 74 | } 75 | } -------------------------------------------------------------------------------- /www/default/assets/js/application.js: -------------------------------------------------------------------------------- 1 | (function(angular, phalconvm, document) { 2 | phalconvm.app = angular.module('PhalconVM', ['ngMaterial', 'ngRoute', 'ngSanitize', 'ngMessages']); 3 | phalconvm.app.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) { 4 | $routeProvider.when('/', { 5 | controller: 'HomeCtrl', 6 | controllerAs: 'home', 7 | template: function() { 8 | return document.getElementById('tmpl-homepage').innerHTML; 9 | } 10 | }); 11 | 12 | $routeProvider.when('/site/:site', { 13 | controller: 'SiteCtrl', 14 | controllerAs: 'site', 15 | template: function() { 16 | return document.getElementById('tmpl-edit-site').innerHTML; 17 | } 18 | }); 19 | 20 | $routeProvider.when('/env/:service', { 21 | controller: 'EnvCtrl', 22 | controllerAs: 'env', 23 | template: function(params) { 24 | var template = document.getElementById('tmpl-' + params.service); 25 | 26 | if (template) { 27 | return template.innerHTML; 28 | } 29 | 30 | return ' '; 31 | } 32 | }); 33 | 34 | $routeProvider.when('/iframe:href*', { 35 | controller: 'FrameCtrl', 36 | controllerAs: 'frm', 37 | template: function(params) { 38 | return '