diff --git a/.gitignore b/.gitignore index 1e5aad1..650d41f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,8 @@ .DS_Store .vagrant .idea/ +/cakephp/ +/symfony-standard/ +/wordpress/ +/laravel-quickstart/ +/create_ssl.sh diff --git a/Readme.md b/Readme.md index 32f4093..ef20976 100644 --- a/Readme.md +++ b/Readme.md @@ -1,6 +1,7 @@ Set up a PHP development box super fast ======================================= -[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/dirkaholic/vagrant-php-dev-box?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + +[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/dirkaholic/vagrant-php-dev-box?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) Installation ------------ @@ -10,12 +11,14 @@ Installation * Clone this repository and cd into it * Run ```vagrant up``` in order to set up the box using the ```ansible_local``` provisioner * You should now have your working - * Symfony2 Standard Edition under http://192.168.50.4:8081/ - * Laravel Quickstart example app under http://192.168.50.4:8082/ + * Symfony2 Standard Edition under https://192.168.50.4:8081/ + * Laravel Quickstart example app under https://192.168.50.4:8082/ + * CakePHP base installation under https://192.168.50.4:8083/ + * Wordpress base installation under https://192.168.50.4:8084/ -The installation process will create a folder symfony-standard inside +The installation process will create folders symfony-standard, laravel-quickstart, cakephp, wordpress inside the main directory of the repository. You can now start working inside -this folder directly on your host computer using your favourite IDE. +these folders directly on your host computer using your favourite IDE. Changes done there will be reflected directly on the vagrant box as the directory is mounted in the vagrant box under ```/vagrant```. Also you can login into the box using ```vagrant ssh``` and have the full control @@ -26,6 +29,8 @@ repeat the whole procedure at any time. In order to start fresh just run ```vagrant destroy``` and ```vagrant up```. This will undo all you manual changes done on the vagrant box and provide you with a clean setup. +NOTE: You must delete or move the development folders prior to ```vagrant up``` after a destroy. If these folders exist, the process will fail. + Installed components -------------------- @@ -35,8 +40,11 @@ Installed components * [php-fpm](http://php-fpm.org) * [git](http://git-scm.com/) * [Composer](https://getcomposer.org/) +* [CakePHP 3](https://cakephp.org) +* [Wordpress](https://wordpress.org) * [Symfony2 Standard Edition](https://github.com/symfony/symfony-standard) * [Laravel](https://laravel.com/) +* [NodeJS](https://nodejs.org) * [PHPUnit](https://phpunit.de/) If you don't like/need some of the components just remove them from the roles section in playbook/vagrant.yml. diff --git a/Vagrantfile b/Vagrantfile index 95d4755..c5e7427 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -4,18 +4,24 @@ Vagrant.require_version ">= 1.7.0" Vagrant.configure(2) do |config| config.vm.box = "bento/ubuntu-16.04" + #config.vm.box = "xenji/ubuntu-17.04-server" + #config.vm.box = "wholebits/ubuntu17.04-64" # Disable the new default behavior introduced in Vagrant 1.7, to # ensure that all Vagrant machines will use the same SSH key pair. # See https://github.com/mitchellh/vagrant/issues/5005 config.ssh.insert_key = false + config.ssh.keep_alive = true + # Run Ansible from the Vagrant VM config.vm.provision "ansible_local" do |ansible| ansible.verbose = "vv" ansible.playbook = "playbooks/vagrant.yml" + ansible.install_mode = "pip" + ansible.version = "2.2.3.0" end config.vm.network "forwarded_port", guest: 80, host: 8080 config.vm.network "private_network", ip: "192.168.50.4" -end \ No newline at end of file +end diff --git a/playbooks/roles/base/tasks/main.yml b/playbooks/roles/base/tasks/main.yml index 3681c69..c536f4d 100644 --- a/playbooks/roles/base/tasks/main.yml +++ b/playbooks/roles/base/tasks/main.yml @@ -1,8 +1,15 @@ - name: Install required base packages apt: name={{ item }} state=present + with_items: - curl - git - python-mysqldb - zip - - unzip \ No newline at end of file + - unzip + - npm + - ruby + +- name: Install NodeJS + shell: curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - && sudo apt-get install -y nodejs + diff --git a/playbooks/roles/cakephp/meta/main.yml b/playbooks/roles/cakephp/meta/main.yml new file mode 100644 index 0000000..14db65e --- /dev/null +++ b/playbooks/roles/cakephp/meta/main.yml @@ -0,0 +1,6 @@ +--- +dependencies: + - { role: base } + - { role: mysql } + - { role: php-fpm } + - { role: nginx } \ No newline at end of file diff --git a/playbooks/roles/cakephp/tasks/main.yml b/playbooks/roles/cakephp/tasks/main.yml new file mode 100644 index 0000000..24edfa5 --- /dev/null +++ b/playbooks/roles/cakephp/tasks/main.yml @@ -0,0 +1,147 @@ +--- +- name: Create MySQL database for CakePHP + mysql_db: name=cakephp state=present + +- name: Create MySQL user for CakePHP + mysql_user: name=cakephp password=cakephp priv=*.*:ALL state=present + +- name: Install CakePHP + command: composer create-project --prefer-dist cakephp/app cakephp + args: + chdir: /vagrant + creates: /vagrant/cakephp + become: true + become_user: "{{ www_user }}" + ignore_errors: yes + +- name: Remove default CakePHP app.php + file: + path=/vagrant/cakephp/config/app.php + state=absent + +- name: Copy across new CakePHP app.php + template: + src=app.php.j2 + dest=/vagrant/cakephp/config/app.php + become: true + become_user: "{{ www_user }}" + +- name: Remove default CakePHP composer.json + file: + path=/vagrant/cakephp/composer.json + state=absent + +- name: Copy across new composer.json + template: + src=composer.json.j2 + dest=/vagrant/cakephp/composer.json + become: true + become_user: "{{ www_user }}" + +- name: Composer Update (to install Foundation 6) + shell: cd /vagrant/cakephp && composer update + become: true + become_user: "{{ www_user }}" + +- name: Copy across new php-fpm pool config for CakePHP + template: + src=php-fpm.conf.j2 + dest=/etc/php/{{ php_version }}/fpm/pool.d/cakephp.conf + notify: + - restart php-fpm + +- name: Copy across new virtual host for CakePHP + template: + src=nginx.conf.j2 + dest=/etc/nginx/sites-available/cakephp.conf + notify: + - restart nginx + +- name: Enable new vagrant virtual host for cakephp + file: + src=/etc/nginx/sites-available/cakephp.conf + dest=/etc/nginx/sites-enabled/cakephp.conf + state=link + notify: + - restart nginx + +- name: Copy NPM package.json + template: + src=package.json.j2 + dest=/vagrant/cakephp/package.json + become: true + become_user: "{{ www_user }}" + +- name: NPM Install + shell: cd /vagrant/cakephp && sudo npm -g install grunt + become: true + become_user: "{{ www_user }}" + +- name: NPM Install local project + shell: cd /vagrant/cakephp && npm --no-bin-links install + become: true + become_user: "{{ www_user }}" + +- name: Install required GEM packages + apt: name={{ item }} state=present + with_items: + - ruby-sass + +- name: Install GEM + shell: cd /vagrant/cakephp && sudo apt-get -y install ruby-sass + +- name: Install GEM + shell: cd /vagrant/cakephp && sudo gem install sass + +- name: Copy gruntfile.js + template: + src=gruntfile.js.j2 + dest=/vagrant/cakephp/gruntfile.js + become: true + become_user: "{{ www_user }}" + +- name: Make sass directories + shell: mkdir /vagrant/cakephp/webroot/scss + become: true + become_user: "{{ www_user }}" + ignore_errors: yes + +- name: Copy default layout with new sass + template: + src=default.ctp.j2 + dest=/vagrant/cakephp/src/Template/Layout/default.ctp + become: true + become_user: "{{ www_user }}" + ignore_errors: yes + +- name: Copy default layout with new sass + template: + src=main.scss.j2 + dest=/vagrant/cakephp/webroot/scss/main.scss + become: true + become_user: "{{ www_user }}" + ignore_errors: yes + +- name: Copy js with new custom js + template: + src=custom.js.j2 + dest=/vagrant/cakephp/webroot/js/custom.js + become: true + become_user: "{{ www_user }}" + ignore_errors: yes + +- name: Copy over rc.local file + template: + src=rc.local.j2 + dest=/etc/rc.local + ignore_errors: yes + +- name: setup GRUNT on boot + shell: sudo systemctl enable rc-local.service + +- name: Copy Foundation Icons + shell: cp -fr /vagrant/cakephp/node_modules/foundation-icons /vagrant/cakephp/webroot/font/foundation-icons + become: true + become_user: "{{ www_user }}" + ignore_errors: yes + diff --git a/playbooks/roles/cakephp/templates/.env.j2 b/playbooks/roles/cakephp/templates/.env.j2 new file mode 100644 index 0000000..90ae590 --- /dev/null +++ b/playbooks/roles/cakephp/templates/.env.j2 @@ -0,0 +1,24 @@ +APP_ENV=local +APP_DEBUG=true +APP_KEY=a0888cfd6538f2ded11ed14b163eee30f732c5b8 +APP_URL=http://192.168.50.4:8083/ + +DB_HOST=127.0.0.1 +DB_DATABASE=cakephp +DB_USERNAME=cakephp +DB_PASSWORD=cakephp + +CACHE_DRIVER=file +SESSION_DRIVER=file +QUEUE_DRIVER=sync + +REDIS_HOST=127.0.0.1 +REDIS_PASSWORD=null +REDIS_PORT=6379 + +MAIL_DRIVER=smtp +MAIL_HOST=mailtrap.io +MAIL_PORT=2525 +MAIL_USERNAME=null +MAIL_PASSWORD=null +MAIL_ENCRYPTION=null diff --git a/playbooks/roles/cakephp/templates/app.php.j2 b/playbooks/roles/cakephp/templates/app.php.j2 new file mode 100644 index 0000000..92012a8 --- /dev/null +++ b/playbooks/roles/cakephp/templates/app.php.j2 @@ -0,0 +1,346 @@ + filter_var(env('DEBUG', true), FILTER_VALIDATE_BOOLEAN), + + /** + * Configure basic information about the application. + * + * - namespace - The namespace to find app classes under. + * - defaultLocale - The default locale for translation, formatting currencies and numbers, date and time. + * - encoding - The encoding used for HTML + database connections. + * - base - The base directory the app resides in. If false this + * will be auto detected. + * - dir - Name of app directory. + * - webroot - The webroot directory. + * - wwwRoot - The file path to webroot. + * - baseUrl - To configure CakePHP to *not* use mod_rewrite and to + * use CakePHP pretty URLs, remove these .htaccess + * files: + * /.htaccess + * /webroot/.htaccess + * And uncomment the baseUrl key below. + * - fullBaseUrl - A base URL to use for absolute links. + * - imageBaseUrl - Web path to the public images directory under webroot. + * - cssBaseUrl - Web path to the public css directory under webroot. + * - jsBaseUrl - Web path to the public js directory under webroot. + * - paths - Configure paths for non class based resources. Supports the + * `plugins`, `templates`, `locales` subkeys, which allow the definition of + * paths for plugins, view templates and locale files respectively. + */ + 'App' => [ + 'namespace' => 'App', + 'encoding' => env('APP_ENCODING', 'UTF-8'), + 'defaultLocale' => env('APP_DEFAULT_LOCALE', 'en_US'), + 'base' => false, + 'dir' => 'src', + 'webroot' => 'webroot', + 'wwwRoot' => WWW_ROOT, + // 'baseUrl' => env('SCRIPT_NAME'), + 'fullBaseUrl' => false, + 'imageBaseUrl' => 'img/', + 'cssBaseUrl' => 'css/', + 'jsBaseUrl' => 'js/', + 'paths' => [ + 'plugins' => [ROOT . DS . 'plugins' . DS], + 'templates' => [APP . 'Template' . DS], + 'locales' => [APP . 'Locale' . DS], + ], + ], + + /** + * Security and encryption configuration + * + * - salt - A random string used in security hashing methods. + * The salt value is also used as the encryption key. + * You should treat it as extremely sensitive data. + */ + 'Security' => [ + 'salt' => env('SECURITY_SALT', 'ea95905936b9dabf97577cf7a4e3ad2db8fdf34b82866df335a49ff8d1d8b0b5'), + ], + + /** + * Apply timestamps with the last modified time to static assets (js, css, images). + * Will append a querystring parameter containing the time the file was modified. + * This is useful for busting browser caches. + * + * Set to true to apply timestamps when debug is true. Set to 'force' to always + * enable timestamping regardless of debug value. + */ + 'Asset' => [ + // 'timestamp' => true, + ], + + /** + * Configure the cache adapters. + */ + 'Cache' => [ + 'default' => [ + 'className' => 'File', + 'path' => CACHE, + 'url' => env('CACHE_DEFAULT_URL', null), + ], + + /** + * Configure the cache used for general framework caching. + * Translation cache files are stored with this configuration. + * Duration will be set to '+2 minutes' in bootstrap.php when debug = true + * If you set 'className' => 'Null' core cache will be disabled. + */ + '_cake_core_' => [ + 'className' => 'File', + 'prefix' => 'myapp_cake_core_', + 'path' => CACHE . 'persistent/', + 'serialize' => true, + 'duration' => '+1 years', + 'url' => env('CACHE_CAKECORE_URL', null), + ], + + /** + * Configure the cache for model and datasource caches. This cache + * configuration is used to store schema descriptions, and table listings + * in connections. + * Duration will be set to '+2 minutes' in bootstrap.php when debug = true + */ + '_cake_model_' => [ + 'className' => 'File', + 'prefix' => 'myapp_cake_model_', + 'path' => CACHE . 'models/', + 'serialize' => true, + 'duration' => '+1 years', + 'url' => env('CACHE_CAKEMODEL_URL', null), + ], + ], + + /** + * Configure the Error and Exception handlers used by your application. + * + * By default errors are displayed using Debugger, when debug is true and logged + * by Cake\Log\Log when debug is false. + * + * In CLI environments exceptions will be printed to stderr with a backtrace. + * In web environments an HTML page will be displayed for the exception. + * With debug true, framework errors like Missing Controller will be displayed. + * When debug is false, framework errors will be coerced into generic HTTP errors. + * + * Options: + * + * - `errorLevel` - int - The level of errors you are interested in capturing. + * - `trace` - boolean - Whether or not backtraces should be included in + * logged errors/exceptions. + * - `log` - boolean - Whether or not you want exceptions logged. + * - `exceptionRenderer` - string - The class responsible for rendering + * uncaught exceptions. If you choose a custom class you should place + * the file for that class in src/Error. This class needs to implement a + * render method. + * - `skipLog` - array - List of exceptions to skip for logging. Exceptions that + * extend one of the listed exceptions will also be skipped for logging. + * E.g.: + * `'skipLog' => ['Cake\Network\Exception\NotFoundException', 'Cake\Network\Exception\UnauthorizedException']` + * - `extraFatalErrorMemory` - int - The number of megabytes to increase + * the memory limit by when a fatal error is encountered. This allows + * breathing room to complete logging or error handling. + */ + 'Error' => [ + 'errorLevel' => E_ALL, + 'exceptionRenderer' => 'Cake\Error\ExceptionRenderer', + 'skipLog' => [], + 'log' => true, + 'trace' => true, + ], + + /** + * Email configuration. + * + * By defining transports separately from delivery profiles you can easily + * re-use transport configuration across multiple profiles. + * + * You can specify multiple configurations for production, development and + * testing. + * + * Each transport needs a `className`. Valid options are as follows: + * + * Mail - Send using PHP mail function + * Smtp - Send using SMTP + * Debug - Do not send the email, just return the result + * + * You can add custom transports (or override existing transports) by adding the + * appropriate file to src/Mailer/Transport. Transports should be named + * 'YourTransport.php', where 'Your' is the name of the transport. + */ + 'EmailTransport' => [ + 'default' => [ + 'className' => 'Mail', + // The following keys are used in SMTP transports + 'host' => 'localhost', + 'port' => 25, + 'timeout' => 30, + 'username' => 'user', + 'password' => 'secret', + 'client' => null, + 'tls' => null, + 'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null), + ], + ], + + /** + * Email delivery profiles + * + * Delivery profiles allow you to predefine various properties about email + * messages from your application and give the settings a name. This saves + * duplication across your application and makes maintenance and development + * easier. Each profile accepts a number of keys. See `Cake\Mailer\Email` + * for more information. + */ + 'Email' => [ + 'default' => [ + 'transport' => 'default', + 'from' => 'you@localhost', + //'charset' => 'utf-8', + //'headerCharset' => 'utf-8', + ], + ], + + /** + * Connection information used by the ORM to connect + * to your application's datastores. + * Do not use periods in database name - it may lead to error. + * See https://github.com/cakephp/cakephp/issues/6471 for details. + * Drivers include Mysql Postgres Sqlite Sqlserver + * See vendor\cakephp\cakephp\src\Database\Driver for complete list + */ + 'Datasources' => [ + 'default' => [ + 'className' => 'Cake\Database\Connection', + 'driver' => 'Cake\Database\Driver\Mysql', + 'persistent' => false, + 'host' => 'localhost', + /** + * CakePHP will use the default DB port based on the driver selected + * MySQL on MAMP uses port 8889, MAMP users will want to uncomment + * the following line and set the port accordingly + */ + //'port' => 'non_standard_port_number', + 'username' => 'cakephp', + 'password' => 'cakephp', + 'database' => 'cakephp', + 'encoding' => 'utf8', + 'timezone' => 'UTC', + 'flags' => [], + 'cacheMetadata' => true, + 'log' => false, + + /** + * Set identifier quoting to true if you are using reserved words or + * special characters in your table or column names. Enabling this + * setting will result in queries built using the Query Builder having + * identifiers quoted when creating SQL. It should be noted that this + * decreases performance because each query needs to be traversed and + * manipulated before being executed. + */ + 'quoteIdentifiers' => false, + + /** + * During development, if using MySQL < 5.6, uncommenting the + * following line could boost the speed at which schema metadata is + * fetched from the database. It can also be set directly with the + * mysql configuration directive 'innodb_stats_on_metadata = 0' + * which is the recommended value in production environments + */ + //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'], + + 'url' => env('DATABASE_URL', null), + ], + + /** + * The test connection is used during the test suite. + */ + 'test' => [ + 'className' => 'Cake\Database\Connection', + 'driver' => 'Cake\Database\Driver\Mysql', + 'persistent' => false, + 'host' => 'localhost', + //'port' => 'non_standard_port_number', + 'username' => 'my_app', + 'password' => 'secret', + 'database' => 'test_myapp', + 'encoding' => 'utf8', + 'timezone' => 'UTC', + 'cacheMetadata' => true, + 'quoteIdentifiers' => false, + 'log' => false, + //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'], + 'url' => env('DATABASE_TEST_URL', null), + ], + ], + + /** + * Configures logging options + */ + 'Log' => [ + 'debug' => [ + 'className' => 'Cake\Log\Engine\FileLog', + 'path' => LOGS, + 'file' => 'debug', + 'levels' => ['notice', 'info', 'debug'], + 'url' => env('LOG_DEBUG_URL', null), + ], + 'error' => [ + 'className' => 'Cake\Log\Engine\FileLog', + 'path' => LOGS, + 'file' => 'error', + 'levels' => ['warning', 'error', 'critical', 'alert', 'emergency'], + 'url' => env('LOG_ERROR_URL', null), + ], + ], + + /** + * Session configuration. + * + * Contains an array of settings to use for session configuration. The + * `defaults` key is used to define a default preset to use for sessions, any + * settings declared here will override the settings of the default config. + * + * ## Options + * + * - `cookie` - The name of the cookie to use. Defaults to 'CAKEPHP'. + * - `cookiePath` - The url path for which session cookie is set. Maps to the + * `session.cookie_path` php.ini config. Defaults to base path of app. + * - `timeout` - The time in minutes the session should be valid for. + * Pass 0 to disable checking timeout. + * Please note that php.ini's session.gc_maxlifetime must be equal to or greater + * than the largest Session['timeout'] in all served websites for it to have the + * desired effect. + * - `defaults` - The default configuration set to use as a basis for your session. + * There are four built-in options: php, cake, cache, database. + * - `handler` - Can be used to enable a custom session handler. Expects an + * array with at least the `engine` key, being the name of the Session engine + * class to use for managing the session. CakePHP bundles the `CacheSession` + * and `DatabaseSession` engines. + * - `ini` - An associative array of additional ini values to set. + * + * The built-in `defaults` options are: + * + * - 'php' - Uses settings defined in your php.ini. + * - 'cake' - Saves session files in CakePHP's /tmp directory. + * - 'database' - Uses CakePHP's database sessions. + * - 'cache' - Use the Cache class to save sessions. + * + * To define a custom session handler, save it at src/Network/Session/.php. + * Make sure the class implements PHP's `SessionHandlerInterface` and set + * Session.handler to + * + * To use database sessions, load the SQL file located at config/Schema/sessions.sql + */ + 'Session' => [ + 'defaults' => 'php', + ], +]; diff --git a/playbooks/roles/cakephp/templates/composer.json.j2 b/playbooks/roles/cakephp/templates/composer.json.j2 new file mode 100644 index 0000000..a440cf7 --- /dev/null +++ b/playbooks/roles/cakephp/templates/composer.json.j2 @@ -0,0 +1,54 @@ +{ + "name": "cakephp/app", + "description": "CakePHP skeleton app", + "homepage": "http://cakephp.org", + "type": "project", + "license": "MIT", + "require": { + "php": "^7.0", + "cakephp/cakephp": "^3.4", + "mobiledetect/mobiledetectlib": "^2.0", + "cakephp/migrations": "^1.0", + "cakephp/plugin-installer": "^1.0", + "zurb/foundation": "^6.0", + "components/normalize.css": "^3.0", + "components/jquery": "^3.2", + "components/modernizr": "^2.8" + + }, + "require-dev": { + "psy/psysh": "@stable", + "cakephp/debug_kit": "^3.2", + "cakephp/bake": "^1.1" + }, + "suggest": { + "markstory/asset_compress": "An asset compression plugin which provides file concatenation and a flexible filter system for preprocessing and minification.", + "dereuromark/cakephp-ide-helper": "After baking your code, this keeps your annotations in sync with the code evolving from there on for maximum IDE and PHPStan compatibility.", + "phpunit/phpunit": "Allows automated tests to be run without system-wide install.", + "cakephp/cakephp-codesniffer": "Allows to check the code against the coding standards used in CakePHP." + }, + "autoload": { + "psr-4": { + "App\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "App\\Test\\": "tests", + "Cake\\Test\\": "./vendor/cakephp/cakephp/tests" + } + }, + "scripts": { + "post-install-cmd": "App\\Console\\Installer::postInstall", + "post-create-project-cmd": "App\\Console\\Installer::postInstall", + "post-autoload-dump": "Cake\\Composer\\Installer\\PluginInstaller::postAutoloadDump", + "check": [ + "@test", + "@cs-check" + ], + "cs-check": "phpcs --colors -p --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests", + "cs-fix": "phpcbf --colors --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests", + "test": "phpunit --colors=always" + }, + "prefer-stable": true +} diff --git a/playbooks/roles/cakephp/templates/custom.js.j2 b/playbooks/roles/cakephp/templates/custom.js.j2 new file mode 100644 index 0000000..26ed47e --- /dev/null +++ b/playbooks/roles/cakephp/templates/custom.js.j2 @@ -0,0 +1,3 @@ +$(function(){ + $(document).foundation(); +}); \ No newline at end of file diff --git a/playbooks/roles/cakephp/templates/default.ctp.j2 b/playbooks/roles/cakephp/templates/default.ctp.j2 new file mode 100644 index 0000000..cb85870 --- /dev/null +++ b/playbooks/roles/cakephp/templates/default.ctp.j2 @@ -0,0 +1,57 @@ + + + + + Html->charset() ?> + + + <?= $cakeDescription ?>: + <?= $this->fetch('title') ?> + + Html->meta('icon') ?> + + Html->css('main.css') ?> + + + fetch('meta') ?> + fetch('css') ?> + fetch('script') ?> + + + + Flash->render() ?> +
+ fetch('content') ?> +
+
+
+ + diff --git a/playbooks/roles/cakephp/templates/gruntfile.js.j2 b/playbooks/roles/cakephp/templates/gruntfile.js.j2 new file mode 100644 index 0000000..615bd21 --- /dev/null +++ b/playbooks/roles/cakephp/templates/gruntfile.js.j2 @@ -0,0 +1,108 @@ +module.exports = function(grunt){ + + require("matchdep").filterDev("grunt-*").forEach(grunt.loadNpmTasks); + + // grunt.registerTask('default', ['jshint', 'uglify', 'copyto', 'smushit', 'phplint']); + grunt.registerTask('default', ['uglify', 'sass', 'autoprefixer']); + + + grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + + watch: { + js: { + files: ['webroot/js/main.js'], + tasks: ['uglify'] + }, + css: { + files: ['webroot/scss/*'], + tasks: ['sass', 'autoprefixer'] + } + // img: { + // files: ['app/webroot/img/*.png', 'app/webroot/img/*.jpg'], + // tasks: ['smushit'] + // }, + // php: { + // files: ['**/*.php'], + // tasks: ['phplint'], + // options: { + // nospawn: true, + // }, + // } + }, + + //JavaScript + // jshint: { + // all: ['html/js/jquery.dev.js'] + // }, + + uglify: { + options: { + mangle: true, + compress: { + drop_console: true + } + }, + build: { + files: [ + {'/vagrant/cakephp/webroot/js/main.js': [ + '/vagrant/cakephp/vendor/components/jquery/jquery.js', + '/vagrant/cakephp/vendor/zurb/foundation/dist/js/foundation.js', + '/vagrant/cakephp/vendor/zurb/foundation/dist/js/plugins/foundation.core.min.js', + '/vagrant/cakephp/vendor/zurb/foundation/dist/js/plugins/foundation.util.*.min.js', + '/vagrant/cakephp/vendor/zurb/foundation/dist/js/plugins/foundation!(.util.|.zf.|.core)*.min.js', + '/vagrant/cakephp/vendor/components/modernizr/modernizr.js', + '/vagrant/cakephp/webroot/js/custom.js' + ]} + ] + } + }, + autoprefixer: { + options: { + browsers: [ + "> 1%", + "last 2 versions", + "ie >= 9", + "opera >= 10", + "Android >= 2.3" + ] + }, + files: { + src: ["webroot/css/custom.css"] + } + }, + //CSS + sass: { + options: { + loadPath: ['vendor/zurb/foundation/scss', 'node_modules/foundation-icons'], + style : 'expanded' + + }, + dev: { + files: [{ + expand: true, + cwd: 'webroot/scss', + src: ['*.scss'], + dest: 'webroot/css/', + ext: '.css' + }] + /*files : {'/vagrant/cakephp/webroot/css/main.css' : [ +// '/vagrant/cakephp/vendor/components/normalize.css/normalize.css', + 'vendor/zurb/foundation/scss/foundation.scss' +// '/vagrant/cakephp/webroot/css/cake.css', +// '/vagrant/cakephp/webroot/css/home.css', +// '/vagrant/cakephp/webroot/sass/*.sass' + ] + }*/ + } + } +}); + + + // Event handling + // grunt.event.on('watch', function(action, filepath) { + // //only lint the changed file + // grunt.config(['phplint', 'all'], filepath); + // }); + +}; \ No newline at end of file diff --git a/playbooks/roles/cakephp/templates/home.ctp.j2.ctp b/playbooks/roles/cakephp/templates/home.ctp.j2.ctp new file mode 100644 index 0000000..467ee98 --- /dev/null +++ b/playbooks/roles/cakephp/templates/home.ctp.j2.ctp @@ -0,0 +1,274 @@ +layout = false; + +if (!Configure::read('debug')): + throw new NotFoundException('Please replace src/Template/Pages/home.ctp with your own version.'); +endif; + +$cakeDescription = 'CakePHP: the rapid development PHP framework'; +?> + + + + Html->charset() ?> + + + <?= $cakeDescription ?> + + + Html->meta('icon') ?> + Html->css('main.css') ?> + + + + +
+
Html->image('cake.logo.svg') ?>
+
+

Welcome to CakePHP Red Velvet. Build fast. Grow solid.

+
+
+ +
+
+
+

Please be aware that this page will not be shown if you turn off debug mode unless you replace src/Template/Pages/home.ctp with your own version.

+
+
+ +
+ +
+
+ +
+
+

Environment

+
    + =')): ?> +
  • Your version of PHP is 5.6.0 or higher (detected ).
  • + +
  • Your version of PHP is too low. You need PHP 5.6.0 or higher to use CakePHP (detected ).
  • + + + +
  • Your version of PHP has the mbstring extension loaded.
  • + +
  • Your version of PHP does NOT have the mbstring extension loaded.
  • ; + + + +
  • Your version of PHP has the openssl extension loaded.
  • + +
  • Your version of PHP has the mcrypt extension loaded.
  • + +
  • Your version of PHP does NOT have the openssl or mcrypt extension loaded.
  • + + + +
  • Your version of PHP has the intl extension loaded.
  • + +
  • Your version of PHP does NOT have the intl extension loaded.
  • + +
+
+
+

Filesystem

+
    + +
  • Your tmp directory is writable.
  • + +
  • Your tmp directory is NOT writable.
  • + + + +
  • Your logs directory is writable.
  • + +
  • Your logs directory is NOT writable.
  • + + + + +
  • The Engine is being used for core caching. To change the config edit config/app.php
  • + +
  • Your cache is NOT working. Please check the settings in config/app.php
  • + +
+
+
+
+ +
+
+

Database

+ connect(); + } catch (Exception $connectionError) { + $connected = false; + $errorMsg = $connectionError->getMessage(); + if (method_exists($connectionError, 'getAttributes')): + $attributes = $connectionError->getAttributes(); + if (isset($errorMsg['message'])): + $errorMsg .= '
' . $attributes['message']; + endif; + endif; + } + ?> +
    + +
  • CakePHP is able to connect to the database.
  • + +
  • CakePHP is NOT able to connect to the database.
  • + +
+
+
+

DebugKit

+
    + +
  • DebugKit is loaded.
  • + +
  • DebugKit is NOT loaded. You need to either install pdo_sqlite, or define the "debug_kit" connection name.
  • + +
+
+
+
+ +
+
+

Editing this Page

+
    +
  • To change the content of this page, edit: src/Template/Pages/home.ctp.
  • +
  • You can also add some CSS styles for your pages at: webroot/css/.
  • +
+
+ +
+ +
+
+

More about Cake

+

+ CakePHP is a rapid development framework for PHP which uses commonly known design patterns like Front Controller and MVC.
+ Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility. +

+
+
+
+ +
+
+ P +

Help and Bug Reports

+ +
+
+ r +

Docs and Downloads

+ +
+
+ s +

Training and Certification

+ +
+
+ + + diff --git a/playbooks/roles/cakephp/templates/main.scss.j2 b/playbooks/roles/cakephp/templates/main.scss.j2 new file mode 100644 index 0000000..49afb98 --- /dev/null +++ b/playbooks/roles/cakephp/templates/main.scss.j2 @@ -0,0 +1,65 @@ +// Vendor Files +@import 'settings/settings'; +@import 'foundation'; + +/* All of Foundation */ + +@include foundation-everything; +/* Or cherry pick your options */ + + +// @include foundation-global-styles; +// @include foundation-grid; +// @include foundation-flex-grid; +// @include foundation-flex-classes; +// @include foundation-typography; +// @include foundation-forms; +// @include foundation-button; +// @include foundation-accordion; +// @include foundation-accordion-menu; +// @include foundation-badge; +// @include foundation-breadcrumbs; +// @include foundation-button-group; +// @include foundation-callout; +// @include foundation-card; +// @include foundation-close-button; +// @include foundation-menu; +// @include foundation-menu-icon; +// @include foundation-drilldown-menu; +// @include foundation-dropdown; +// @include foundation-dropdown-menu; +// @include foundation-responsive-embed; +// @include foundation-label; +// @include foundation-media-object; +// @include foundation-off-canvas; +// @include foundation-orbit; +// @include foundation-pagination; +// @include foundation-progress-bar; +// @include foundation-slider; +// @include foundation-sticky; +// @include foundation-reveal; +// @include foundation-switch; +// @include foundation-table; +// @include foundation-tabs; +// @include foundation-thumbnail; +// @include foundation-title-bar; +// @include foundation-tooltip; +// @include foundation-top-bar; +// @include foundation-visibility-classes; +// @include foundation-float-classes; + + +@import 'foundation-icons'; +@font-face { + font-family: 'foundation-icons'; + src: url('/font/foundation-icons/foundation-icons.eot'); + src: url('/font/foundation-icons/foundation-icons.eot?#iefix') format('embedded-opentype'), + url('/font/foundation-icons/foundation-icons.woff') format('woff'), + url('/font/foundation-icons/foundation-icons.ttf') format('truetype'), + url('/font/foundation-icons/foundation-icons.svg#fontcustom') format('svg'); + font-weight: normal; + font-style: normal; +} +/* Custom SCSS (SASS) */ + +select { -webkit-appearance:none; } /* Fix the double dropdown arrows in Chrome */ \ No newline at end of file diff --git a/playbooks/roles/cakephp/templates/nginx.conf.j2 b/playbooks/roles/cakephp/templates/nginx.conf.j2 new file mode 100644 index 0000000..28f4c77 --- /dev/null +++ b/playbooks/roles/cakephp/templates/nginx.conf.j2 @@ -0,0 +1,41 @@ +server { + listen 8083 default_server ssl; + listen [::]:8083 default_server ssl ipv6only=on; + + server_name 192.168.50.4; + + root {{ document_root }}/cakephp/webroot; + index index.php index.html index.htm; + charset utf-8; + + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + location = /favicon.ico { access_log off; log_not_found off; } + location = /robots.txt { access_log off; log_not_found off; } + + sendfile off; + client_max_body_size 100m; + + location ~ \.php$ { + try_files $uri /index.php =404; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass unix:/var/run/php7-cakephp.sock; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include fastcgi_params; + } + + location ~ /\.ht { + deny all; + } + + error_log /var/log/nginx/cakephp_error.log; + access_log /var/log/nginx/cakephp_access.log; + + ssl_certificate /etc/ssl/certs/ssl.crt; + ssl_certificate_key /etc/ssl/private/ssl.key; + + error_page 497 https://$host:8083$request_uri; +} diff --git a/playbooks/roles/cakephp/templates/package.json.j2 b/playbooks/roles/cakephp/templates/package.json.j2 new file mode 100644 index 0000000..5d737f3 --- /dev/null +++ b/playbooks/roles/cakephp/templates/package.json.j2 @@ -0,0 +1,13 @@ +{ + "name": "cakephp-app", + "version": "0.1.0", + "devDependencies": { + "grunt": "^1.0.0", + "grunt-contrib-uglify": "^3.0", + "grunt-contrib-watch": "^1.0", + "grunt-contrib-sass": "^1.0", + "matchdep": "*", + "grunt-autoprefixer": "^3.0", + "foundation-icons" : "*" + } +} diff --git a/playbooks/roles/cakephp/templates/php-fpm.conf.j2 b/playbooks/roles/cakephp/templates/php-fpm.conf.j2 new file mode 100644 index 0000000..1f19cd6 --- /dev/null +++ b/playbooks/roles/cakephp/templates/php-fpm.conf.j2 @@ -0,0 +1,392 @@ +; Start a new pool named 'www'. +; the variable $pool can we used in any directive and will be replaced by the +; pool name ('www' here) +[cakephp] + +; Per pool prefix +; It only applies on the following directives: +; - 'slowlog' +; - 'listen' (unixsocket) +; - 'chroot' +; - 'chdir' +; - 'php_values' +; - 'php_admin_values' +; When not set, the global prefix (or /usr) applies instead. +; Note: This directive can also be relative to the global prefix. +; Default Value: none +;prefix = /path/to/pools/$pool + +; Unix user/group of processes +; Note: The user is mandatory. If the group is not set, the default user's group +; will be used. +user = {{ www_user }} +group = {{ www_group }} + +; The address on which to accept FastCGI requests. +; Valid syntaxes are: +; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on +; a specific port; +; 'port' - to listen on a TCP socket to all addresses on a +; specific port; +; '/path/to/unix/socket' - to listen on a unix socket. +; Note: This value is mandatory. +listen = /var/run/php7-cakephp.sock + +; Set listen(2) backlog. +; Default Value: 65535 (-1 on FreeBSD and OpenBSD) +;listen.backlog = 65535 + +; Set permissions for unix socket, if one is used. In Linux, read/write +; permissions must be set in order to allow connections from a web server. Many +; BSD-derived systems allow connections regardless of permissions. +; Default Values: user and group are set as the running user +; mode is set to 0660 +listen.owner = {{ www_user }} +listen.group = {{ www_group }} +;listen.mode = 0660 + +; List of ipv4 addresses of FastCGI clients which are allowed to connect. +; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original +; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address +; must be separated by a comma. If this value is left blank, connections will be +; accepted from any ip address. +; Default Value: any +;listen.allowed_clients = 127.0.0.1 + +; Specify the nice(2) priority to apply to the pool processes (only if set) +; The value can vary from -19 (highest priority) to 20 (lower priority) +; Note: - It will only work if the FPM master process is launched as root +; - The pool processes will inherit the master process priority +; unless it specified otherwise +; Default Value: no set +; priority = -19 + +; Choose how the process manager will control the number of child processes. +; Possible Values: +; static - a fixed number (pm.max_children) of child processes; +; dynamic - the number of child processes are set dynamically based on the +; following directives. With this process management, there will be +; always at least 1 children. +; pm.max_children - the maximum number of children that can +; be alive at the same time. +; pm.start_servers - the number of children created on startup. +; pm.min_spare_servers - the minimum number of children in 'idle' +; state (waiting to process). If the number +; of 'idle' processes is less than this +; number then some children will be created. +; pm.max_spare_servers - the maximum number of children in 'idle' +; state (waiting to process). If the number +; of 'idle' processes is greater than this +; number then some children will be killed. +; ondemand - no children are created at startup. Children will be forked when +; new requests will connect. The following parameter are used: +; pm.max_children - the maximum number of children that +; can be alive at the same time. +; pm.process_idle_timeout - The number of seconds after which +; an idle process will be killed. +; Note: This value is mandatory. +pm = dynamic + +; The number of child processes to be created when pm is set to 'static' and the +; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. +; This value sets the limit on the number of simultaneous requests that will be +; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. +; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP +; CGI. The below defaults are based on a server without much resources. Don't +; forget to tweak pm.* to fit your needs. +; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' +; Note: This value is mandatory. +pm.max_children = 5 + +; The number of child processes created on startup. +; Note: Used only when pm is set to 'dynamic' +; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 +pm.start_servers = 2 + +; The desired minimum number of idle server processes. +; Note: Used only when pm is set to 'dynamic' +; Note: Mandatory when pm is set to 'dynamic' +pm.min_spare_servers = 1 + +; The desired maximum number of idle server processes. +; Note: Used only when pm is set to 'dynamic' +; Note: Mandatory when pm is set to 'dynamic' +pm.max_spare_servers = 3 + +; The number of seconds after which an idle process will be killed. +; Note: Used only when pm is set to 'ondemand' +; Default Value: 10s +;pm.process_idle_timeout = 10s; + +; The number of requests each child process should execute before respawning. +; This can be useful to work around memory leaks in 3rd party libraries. For +; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. +; Default Value: 0 +;pm.max_requests = 500 + +; The URI to view the FPM status page. If this value is not set, no URI will be +; recognized as a status page. It shows the following informations: +; pool - the name of the pool; +; process manager - static, dynamic or ondemand; +; start time - the date and time FPM has started; +; start since - number of seconds since FPM has started; +; accepted conn - the number of request accepted by the pool; +; listen queue - the number of request in the queue of pending +; connections (see backlog in listen(2)); +; max listen queue - the maximum number of requests in the queue +; of pending connections since FPM has started; +; listen queue len - the size of the socket queue of pending connections; +; idle processes - the number of idle processes; +; active processes - the number of active processes; +; total processes - the number of idle + active processes; +; max active processes - the maximum number of active processes since FPM +; has started; +; max children reached - number of times, the process limit has been reached, +; when pm tries to start more children (works only for +; pm 'dynamic' and 'ondemand'); +; Value are updated in real time. +; Example output: +; pool: www +; process manager: static +; start time: 01/Jul/2011:17:53:49 +0200 +; start since: 62636 +; accepted conn: 190460 +; listen queue: 0 +; max listen queue: 1 +; listen queue len: 42 +; idle processes: 4 +; active processes: 11 +; total processes: 15 +; max active processes: 12 +; max children reached: 0 +; +; By default the status page output is formatted as text/plain. Passing either +; 'html', 'xml' or 'json' in the query string will return the corresponding +; output syntax. Example: +; http://www.foo.bar/status +; http://www.foo.bar/status?json +; http://www.foo.bar/status?html +; http://www.foo.bar/status?xml +; +; By default the status page only outputs short status. Passing 'full' in the +; query string will also return status for each pool process. +; Example: +; http://www.foo.bar/status?full +; http://www.foo.bar/status?json&full +; http://www.foo.bar/status?html&full +; http://www.foo.bar/status?xml&full +; The Full status returns for each process: +; pid - the PID of the process; +; state - the state of the process (Idle, Running, ...); +; start time - the date and time the process has started; +; start since - the number of seconds since the process has started; +; requests - the number of requests the process has served; +; request duration - the duration in µs of the requests; +; request method - the request method (GET, POST, ...); +; request URI - the request URI with the query string; +; content length - the content length of the request (only with POST); +; user - the user (PHP_AUTH_USER) (or '-' if not set); +; script - the main script called (or '-' if not set); +; last request cpu - the %cpu the last request consumed +; it's always 0 if the process is not in Idle state +; because CPU calculation is done when the request +; processing has terminated; +; last request memory - the max amount of memory the last request consumed +; it's always 0 if the process is not in Idle state +; because memory calculation is done when the request +; processing has terminated; +; If the process is in Idle state, then informations are related to the +; last request the process has served. Otherwise informations are related to +; the current request being served. +; Example output: +; ************************ +; pid: 31330 +; state: Running +; start time: 01/Jul/2011:17:53:49 +0200 +; start since: 63087 +; requests: 12808 +; request duration: 1250261 +; request method: GET +; request URI: /test_mem.php?N=10000 +; content length: 0 +; user: - +; script: /home/fat/web/docs/php/test_mem.php +; last request cpu: 0.00 +; last request memory: 0 +; +; Note: There is a real-time FPM status monitoring sample web page available +; It's available in: ${prefix}/share/fpm/status.html +; +; Note: The value must start with a leading slash (/). The value can be +; anything, but it may not be a good idea to use the .php extension or it +; may conflict with a real PHP file. +; Default Value: not set +;pm.status_path = /status + +; The ping URI to call the monitoring page of FPM. If this value is not set, no +; URI will be recognized as a ping page. This could be used to test from outside +; that FPM is alive and responding, or to +; - create a graph of FPM availability (rrd or such); +; - remove a server from a group if it is not responding (load balancing); +; - trigger alerts for the operating team (24/7). +; Note: The value must start with a leading slash (/). The value can be +; anything, but it may not be a good idea to use the .php extension or it +; may conflict with a real PHP file. +; Default Value: not set +;ping.path = /ping + +; This directive may be used to customize the response of a ping request. The +; response is formatted as text/plain with a 200 response code. +; Default Value: pong +;ping.response = pong + +; The access log file +; Default: not set +;access.log = log/$pool.access.log + +; The access log format. +; The following syntax is allowed +; %%: the '%' character +; %C: %CPU used by the request +; it can accept the following format: +; - %{user}C for user CPU only +; - %{system}C for system CPU only +; - %{total}C for user + system CPU (default) +; %d: time taken to serve the request +; it can accept the following format: +; - %{seconds}d (default) +; - %{miliseconds}d +; - %{mili}d +; - %{microseconds}d +; - %{micro}d +; %e: an environment variable (same as $_ENV or $_SERVER) +; it must be associated with embraces to specify the name of the env +; variable. Some exemples: +; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e +; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e +; %f: script filename +; %l: content-length of the request (for POST request only) +; %m: request method +; %M: peak of memory allocated by PHP +; it can accept the following format: +; - %{bytes}M (default) +; - %{kilobytes}M +; - %{kilo}M +; - %{megabytes}M +; - %{mega}M +; %n: pool name +; %o: output header +; it must be associated with embraces to specify the name of the header: +; - %{Content-Type}o +; - %{X-Powered-By}o +; - %{Transfert-Encoding}o +; - .... +; %p: PID of the child that serviced the request +; %P: PID of the parent of the child that serviced the request +; %q: the query string +; %Q: the '?' character if query string exists +; %r: the request URI (without the query string, see %q and %Q) +; %R: remote IP address +; %s: status (response code) +; %t: server time the request was received +; it can accept a strftime(3) format: +; %d/%b/%Y:%H:%M:%S %z (default) +; %T: time the log has been written (the request has finished) +; it can accept a strftime(3) format: +; %d/%b/%Y:%H:%M:%S %z (default) +; %u: remote user +; +; Default: "%R - %u %t \"%m %r\" %s" +;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" + +; The log file for slow requests +; Default Value: not set +; Note: slowlog is mandatory if request_slowlog_timeout is set +;slowlog = log/$pool.log.slow + +; The timeout for serving a single request after which a PHP backtrace will be +; dumped to the 'slowlog' file. A value of '0s' means 'off'. +; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) +; Default Value: 0 +;request_slowlog_timeout = 0 + +; The timeout for serving a single request after which the worker process will +; be killed. This option should be used when the 'max_execution_time' ini option +; does not stop script execution for some reason. A value of '0' means 'off'. +; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) +; Default Value: 0 +;request_terminate_timeout = 0 + +; Set open file descriptor rlimit. +; Default Value: system defined value +;rlimit_files = 1024 + +; Set max core size rlimit. +; Possible Values: 'unlimited' or an integer greater or equal to 0 +; Default Value: system defined value +;rlimit_core = 0 + +; Chroot to this directory at the start. This value must be defined as an +; absolute path. When this value is not set, chroot is not used. +; Note: you can prefix with '$prefix' to chroot to the pool prefix or one +; of its subdirectories. If the pool prefix is not set, the global prefix +; will be used instead. +; Note: chrooting is a great security feature and should be used whenever +; possible. However, all PHP paths will be relative to the chroot +; (error_log, sessions.save_path, ...). +; Default Value: not set +;chroot = + +; Chdir to this directory at the start. +; Note: relative path can be used. +; Default Value: current directory or / when chroot +chdir = / + +; Redirect worker stdout and stderr into main error log. If not set, stdout and +; stderr will be redirected to /dev/null according to FastCGI specs. +; Note: on highloaded environement, this can cause some delay in the page +; process time (several ms). +; Default Value: no +;catch_workers_output = yes + +; Limits the extensions of the main script FPM will allow to parse. This can +; prevent configuration mistakes on the web server side. You should only limit +; FPM to .php extensions to prevent malicious users to use other extensions to +; exectute php code. +; Note: set an empty value to allow all extensions. +; Default Value: .php +;security.limit_extensions = .php .php3 .php4 .php5 + +; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from +; the current environment. +; Default Value: clean env +;env[HOSTNAME] = $HOSTNAME +;env[PATH] = /usr/local/bin:/usr/bin:/bin +;env[TMP] = /tmp +;env[TMPDIR] = /tmp +;env[TEMP] = /tmp + +; Additional php.ini defines, specific to this pool of workers. These settings +; overwrite the values previously defined in the php.ini. The directives are the +; same as the PHP SAPI: +; php_value/php_flag - you can set classic ini defines which can +; be overwritten from PHP call 'ini_set'. +; php_admin_value/php_admin_flag - these directives won't be overwritten by +; PHP call 'ini_set' +; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. + +; Defining 'extension' will load the corresponding shared extension from +; extension_dir. Defining 'disable_functions' or 'disable_classes' will not +; overwrite previously defined php.ini values, but will append the new value +; instead. + +; Note: path INI options can be relative and will be expanded with the prefix +; (pool, global or /usr) + +; Default Value: nothing is defined by default except the values in php.ini and +; specified at startup with the -d argument +;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com +;php_flag[display_errors] = off +;php_admin_value[error_log] = /var/log/fpm-php.www.log +;php_admin_flag[log_errors] = on +;php_admin_value[memory_limit] = 32M diff --git a/playbooks/roles/cakephp/templates/rc.local.j2 b/playbooks/roles/cakephp/templates/rc.local.j2 new file mode 100644 index 0000000..36ba989 --- /dev/null +++ b/playbooks/roles/cakephp/templates/rc.local.j2 @@ -0,0 +1,3 @@ +#!/bin/bash +cd /vagrant/cakephp +sudo -u vagrant grunt watch \ No newline at end of file diff --git a/playbooks/roles/laravel-quickstart/templates/nginx.conf.j2 b/playbooks/roles/laravel-quickstart/templates/nginx.conf.j2 index 7ee4e3d..765efc1 100644 --- a/playbooks/roles/laravel-quickstart/templates/nginx.conf.j2 +++ b/playbooks/roles/laravel-quickstart/templates/nginx.conf.j2 @@ -1,6 +1,6 @@ server { - listen 8082 default_server; - listen [::]:8082 default_server ipv6only=on; + listen 8082 default_server ssl; + listen [::]:8082 default_server ssl ipv6only=on; server_name 192.168.50.4; @@ -21,7 +21,7 @@ server { location ~ \.php$ { try_files $uri /index.php =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass unix:/var/run/php5-laravel.sock; + fastcgi_pass unix:/var/run/php7-laravel.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; @@ -33,4 +33,9 @@ server { error_log /var/log/nginx/laravel_error.log; access_log /var/log/nginx/laravel_access.log; + + ssl_certificate /etc/ssl/certs/ssl.crt; + ssl_certificate_key /etc/ssl/private/ssl.key; + + error_page 497 https://$host:8082$request_uri; } \ No newline at end of file diff --git a/playbooks/roles/laravel-quickstart/templates/php-fpm.conf.j2 b/playbooks/roles/laravel-quickstart/templates/php-fpm.conf.j2 index f7966cc..98f8ac5 100644 --- a/playbooks/roles/laravel-quickstart/templates/php-fpm.conf.j2 +++ b/playbooks/roles/laravel-quickstart/templates/php-fpm.conf.j2 @@ -30,7 +30,7 @@ group = {{ www_group }} ; specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /var/run/php5-laravel.sock +listen = /var/run/php7-laravel.sock ; Set listen(2) backlog. ; Default Value: 65535 (-1 on FreeBSD and OpenBSD) diff --git a/playbooks/roles/nginx/tasks/main.yml b/playbooks/roles/nginx/tasks/main.yml index b48b1c5..6ef02f0 100644 --- a/playbooks/roles/nginx/tasks/main.yml +++ b/playbooks/roles/nginx/tasks/main.yml @@ -14,4 +14,19 @@ path=/etc/nginx/sites-enabled/default state=absent notify: - - restart nginx \ No newline at end of file + - restart nginx + +- name: Copy across OpenSSL Script + template: + src=create_ssl.sh.j2 + dest=/vagrant/create_ssl.sh + +- name: Sign Certificate + script: /vagrant/create_ssl.sh + notify: + - restart nginx + +- name: Remove default virtual host + file: + path=/vagrant/create_ssl.sh + state=absent diff --git a/playbooks/roles/nginx/templates/create_ssl.sh.j2 b/playbooks/roles/nginx/templates/create_ssl.sh.j2 new file mode 100644 index 0000000..d368a02 --- /dev/null +++ b/playbooks/roles/nginx/templates/create_ssl.sh.j2 @@ -0,0 +1,2 @@ +#!/bin/bash +openssl req -reqexts SAN -extensions SAN -config <(cat /etc/ssl/openssl.cnf <(printf "\n[SAN]\nsubjectAltName=IP:192.168.50.4,DNS:dev.local:8083\n")) -x509 -newkey rsa:4096 -sha256 -nodes -keyout /etc/ssl/private/ssl.key -out /etc/ssl/certs/ssl.crt -subj "/CN=192.168.50.4:8081/CN=192.168.50.4:8082/CN=192.168.50.4:8083" -days 3650 \ No newline at end of file diff --git a/playbooks/roles/nginx/templates/nginx.conf.j2 b/playbooks/roles/nginx/templates/nginx.conf.j2 index fdbdf3b..2aa8bff 100644 --- a/playbooks/roles/nginx/templates/nginx.conf.j2 +++ b/playbooks/roles/nginx/templates/nginx.conf.j2 @@ -40,12 +40,12 @@ http { gzip on; gzip_disable "msie6"; - # gzip_vary on; - # gzip_proxied any; - # gzip_comp_level 6; - # gzip_buffers 16 8k; - # gzip_http_version 1.1; - # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; + gzip_vary on; + gzip_proxied any; + gzip_comp_level 6; + gzip_buffers 16 8k; + gzip_http_version 1.1; + gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; ## # nginx-naxsi config diff --git a/playbooks/roles/symfony-standard/templates/nginx.conf.j2 b/playbooks/roles/symfony-standard/templates/nginx.conf.j2 index 5424507..4efec34 100644 --- a/playbooks/roles/symfony-standard/templates/nginx.conf.j2 +++ b/playbooks/roles/symfony-standard/templates/nginx.conf.j2 @@ -1,6 +1,6 @@ server { - listen 8081 default_server; - listen [::]:8081 default_server ipv6only=on; + listen 8081 default_server ssl; + listen [::]:8081 default_server ssl ipv6only=on; server_name 192.168.50.4; root {{ document_root }}/symfony-standard/web; @@ -11,7 +11,7 @@ server { } location ~ ^/app\.php(/|$) { - fastcgi_pass unix:/var/run/php5-symfony.sock; + fastcgi_pass unix:/var/run/php7-symfony.sock; fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; @@ -23,4 +23,9 @@ server { error_log /var/log/nginx/symfony_error.log; access_log /var/log/nginx/symfony_access.log; + + ssl_certificate /etc/ssl/certs/ssl.crt; + ssl_certificate_key /etc/ssl/private/ssl.key; + + error_page 497 https://$host:8081$request_uri; } diff --git a/playbooks/roles/symfony-standard/templates/php-fpm.conf.j2 b/playbooks/roles/symfony-standard/templates/php-fpm.conf.j2 index f5f6450..10ff4e5 100644 --- a/playbooks/roles/symfony-standard/templates/php-fpm.conf.j2 +++ b/playbooks/roles/symfony-standard/templates/php-fpm.conf.j2 @@ -30,7 +30,7 @@ group = {{ www_group }} ; specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /var/run/php5-symfony.sock +listen = /var/run/php7-symfony.sock ; Set listen(2) backlog. ; Default Value: 65535 (-1 on FreeBSD and OpenBSD) diff --git a/playbooks/roles/wordpress/meta/main.yml b/playbooks/roles/wordpress/meta/main.yml new file mode 100644 index 0000000..14db65e --- /dev/null +++ b/playbooks/roles/wordpress/meta/main.yml @@ -0,0 +1,6 @@ +--- +dependencies: + - { role: base } + - { role: mysql } + - { role: php-fpm } + - { role: nginx } \ No newline at end of file diff --git a/playbooks/roles/wordpress/tasks/main.yml b/playbooks/roles/wordpress/tasks/main.yml new file mode 100644 index 0000000..4879de8 --- /dev/null +++ b/playbooks/roles/wordpress/tasks/main.yml @@ -0,0 +1,55 @@ +--- +- name: Create MySQL database for Wordpress + mysql_db: name=wordpress state=present + +- name: Create MySQL user for Wordpress + mysql_user: name=wordpress password=wordpress priv=*.*:ALL state=present + +- name: Download wordpress + command: curl -O https://wordpress.org/latest.tar.gz + args: + chdir: /tmp/ + become: true + become_user: "{{ www_user }}" + +- name: Unpack wordpress + command: tar -zxf latest.tar.gz -C /vagrant/ + args: + chdir: /tmp/ + creates: /vagrant/wordpress + become: true + become_user: "{{ www_user }}" + +- name: Fetch random salts for WordPress config + local_action: command curl https://api.wordpress.org/secret-key/1.1/salt/ + register: "wp_salt" + become: no + +- name: Copy across new wp-config.php + template: + src=wp-config.php.j2 + dest=/vagrant/wordpress/wp-config.php + become: true + become_user: "{{ www_user }}" + +- name: Copy across new php-fpm pool config for Wordpress + template: + src=php-fpm.conf.j2 + dest=/etc/php/{{ php_version }}/fpm/pool.d/wordpress.conf + notify: + - restart php-fpm + +- name: Copy across new virtual host for Wordpress + template: + src=nginx.conf.j2 + dest=/etc/nginx/sites-available/wordpress.conf + notify: + - restart nginx + +- name: Enable new vagrant virtual host for Wordpress + file: + src=/etc/nginx/sites-available/wordpress.conf + dest=/etc/nginx/sites-enabled/wordpress.conf + state=link + notify: + - restart nginx diff --git a/playbooks/roles/wordpress/templates/.env.j2 b/playbooks/roles/wordpress/templates/.env.j2 new file mode 100644 index 0000000..ae41aa5 --- /dev/null +++ b/playbooks/roles/wordpress/templates/.env.j2 @@ -0,0 +1,24 @@ +APP_ENV=local +APP_DEBUG=true +APP_KEY=a0888cfd6538f2ded11ed14b163eee30f732c5b8 +APP_URL=http://192.168.50.4:8084/ + +DB_HOST=127.0.0.1 +DB_DATABASE=wordpress +DB_USERNAME=wordpress +DB_PASSWORD=wordpress + +CACHE_DRIVER=file +SESSION_DRIVER=file +QUEUE_DRIVER=sync + +REDIS_HOST=127.0.0.1 +REDIS_PASSWORD=null +REDIS_PORT=6379 + +MAIL_DRIVER=smtp +MAIL_HOST=mailtrap.io +MAIL_PORT=2525 +MAIL_USERNAME=null +MAIL_PASSWORD=null +MAIL_ENCRYPTION=null diff --git a/playbooks/roles/wordpress/templates/nginx.conf.j2 b/playbooks/roles/wordpress/templates/nginx.conf.j2 new file mode 100644 index 0000000..86b1543 --- /dev/null +++ b/playbooks/roles/wordpress/templates/nginx.conf.j2 @@ -0,0 +1,41 @@ +server { + listen 8084 default_server ssl; + listen [::]:8084 default_server ssl ipv6only=on; + + server_name 192.168.50.4; + + root {{ document_root }}/wordpress; + index index.php index.html index.htm; + charset utf-8; + + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + location = /favicon.ico { access_log off; log_not_found off; } + location = /robots.txt { access_log off; log_not_found off; } + + sendfile off; + client_max_body_size 100m; + + location ~ \.php$ { + try_files $uri /index.php =404; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass unix:/var/run/php7-wordpress.sock; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include fastcgi_params; + } + + location ~ /\.ht { + deny all; + } + + error_log /var/log/nginx/cakephp_error.log; + access_log /var/log/nginx/cakephp_access.log; + + ssl_certificate /etc/ssl/certs/ssl.crt; + ssl_certificate_key /etc/ssl/private/ssl.key; + + error_page 497 https://$host:8084$request_uri; +} diff --git a/playbooks/roles/wordpress/templates/php-fpm.conf.j2 b/playbooks/roles/wordpress/templates/php-fpm.conf.j2 new file mode 100644 index 0000000..1a5d5f8 --- /dev/null +++ b/playbooks/roles/wordpress/templates/php-fpm.conf.j2 @@ -0,0 +1,392 @@ +; Start a new pool named 'www'. +; the variable $pool can we used in any directive and will be replaced by the +; pool name ('www' here) +[wordpress] + +; Per pool prefix +; It only applies on the following directives: +; - 'slowlog' +; - 'listen' (unixsocket) +; - 'chroot' +; - 'chdir' +; - 'php_values' +; - 'php_admin_values' +; When not set, the global prefix (or /usr) applies instead. +; Note: This directive can also be relative to the global prefix. +; Default Value: none +;prefix = /path/to/pools/$pool + +; Unix user/group of processes +; Note: The user is mandatory. If the group is not set, the default user's group +; will be used. +user = {{ www_user }} +group = {{ www_group }} + +; The address on which to accept FastCGI requests. +; Valid syntaxes are: +; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on +; a specific port; +; 'port' - to listen on a TCP socket to all addresses on a +; specific port; +; '/path/to/unix/socket' - to listen on a unix socket. +; Note: This value is mandatory. +listen = /var/run/php7-wordpress.sock + +; Set listen(2) backlog. +; Default Value: 65535 (-1 on FreeBSD and OpenBSD) +;listen.backlog = 65535 + +; Set permissions for unix socket, if one is used. In Linux, read/write +; permissions must be set in order to allow connections from a web server. Many +; BSD-derived systems allow connections regardless of permissions. +; Default Values: user and group are set as the running user +; mode is set to 0660 +listen.owner = {{ www_user }} +listen.group = {{ www_group }} +;listen.mode = 0660 + +; List of ipv4 addresses of FastCGI clients which are allowed to connect. +; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original +; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address +; must be separated by a comma. If this value is left blank, connections will be +; accepted from any ip address. +; Default Value: any +;listen.allowed_clients = 127.0.0.1 + +; Specify the nice(2) priority to apply to the pool processes (only if set) +; The value can vary from -19 (highest priority) to 20 (lower priority) +; Note: - It will only work if the FPM master process is launched as root +; - The pool processes will inherit the master process priority +; unless it specified otherwise +; Default Value: no set +; priority = -19 + +; Choose how the process manager will control the number of child processes. +; Possible Values: +; static - a fixed number (pm.max_children) of child processes; +; dynamic - the number of child processes are set dynamically based on the +; following directives. With this process management, there will be +; always at least 1 children. +; pm.max_children - the maximum number of children that can +; be alive at the same time. +; pm.start_servers - the number of children created on startup. +; pm.min_spare_servers - the minimum number of children in 'idle' +; state (waiting to process). If the number +; of 'idle' processes is less than this +; number then some children will be created. +; pm.max_spare_servers - the maximum number of children in 'idle' +; state (waiting to process). If the number +; of 'idle' processes is greater than this +; number then some children will be killed. +; ondemand - no children are created at startup. Children will be forked when +; new requests will connect. The following parameter are used: +; pm.max_children - the maximum number of children that +; can be alive at the same time. +; pm.process_idle_timeout - The number of seconds after which +; an idle process will be killed. +; Note: This value is mandatory. +pm = dynamic + +; The number of child processes to be created when pm is set to 'static' and the +; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. +; This value sets the limit on the number of simultaneous requests that will be +; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. +; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP +; CGI. The below defaults are based on a server without much resources. Don't +; forget to tweak pm.* to fit your needs. +; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' +; Note: This value is mandatory. +pm.max_children = 5 + +; The number of child processes created on startup. +; Note: Used only when pm is set to 'dynamic' +; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 +pm.start_servers = 2 + +; The desired minimum number of idle server processes. +; Note: Used only when pm is set to 'dynamic' +; Note: Mandatory when pm is set to 'dynamic' +pm.min_spare_servers = 1 + +; The desired maximum number of idle server processes. +; Note: Used only when pm is set to 'dynamic' +; Note: Mandatory when pm is set to 'dynamic' +pm.max_spare_servers = 3 + +; The number of seconds after which an idle process will be killed. +; Note: Used only when pm is set to 'ondemand' +; Default Value: 10s +;pm.process_idle_timeout = 10s; + +; The number of requests each child process should execute before respawning. +; This can be useful to work around memory leaks in 3rd party libraries. For +; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. +; Default Value: 0 +;pm.max_requests = 500 + +; The URI to view the FPM status page. If this value is not set, no URI will be +; recognized as a status page. It shows the following informations: +; pool - the name of the pool; +; process manager - static, dynamic or ondemand; +; start time - the date and time FPM has started; +; start since - number of seconds since FPM has started; +; accepted conn - the number of request accepted by the pool; +; listen queue - the number of request in the queue of pending +; connections (see backlog in listen(2)); +; max listen queue - the maximum number of requests in the queue +; of pending connections since FPM has started; +; listen queue len - the size of the socket queue of pending connections; +; idle processes - the number of idle processes; +; active processes - the number of active processes; +; total processes - the number of idle + active processes; +; max active processes - the maximum number of active processes since FPM +; has started; +; max children reached - number of times, the process limit has been reached, +; when pm tries to start more children (works only for +; pm 'dynamic' and 'ondemand'); +; Value are updated in real time. +; Example output: +; pool: www +; process manager: static +; start time: 01/Jul/2011:17:53:49 +0200 +; start since: 62636 +; accepted conn: 190460 +; listen queue: 0 +; max listen queue: 1 +; listen queue len: 42 +; idle processes: 4 +; active processes: 11 +; total processes: 15 +; max active processes: 12 +; max children reached: 0 +; +; By default the status page output is formatted as text/plain. Passing either +; 'html', 'xml' or 'json' in the query string will return the corresponding +; output syntax. Example: +; http://www.foo.bar/status +; http://www.foo.bar/status?json +; http://www.foo.bar/status?html +; http://www.foo.bar/status?xml +; +; By default the status page only outputs short status. Passing 'full' in the +; query string will also return status for each pool process. +; Example: +; http://www.foo.bar/status?full +; http://www.foo.bar/status?json&full +; http://www.foo.bar/status?html&full +; http://www.foo.bar/status?xml&full +; The Full status returns for each process: +; pid - the PID of the process; +; state - the state of the process (Idle, Running, ...); +; start time - the date and time the process has started; +; start since - the number of seconds since the process has started; +; requests - the number of requests the process has served; +; request duration - the duration in µs of the requests; +; request method - the request method (GET, POST, ...); +; request URI - the request URI with the query string; +; content length - the content length of the request (only with POST); +; user - the user (PHP_AUTH_USER) (or '-' if not set); +; script - the main script called (or '-' if not set); +; last request cpu - the %cpu the last request consumed +; it's always 0 if the process is not in Idle state +; because CPU calculation is done when the request +; processing has terminated; +; last request memory - the max amount of memory the last request consumed +; it's always 0 if the process is not in Idle state +; because memory calculation is done when the request +; processing has terminated; +; If the process is in Idle state, then informations are related to the +; last request the process has served. Otherwise informations are related to +; the current request being served. +; Example output: +; ************************ +; pid: 31330 +; state: Running +; start time: 01/Jul/2011:17:53:49 +0200 +; start since: 63087 +; requests: 12808 +; request duration: 1250261 +; request method: GET +; request URI: /test_mem.php?N=10000 +; content length: 0 +; user: - +; script: /home/fat/web/docs/php/test_mem.php +; last request cpu: 0.00 +; last request memory: 0 +; +; Note: There is a real-time FPM status monitoring sample web page available +; It's available in: ${prefix}/share/fpm/status.html +; +; Note: The value must start with a leading slash (/). The value can be +; anything, but it may not be a good idea to use the .php extension or it +; may conflict with a real PHP file. +; Default Value: not set +;pm.status_path = /status + +; The ping URI to call the monitoring page of FPM. If this value is not set, no +; URI will be recognized as a ping page. This could be used to test from outside +; that FPM is alive and responding, or to +; - create a graph of FPM availability (rrd or such); +; - remove a server from a group if it is not responding (load balancing); +; - trigger alerts for the operating team (24/7). +; Note: The value must start with a leading slash (/). The value can be +; anything, but it may not be a good idea to use the .php extension or it +; may conflict with a real PHP file. +; Default Value: not set +;ping.path = /ping + +; This directive may be used to customize the response of a ping request. The +; response is formatted as text/plain with a 200 response code. +; Default Value: pong +;ping.response = pong + +; The access log file +; Default: not set +;access.log = log/$pool.access.log + +; The access log format. +; The following syntax is allowed +; %%: the '%' character +; %C: %CPU used by the request +; it can accept the following format: +; - %{user}C for user CPU only +; - %{system}C for system CPU only +; - %{total}C for user + system CPU (default) +; %d: time taken to serve the request +; it can accept the following format: +; - %{seconds}d (default) +; - %{miliseconds}d +; - %{mili}d +; - %{microseconds}d +; - %{micro}d +; %e: an environment variable (same as $_ENV or $_SERVER) +; it must be associated with embraces to specify the name of the env +; variable. Some exemples: +; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e +; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e +; %f: script filename +; %l: content-length of the request (for POST request only) +; %m: request method +; %M: peak of memory allocated by PHP +; it can accept the following format: +; - %{bytes}M (default) +; - %{kilobytes}M +; - %{kilo}M +; - %{megabytes}M +; - %{mega}M +; %n: pool name +; %o: output header +; it must be associated with embraces to specify the name of the header: +; - %{Content-Type}o +; - %{X-Powered-By}o +; - %{Transfert-Encoding}o +; - .... +; %p: PID of the child that serviced the request +; %P: PID of the parent of the child that serviced the request +; %q: the query string +; %Q: the '?' character if query string exists +; %r: the request URI (without the query string, see %q and %Q) +; %R: remote IP address +; %s: status (response code) +; %t: server time the request was received +; it can accept a strftime(3) format: +; %d/%b/%Y:%H:%M:%S %z (default) +; %T: time the log has been written (the request has finished) +; it can accept a strftime(3) format: +; %d/%b/%Y:%H:%M:%S %z (default) +; %u: remote user +; +; Default: "%R - %u %t \"%m %r\" %s" +;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" + +; The log file for slow requests +; Default Value: not set +; Note: slowlog is mandatory if request_slowlog_timeout is set +;slowlog = log/$pool.log.slow + +; The timeout for serving a single request after which a PHP backtrace will be +; dumped to the 'slowlog' file. A value of '0s' means 'off'. +; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) +; Default Value: 0 +;request_slowlog_timeout = 0 + +; The timeout for serving a single request after which the worker process will +; be killed. This option should be used when the 'max_execution_time' ini option +; does not stop script execution for some reason. A value of '0' means 'off'. +; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) +; Default Value: 0 +;request_terminate_timeout = 0 + +; Set open file descriptor rlimit. +; Default Value: system defined value +;rlimit_files = 1024 + +; Set max core size rlimit. +; Possible Values: 'unlimited' or an integer greater or equal to 0 +; Default Value: system defined value +;rlimit_core = 0 + +; Chroot to this directory at the start. This value must be defined as an +; absolute path. When this value is not set, chroot is not used. +; Note: you can prefix with '$prefix' to chroot to the pool prefix or one +; of its subdirectories. If the pool prefix is not set, the global prefix +; will be used instead. +; Note: chrooting is a great security feature and should be used whenever +; possible. However, all PHP paths will be relative to the chroot +; (error_log, sessions.save_path, ...). +; Default Value: not set +;chroot = + +; Chdir to this directory at the start. +; Note: relative path can be used. +; Default Value: current directory or / when chroot +chdir = / + +; Redirect worker stdout and stderr into main error log. If not set, stdout and +; stderr will be redirected to /dev/null according to FastCGI specs. +; Note: on highloaded environement, this can cause some delay in the page +; process time (several ms). +; Default Value: no +;catch_workers_output = yes + +; Limits the extensions of the main script FPM will allow to parse. This can +; prevent configuration mistakes on the web server side. You should only limit +; FPM to .php extensions to prevent malicious users to use other extensions to +; exectute php code. +; Note: set an empty value to allow all extensions. +; Default Value: .php +;security.limit_extensions = .php .php3 .php4 .php5 + +; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from +; the current environment. +; Default Value: clean env +;env[HOSTNAME] = $HOSTNAME +;env[PATH] = /usr/local/bin:/usr/bin:/bin +;env[TMP] = /tmp +;env[TMPDIR] = /tmp +;env[TEMP] = /tmp + +; Additional php.ini defines, specific to this pool of workers. These settings +; overwrite the values previously defined in the php.ini. The directives are the +; same as the PHP SAPI: +; php_value/php_flag - you can set classic ini defines which can +; be overwritten from PHP call 'ini_set'. +; php_admin_value/php_admin_flag - these directives won't be overwritten by +; PHP call 'ini_set' +; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. + +; Defining 'extension' will load the corresponding shared extension from +; extension_dir. Defining 'disable_functions' or 'disable_classes' will not +; overwrite previously defined php.ini values, but will append the new value +; instead. + +; Note: path INI options can be relative and will be expanded with the prefix +; (pool, global or /usr) + +; Default Value: nothing is defined by default except the values in php.ini and +; specified at startup with the -d argument +;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com +;php_flag[display_errors] = off +;php_admin_value[error_log] = /var/log/fpm-php.www.log +;php_admin_flag[log_errors] = on +;php_admin_value[memory_limit] = 32M diff --git a/playbooks/roles/wordpress/templates/rc.local.j2 b/playbooks/roles/wordpress/templates/rc.local.j2 new file mode 100644 index 0000000..1ec452e --- /dev/null +++ b/playbooks/roles/wordpress/templates/rc.local.j2 @@ -0,0 +1,3 @@ +#!/bin/bash +cd /vagrant/cakephp +sudo -u vagrant grunt watch & \ No newline at end of file diff --git a/playbooks/roles/wordpress/templates/wp-config.php.j2 b/playbooks/roles/wordpress/templates/wp-config.php.j2 new file mode 100644 index 0000000..f5edf02 --- /dev/null +++ b/playbooks/roles/wordpress/templates/wp-config.php.j2 @@ -0,0 +1,90 @@ +