From 7f62e8ff1be533683053e3954efad80e481bf1fd Mon Sep 17 00:00:00 2001 From: Ryan Marrs Date: Wed, 24 May 2017 14:59:20 -0400 Subject: [PATCH 01/21] Upgraded Ubuntu to 17.04 Added CakePHP Fixed php-fpm.conf files across all platforms to name the socket php7-fpm.sock instead of php5-fpm.sock --- .gitignore | 3 +++ Readme.md | 2 ++ Vagrantfile | 10 ++++++++-- .../roles/laravel-quickstart/templates/nginx.conf.j2 | 2 +- .../roles/laravel-quickstart/templates/php-fpm.conf.j2 | 2 +- .../roles/symfony-standard/templates/nginx.conf.j2 | 2 +- .../roles/symfony-standard/templates/php-fpm.conf.j2 | 2 +- playbooks/vagrant.retry | 1 + playbooks/vagrant.yml | 3 ++- 9 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 playbooks/vagrant.retry diff --git a/.gitignore b/.gitignore index 1e5aad1..b88d1d2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ .DS_Store .vagrant .idea/ +cakephp/ +symfony-standard/ +laravel-quickstart/ \ No newline at end of file diff --git a/Readme.md b/Readme.md index 32f4093..3c2f5cb 100644 --- a/Readme.md +++ b/Readme.md @@ -12,6 +12,7 @@ Installation * 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/ + * CakePHP base installation under http://192.168.50.4:8083/ The installation process will create a folder symfony-standard inside the main directory of the repository. You can now start working inside @@ -35,6 +36,7 @@ Installed components * [php-fpm](http://php-fpm.org) * [git](http://git-scm.com/) * [Composer](https://getcomposer.org/) +* [CakePHP 3](https://cakephp.org) * [Symfony2 Standard Edition](https://github.com/symfony/symfony-standard) * [Laravel](https://laravel.com/) * [PHPUnit](https://phpunit.de/) diff --git a/Vagrantfile b/Vagrantfile index 95d4755..e974f82 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -3,17 +3,23 @@ Vagrant.require_version ">= 1.7.0" Vagrant.configure(2) do |config| - config.vm.box = "bento/ubuntu-16.04" + #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.verbose = "vvv" 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 diff --git a/playbooks/roles/laravel-quickstart/templates/nginx.conf.j2 b/playbooks/roles/laravel-quickstart/templates/nginx.conf.j2 index 7ee4e3d..90681cb 100644 --- a/playbooks/roles/laravel-quickstart/templates/nginx.conf.j2 +++ b/playbooks/roles/laravel-quickstart/templates/nginx.conf.j2 @@ -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; 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/symfony-standard/templates/nginx.conf.j2 b/playbooks/roles/symfony-standard/templates/nginx.conf.j2 index 5424507..a85335d 100644 --- a/playbooks/roles/symfony-standard/templates/nginx.conf.j2 +++ b/playbooks/roles/symfony-standard/templates/nginx.conf.j2 @@ -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; 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/vagrant.retry b/playbooks/vagrant.retry new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/playbooks/vagrant.retry @@ -0,0 +1 @@ +default diff --git a/playbooks/vagrant.yml b/playbooks/vagrant.yml index 4841caa..e7adce5 100644 --- a/playbooks/vagrant.yml +++ b/playbooks/vagrant.yml @@ -15,5 +15,6 @@ - php - php-devtools - php-fpm + - cakephp + - laravel-quickstart - symfony-standard - - laravel-quickstart \ No newline at end of file From 78da977b4fe5d93467cfa5ecca1eb3f49bc5a41c Mon Sep 17 00:00:00 2001 From: Ryan Marrs Date: Wed, 24 May 2017 15:01:34 -0400 Subject: [PATCH 02/21] fixed the .gitignore to only reference /cakephp --- .gitignore | 6 +- playbooks/roles/cakephp/meta/main.yml | 6 + playbooks/roles/cakephp/tasks/main.yml | 45 ++ playbooks/roles/cakephp/templates/.env.j2 | 24 ++ playbooks/roles/cakephp/templates/app.php.j2 | 346 ++++++++++++++++ .../roles/cakephp/templates/nginx.conf.j2 | 36 ++ .../roles/cakephp/templates/php-fpm.conf.j2 | 392 ++++++++++++++++++ 7 files changed, 852 insertions(+), 3 deletions(-) create mode 100644 playbooks/roles/cakephp/meta/main.yml create mode 100644 playbooks/roles/cakephp/tasks/main.yml create mode 100644 playbooks/roles/cakephp/templates/.env.j2 create mode 100644 playbooks/roles/cakephp/templates/app.php.j2 create mode 100644 playbooks/roles/cakephp/templates/nginx.conf.j2 create mode 100644 playbooks/roles/cakephp/templates/php-fpm.conf.j2 diff --git a/.gitignore b/.gitignore index b88d1d2..6b34763 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ .DS_Store .vagrant .idea/ -cakephp/ -symfony-standard/ -laravel-quickstart/ \ No newline at end of file +/cakephp/ +/symfony-standard/ +/laravel-quickstart/ \ No newline at end of file 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..dbfe222 --- /dev/null +++ b/playbooks/roles/cakephp/tasks/main.yml @@ -0,0 +1,45 @@ +--- +- 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 + shell: cd /vagrant && composer create-project --prefer-dist cakephp/app cakephp + become: true + become_user: "{{ www_user }}" + +- name: Remove default CakePHP app.php + file: + path=/vagrant/cakephp/config/app.php + state=absent + +- name: Copy across new parameters.yml + template: + src=app.php.j2 + dest=/vagrant/cakephp/config/app.php + 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 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/nginx.conf.j2 b/playbooks/roles/cakephp/templates/nginx.conf.j2 new file mode 100644 index 0000000..a5e663a --- /dev/null +++ b/playbooks/roles/cakephp/templates/nginx.conf.j2 @@ -0,0 +1,36 @@ +server { + listen 8083 default_server; + listen [::]:8083 default_server 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; +} 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 From d9c75719d66d36784651f74ab2cbe85749a31e39 Mon Sep 17 00:00:00 2001 From: Ryan Marrs Date: Wed, 24 May 2017 15:28:30 -0400 Subject: [PATCH 03/21] We don't need to be Very Very Verbose. --- Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index e974f82..31ef495 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -16,7 +16,7 @@ Vagrant.configure(2) do |config| # Run Ansible from the Vagrant VM config.vm.provision "ansible_local" do |ansible| - ansible.verbose = "vvv" + ansible.verbose = "vv" ansible.playbook = "playbooks/vagrant.yml" ansible.install_mode = "pip" ansible.version = "2.2.3.0" From 972102e9e05a5084b92247a325ccef80d2968c69 Mon Sep 17 00:00:00 2001 From: Ryan Marrs Date: Wed, 24 May 2017 17:21:55 -0400 Subject: [PATCH 04/21] adding in composer updates / grunt watching / livereload --- playbooks/roles/base/tasks/main.yml | 9 ++- playbooks/roles/cakephp/tasks/main.yml | 56 +++++++++++++++++- .../roles/cakephp/templates/composer.json.j2 | 51 +++++++++++++++++ .../roles/cakephp/templates/default.ctp.j2 | 57 +++++++++++++++++++ .../roles/cakephp/templates/gruntfile.js.j2 | 27 +++++++++ .../roles/cakephp/templates/package.json.j2 | 10 ++++ playbooks/vagrant.yml | 4 +- 7 files changed, 210 insertions(+), 4 deletions(-) create mode 100644 playbooks/roles/cakephp/templates/composer.json.j2 create mode 100644 playbooks/roles/cakephp/templates/default.ctp.j2 create mode 100644 playbooks/roles/cakephp/templates/gruntfile.js.j2 create mode 100644 playbooks/roles/cakephp/templates/package.json.j2 diff --git a/playbooks/roles/base/tasks/main.yml b/playbooks/roles/base/tasks/main.yml index 3681c69..1742606 100644 --- a/playbooks/roles/base/tasks/main.yml +++ b/playbooks/roles/base/tasks/main.yml @@ -5,4 +5,11 @@ - 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/tasks/main.yml b/playbooks/roles/cakephp/tasks/main.yml index dbfe222..31a68e3 100644 --- a/playbooks/roles/cakephp/tasks/main.yml +++ b/playbooks/roles/cakephp/tasks/main.yml @@ -15,13 +15,30 @@ path=/vagrant/cakephp/config/app.php state=absent -- name: Copy across new parameters.yml +- 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 @@ -43,3 +60,40 @@ 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 && npm --no-bin-links install + become: true + become_user: "{{ www_user }}" + +- 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 && touch /vagrant/cakephp/webroot/scss/custom.sass + become: true + become_user: "{{ www_user }}" + +- 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 }}" + +- name: setup GRUNT on boot + shell: echo "sudo -u vagrant cd /vagrant/cakephp && grunt livereload" >> /etc/rc.local + + + \ No newline at end of file diff --git a/playbooks/roles/cakephp/templates/composer.json.j2 b/playbooks/roles/cakephp/templates/composer.json.j2 new file mode 100644 index 0000000..1a656ec --- /dev/null +++ b/playbooks/roles/cakephp/templates/composer.json.j2 @@ -0,0 +1,51 @@ +{ + "name": "cakephp/app", + "description": "CakePHP skeleton app", + "homepage": "http://cakephp.org", + "type": "project", + "license": "MIT", + "require": { + "php": ">=5.6", + "cakephp/cakephp": "3.4.*", + "mobiledetect/mobiledetectlib": "2.*", + "cakephp/migrations": "~1.0", + "cakephp/plugin-installer": "~1.0", + "zurb/foundation": "~6.0", + "components/normalize.css": "~3.0" + }, + "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/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..6dd1007 --- /dev/null +++ b/playbooks/roles/cakephp/templates/gruntfile.js.j2 @@ -0,0 +1,27 @@ +grunt.initConfig({ + sass: { + dev: { + src: [ + 'vendor/components/normalize.css/normalize.css', + 'vendor/zurb/foundation/scss/foundation.scss', + 'webroot/css/cake.css', + 'webroot/css/home.css', + 'webroot/sass/*.sass' + ], + dest: 'webroot/css/main.css', + }, + }, + watch: { + sass: { + // We watch and compile sass files as normal but don't live reload here + files: ['webroot/scss/*.sass'], + tasks: ['sass'], + }, + livereload: { + // Here we watch the files the sass task will compile to + // These files are sent to the live reload server after sass compiles to them + options: { livereload: true }, + files: ['webroot/**/*'], + }, + }, +}); \ No newline at end of file diff --git a/playbooks/roles/cakephp/templates/package.json.j2 b/playbooks/roles/cakephp/templates/package.json.j2 new file mode 100644 index 0000000..73d21ef --- /dev/null +++ b/playbooks/roles/cakephp/templates/package.json.j2 @@ -0,0 +1,10 @@ +{ + "name": "cakephp-app", + "version": "0.1.0", + "devDependencies": { + "grunt": "~0.4.5", + "grunt-contrib-uglify": "~0.5.0", + "grunt-contrib-watch": "^1.0.0", + "grunt-sass": "^2.0.0" + } +} diff --git a/playbooks/vagrant.yml b/playbooks/vagrant.yml index e7adce5..0be6533 100644 --- a/playbooks/vagrant.yml +++ b/playbooks/vagrant.yml @@ -16,5 +16,5 @@ - php-devtools - php-fpm - cakephp - - laravel-quickstart - - symfony-standard +# - laravel-quickstart +# - symfony-standard From 06de199bb28b75c01d92c8145e3de576b068f303 Mon Sep 17 00:00:00 2001 From: Ryan Marrs Date: Tue, 30 May 2017 13:01:04 -0400 Subject: [PATCH 05/21] Adding SASS / grunt watch tasks, etc --- playbooks/roles/cakephp/tasks/main.yml | 8 +- .../roles/cakephp/templates/composer.json.j2 | 21 +- .../roles/cakephp/templates/gruntfile.js.j2 | 17 ++ .../roles/cakephp/templates/home.ctp.j2.ctp | 274 ++++++++++++++++++ .../roles/cakephp/templates/package.json.j2 | 7 +- 5 files changed, 315 insertions(+), 12 deletions(-) create mode 100644 playbooks/roles/cakephp/templates/home.ctp.j2.ctp diff --git a/playbooks/roles/cakephp/tasks/main.yml b/playbooks/roles/cakephp/tasks/main.yml index 31a68e3..046167e 100644 --- a/playbooks/roles/cakephp/tasks/main.yml +++ b/playbooks/roles/cakephp/tasks/main.yml @@ -69,10 +69,16 @@ become_user: "{{ www_user }}" - name: NPM Install + shell: cd /vagrant/cakephp && sudo npm -g install + +- name: Make sass directories shell: cd /vagrant/cakephp && npm --no-bin-links install become: true become_user: "{{ www_user }}" +- name: Install GEM + shell: cd /vagrant/cakephp && sudo gem install sass + - name: Copy gruntfile.js template: src=gruntfile.js.j2 @@ -81,7 +87,7 @@ become_user: "{{ www_user }}" - name: Make sass directories - shell: mkdir /vagrant/cakephp/webroot/scss && touch /vagrant/cakephp/webroot/scss/custom.sass + shell: mkdir /vagrant/cakephp/webroot/scss && touch /vagrant/cakephp/webroot/scss/custom.sass /vagrant/cakephp/webroot/js/custom.js become: true become_user: "{{ www_user }}" diff --git a/playbooks/roles/cakephp/templates/composer.json.j2 b/playbooks/roles/cakephp/templates/composer.json.j2 index 1a656ec..a440cf7 100644 --- a/playbooks/roles/cakephp/templates/composer.json.j2 +++ b/playbooks/roles/cakephp/templates/composer.json.j2 @@ -5,18 +5,21 @@ "type": "project", "license": "MIT", "require": { - "php": ">=5.6", - "cakephp/cakephp": "3.4.*", - "mobiledetect/mobiledetectlib": "2.*", - "cakephp/migrations": "~1.0", - "cakephp/plugin-installer": "~1.0", - "zurb/foundation": "~6.0", - "components/normalize.css": "~3.0" + "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" + "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.", diff --git a/playbooks/roles/cakephp/templates/gruntfile.js.j2 b/playbooks/roles/cakephp/templates/gruntfile.js.j2 index 6dd1007..7435ea9 100644 --- a/playbooks/roles/cakephp/templates/gruntfile.js.j2 +++ b/playbooks/roles/cakephp/templates/gruntfile.js.j2 @@ -1,3 +1,5 @@ +grunt.loadNpmTasks('grunt-contrib-watch'); + grunt.initConfig({ sass: { dev: { @@ -11,6 +13,21 @@ grunt.initConfig({ dest: 'webroot/css/main.css', }, }, + uglify: { + options: { + mangle: false + }, + my_target: { + files: { + 'webroot/js/cakephp.min.js': + [ + 'webroot/js/custom.js', + 'cakephp/vendor/zurb/foundation' + + ] + } + } + } watch: { sass: { // We watch and compile sass files as normal but don't live reload here 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/package.json.j2 b/playbooks/roles/cakephp/templates/package.json.j2 index 73d21ef..314b8a6 100644 --- a/playbooks/roles/cakephp/templates/package.json.j2 +++ b/playbooks/roles/cakephp/templates/package.json.j2 @@ -3,8 +3,11 @@ "version": "0.1.0", "devDependencies": { "grunt": "~0.4.5", - "grunt-contrib-uglify": "~0.5.0", + "grunt-contrib-uglify": "^0.5.0", "grunt-contrib-watch": "^1.0.0", - "grunt-sass": "^2.0.0" + "grunt-contrib-sass": "^1.0", + "matchdep": "*", + "grunt-autoprefixer": "^1.0.1" + } } From 4ed7dc0c54b10f245c55a155da03275f632bcb24 Mon Sep 17 00:00:00 2001 From: Ryan Marrs Date: Tue, 30 May 2017 13:52:54 -0400 Subject: [PATCH 06/21] Upgraded versions, also added custom.scss file --- playbooks/roles/cakephp/tasks/main.yml | 7 +++++++ playbooks/roles/cakephp/templates/custom.scss.j2 | 11 +++++++++++ playbooks/roles/cakephp/templates/package.json.j2 | 9 ++++----- 3 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 playbooks/roles/cakephp/templates/custom.scss.j2 diff --git a/playbooks/roles/cakephp/tasks/main.yml b/playbooks/roles/cakephp/tasks/main.yml index 046167e..7189b2c 100644 --- a/playbooks/roles/cakephp/tasks/main.yml +++ b/playbooks/roles/cakephp/tasks/main.yml @@ -98,6 +98,13 @@ become: true become_user: "{{ www_user }}" +- name: Copy default layout with new sass + template: + src=custom.scss.j2 + dest=/vagrant/cakephp/webroot/scss/custom.scss + become: true + become_user: "{{ www_user }}" + - name: setup GRUNT on boot shell: echo "sudo -u vagrant cd /vagrant/cakephp && grunt livereload" >> /etc/rc.local diff --git a/playbooks/roles/cakephp/templates/custom.scss.j2 b/playbooks/roles/cakephp/templates/custom.scss.j2 new file mode 100644 index 0000000..ab4ac3c --- /dev/null +++ b/playbooks/roles/cakephp/templates/custom.scss.j2 @@ -0,0 +1,11 @@ +// Vendor Files +@import 'settings/settings'; +@import 'foundation'; + +@include foundation-grid; +@include foundation-typography; +@include foundation-forms; +@include foundation-visibility-classes; +@include foundation-float-classes; +@include foundation-flex-video; +@include foundation-table; \ No newline at end of file diff --git a/playbooks/roles/cakephp/templates/package.json.j2 b/playbooks/roles/cakephp/templates/package.json.j2 index 314b8a6..fd25f40 100644 --- a/playbooks/roles/cakephp/templates/package.json.j2 +++ b/playbooks/roles/cakephp/templates/package.json.j2 @@ -2,12 +2,11 @@ "name": "cakephp-app", "version": "0.1.0", "devDependencies": { - "grunt": "~0.4.5", - "grunt-contrib-uglify": "^0.5.0", - "grunt-contrib-watch": "^1.0.0", + "grunt": "^1.0.0", + "grunt-contrib-uglify": "^3.0", + "grunt-contrib-watch": "^1.0", "grunt-contrib-sass": "^1.0", "matchdep": "*", - "grunt-autoprefixer": "^1.0.1" - + "grunt-autoprefixer": "^3.0" } } From c19b0dc62027f85dbc4c2991fa4b4fd6eeb28634 Mon Sep 17 00:00:00 2001 From: Ryan Marrs Date: Tue, 30 May 2017 16:46:14 -0400 Subject: [PATCH 07/21] fixing Foundation Javascript Calls foundation on load grunt watch start --- playbooks/roles/cakephp/tasks/main.yml | 21 ++- .../roles/cakephp/templates/custom.js.j2.js | 3 + .../roles/cakephp/templates/custom.scss.j2 | 68 ++++++++- .../roles/cakephp/templates/gruntfile.js.j2 | 144 +++++++++++++----- .../roles/cakephp/templates/package.json.j2 | 3 +- 5 files changed, 188 insertions(+), 51 deletions(-) create mode 100644 playbooks/roles/cakephp/templates/custom.js.j2.js diff --git a/playbooks/roles/cakephp/tasks/main.yml b/playbooks/roles/cakephp/tasks/main.yml index 7189b2c..c7c5a3e 100644 --- a/playbooks/roles/cakephp/tasks/main.yml +++ b/playbooks/roles/cakephp/tasks/main.yml @@ -87,7 +87,7 @@ become_user: "{{ www_user }}" - name: Make sass directories - shell: mkdir /vagrant/cakephp/webroot/scss && touch /vagrant/cakephp/webroot/scss/custom.sass /vagrant/cakephp/webroot/js/custom.js + shell: mkdir /vagrant/cakephp/webroot/scss become: true become_user: "{{ www_user }}" @@ -105,8 +105,23 @@ become: true become_user: "{{ www_user }}" + - 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 }}" + - name: setup GRUNT on boot - shell: echo "sudo -u vagrant cd /vagrant/cakephp && grunt livereload" >> /etc/rc.local + shell: echo "sudo -u vagrant cd /vagrant/cakephp && grunt watch" >> /etc/rc.local + +- name: start GRUNT watch + shell: cp -fr /vagrant/cakephp/node_modules/foundation-icons /vagrant/cakephp/webroot/font/foundation-icons + become: true + become_user: "{{ www_user }}" - \ No newline at end of file +- name: start GRUNT watch + shell: cd /vagrant/cakephp && grunt watch + become: true + become_user: "{{ www_user }}" \ No newline at end of file diff --git a/playbooks/roles/cakephp/templates/custom.js.j2.js b/playbooks/roles/cakephp/templates/custom.js.j2.js new file mode 100644 index 0000000..26ed47e --- /dev/null +++ b/playbooks/roles/cakephp/templates/custom.js.j2.js @@ -0,0 +1,3 @@ +$(function(){ + $(document).foundation(); +}); \ No newline at end of file diff --git a/playbooks/roles/cakephp/templates/custom.scss.j2 b/playbooks/roles/cakephp/templates/custom.scss.j2 index ab4ac3c..49afb98 100644 --- a/playbooks/roles/cakephp/templates/custom.scss.j2 +++ b/playbooks/roles/cakephp/templates/custom.scss.j2 @@ -2,10 +2,64 @@ @import 'settings/settings'; @import 'foundation'; -@include foundation-grid; -@include foundation-typography; -@include foundation-forms; -@include foundation-visibility-classes; -@include foundation-float-classes; -@include foundation-flex-video; -@include foundation-table; \ No newline at end of file +/* 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/gruntfile.js.j2 b/playbooks/roles/cakephp/templates/gruntfile.js.j2 index 7435ea9..615bd21 100644 --- a/playbooks/roles/cakephp/templates/gruntfile.js.j2 +++ b/playbooks/roles/cakephp/templates/gruntfile.js.j2 @@ -1,44 +1,108 @@ -grunt.loadNpmTasks('grunt-contrib-watch'); - -grunt.initConfig({ - sass: { - dev: { - src: [ - 'vendor/components/normalize.css/normalize.css', - 'vendor/zurb/foundation/scss/foundation.scss', - 'webroot/css/cake.css', - 'webroot/css/home.css', - 'webroot/sass/*.sass' - ], - dest: 'webroot/css/main.css', - }, - }, - uglify: { - options: { - mangle: false +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, + // }, + // } }, - my_target: { - files: { - 'webroot/js/cakephp.min.js': - [ - 'webroot/js/custom.js', - 'cakephp/vendor/zurb/foundation' - - ] + + //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' + ]} + ] } - } - } - watch: { - sass: { - // We watch and compile sass files as normal but don't live reload here - files: ['webroot/scss/*.sass'], - tasks: ['sass'], }, - livereload: { - // Here we watch the files the sass task will compile to - // These files are sent to the live reload server after sass compiles to them - options: { livereload: true }, - files: ['webroot/**/*'], + autoprefixer: { + options: { + browsers: [ + "> 1%", + "last 2 versions", + "ie >= 9", + "opera >= 10", + "Android >= 2.3" + ] + }, + files: { + src: ["webroot/css/custom.css"] + } }, - }, -}); \ No newline at end of file + //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/package.json.j2 b/playbooks/roles/cakephp/templates/package.json.j2 index fd25f40..5d737f3 100644 --- a/playbooks/roles/cakephp/templates/package.json.j2 +++ b/playbooks/roles/cakephp/templates/package.json.j2 @@ -7,6 +7,7 @@ "grunt-contrib-watch": "^1.0", "grunt-contrib-sass": "^1.0", "matchdep": "*", - "grunt-autoprefixer": "^3.0" + "grunt-autoprefixer": "^3.0", + "foundation-icons" : "*" } } From 555da7cc3fe70d0c52e44b9a92daa647ce6b1e41 Mon Sep 17 00:00:00 2001 From: Ryan Marrs Date: Thu, 1 Jun 2017 16:34:00 -0400 Subject: [PATCH 08/21] create SSL Certificates Update all roles to https added default Foundation script to webroot/js/custom.js remove the create_ssl.sh script after it runs --- .gitignore | 3 ++- Readme.md | 2 +- playbooks/roles/cakephp/tasks/main.yml | 13 +++++++------ .../roles/cakephp/templates/custom.js.j2.js | 3 --- playbooks/roles/cakephp/templates/nginx.conf.j2 | 7 +++++-- .../laravel-quickstart/templates/nginx.conf.j2 | 7 +++++-- playbooks/roles/nginx/tasks/main.yml | 17 ++++++++++++++++- playbooks/roles/nginx/templates/nginx.conf.j2 | 12 ++++++------ .../symfony-standard/templates/nginx.conf.j2 | 7 +++++-- playbooks/vagrant.yml | 4 ++-- 10 files changed, 49 insertions(+), 26 deletions(-) delete mode 100644 playbooks/roles/cakephp/templates/custom.js.j2.js diff --git a/.gitignore b/.gitignore index 6b34763..28c29f0 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ .idea/ /cakephp/ /symfony-standard/ -/laravel-quickstart/ \ No newline at end of file +/laravel-quickstart/ +/create_ssl.sh diff --git a/Readme.md b/Readme.md index 3c2f5cb..b61110d 100644 --- a/Readme.md +++ b/Readme.md @@ -12,7 +12,7 @@ Installation * 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/ - * CakePHP base installation under http://192.168.50.4:8083/ + * CakePHP base installation under https://192.168.50.4:8083/ The installation process will create a folder symfony-standard inside the main directory of the repository. You can now start working inside diff --git a/playbooks/roles/cakephp/tasks/main.yml b/playbooks/roles/cakephp/tasks/main.yml index c7c5a3e..1ecfb07 100644 --- a/playbooks/roles/cakephp/tasks/main.yml +++ b/playbooks/roles/cakephp/tasks/main.yml @@ -69,9 +69,11 @@ become_user: "{{ www_user }}" - name: NPM Install - shell: cd /vagrant/cakephp && sudo npm -g install + shell: cd /vagrant/cakephp && sudo npm -g install grunt + become: true + become_user: "{{ www_user }}" -- name: Make sass directories +- name: NPM Install local project shell: cd /vagrant/cakephp && npm --no-bin-links install become: true become_user: "{{ www_user }}" @@ -105,7 +107,7 @@ become: true become_user: "{{ www_user }}" - - name: Copy js with new custom js +- name: Copy js with new custom js template: src=custom.js.j2 dest=/vagrant/cakephp/webroot/js/custom.js @@ -115,13 +117,12 @@ - name: setup GRUNT on boot shell: echo "sudo -u vagrant cd /vagrant/cakephp && grunt watch" >> /etc/rc.local -- name: start GRUNT watch +- 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 }}" - - name: start GRUNT watch - shell: cd /vagrant/cakephp && grunt watch + shell: cd /vagrant/cakephp && grunt watch & become: true become_user: "{{ www_user }}" \ No newline at end of file diff --git a/playbooks/roles/cakephp/templates/custom.js.j2.js b/playbooks/roles/cakephp/templates/custom.js.j2.js deleted file mode 100644 index 26ed47e..0000000 --- a/playbooks/roles/cakephp/templates/custom.js.j2.js +++ /dev/null @@ -1,3 +0,0 @@ -$(function(){ - $(document).foundation(); -}); \ No newline at end of file diff --git a/playbooks/roles/cakephp/templates/nginx.conf.j2 b/playbooks/roles/cakephp/templates/nginx.conf.j2 index a5e663a..d37faed 100644 --- a/playbooks/roles/cakephp/templates/nginx.conf.j2 +++ b/playbooks/roles/cakephp/templates/nginx.conf.j2 @@ -1,6 +1,6 @@ server { - listen 8083 default_server; - listen [::]:8083 default_server ipv6only=on; + listen 8083 default_server ssl; + listen [::]:8083 default_server ssl ipv6only=on; server_name 192.168.50.4; @@ -33,4 +33,7 @@ server { 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; } diff --git a/playbooks/roles/laravel-quickstart/templates/nginx.conf.j2 b/playbooks/roles/laravel-quickstart/templates/nginx.conf.j2 index 90681cb..215e031 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; @@ -33,4 +33,7 @@ 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; } \ No newline at end of file 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/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 a85335d..ef1ccc0 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; @@ -23,4 +23,7 @@ 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; } diff --git a/playbooks/vagrant.yml b/playbooks/vagrant.yml index 0be6533..e7adce5 100644 --- a/playbooks/vagrant.yml +++ b/playbooks/vagrant.yml @@ -16,5 +16,5 @@ - php-devtools - php-fpm - cakephp -# - laravel-quickstart -# - symfony-standard + - laravel-quickstart + - symfony-standard From 2715f34401123cf59470cd167de0bffdf2319c07 Mon Sep 17 00:00:00 2001 From: Ryan Marrs Date: Thu, 1 Jun 2017 16:38:40 -0400 Subject: [PATCH 09/21] adding in the custom templates that got missed in develop --- playbooks/roles/cakephp/templates/custom.js.j2 | 3 +++ playbooks/roles/nginx/templates/create_ssl.sh.j2 | 2 ++ 2 files changed, 5 insertions(+) create mode 100644 playbooks/roles/cakephp/templates/custom.js.j2 create mode 100644 playbooks/roles/nginx/templates/create_ssl.sh.j2 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/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 From 92db6b190faf9881647d5fe55c5a7332db2603d1 Mon Sep 17 00:00:00 2001 From: Ryan Marrs Date: Thu, 1 Jun 2017 16:57:51 -0400 Subject: [PATCH 10/21] added auto-redirect for https --- playbooks/roles/cakephp/templates/nginx.conf.j2 | 2 ++ playbooks/roles/laravel-quickstart/templates/nginx.conf.j2 | 2 ++ playbooks/roles/symfony-standard/templates/nginx.conf.j2 | 2 ++ 3 files changed, 6 insertions(+) diff --git a/playbooks/roles/cakephp/templates/nginx.conf.j2 b/playbooks/roles/cakephp/templates/nginx.conf.j2 index d37faed..28f4c77 100644 --- a/playbooks/roles/cakephp/templates/nginx.conf.j2 +++ b/playbooks/roles/cakephp/templates/nginx.conf.j2 @@ -36,4 +36,6 @@ server { 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/laravel-quickstart/templates/nginx.conf.j2 b/playbooks/roles/laravel-quickstart/templates/nginx.conf.j2 index 215e031..765efc1 100644 --- a/playbooks/roles/laravel-quickstart/templates/nginx.conf.j2 +++ b/playbooks/roles/laravel-quickstart/templates/nginx.conf.j2 @@ -36,4 +36,6 @@ server { 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/symfony-standard/templates/nginx.conf.j2 b/playbooks/roles/symfony-standard/templates/nginx.conf.j2 index ef1ccc0..4efec34 100644 --- a/playbooks/roles/symfony-standard/templates/nginx.conf.j2 +++ b/playbooks/roles/symfony-standard/templates/nginx.conf.j2 @@ -26,4 +26,6 @@ server { ssl_certificate /etc/ssl/certs/ssl.crt; ssl_certificate_key /etc/ssl/private/ssl.key; + + error_page 497 https://$host:8081$request_uri; } From dea1120ba90c832699133f6febd65093c2c11936 Mon Sep 17 00:00:00 2001 From: Ryan Marrs Date: Fri, 2 Jun 2017 08:29:21 -0400 Subject: [PATCH 11/21] updating documentation. Still resolving rc-local issues --- Readme.md | 10 +++++++--- playbooks/roles/cakephp/tasks/main.yml | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Readme.md b/Readme.md index b61110d..44d1ffd 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 ------------ @@ -14,9 +15,9 @@ Installation * Laravel Quickstart example app under http://192.168.50.4:8082/ * CakePHP base installation under https://192.168.50.4:8083/ -The installation process will create a folder symfony-standard inside +The installation process will create folders symfony-standard, laravel-quickstart, cakephp 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 @@ -27,6 +28,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 -------------------- @@ -39,6 +42,7 @@ Installed components * [CakePHP 3](https://cakephp.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/playbooks/roles/cakephp/tasks/main.yml b/playbooks/roles/cakephp/tasks/main.yml index 1ecfb07..bb274ef 100644 --- a/playbooks/roles/cakephp/tasks/main.yml +++ b/playbooks/roles/cakephp/tasks/main.yml @@ -115,7 +115,7 @@ become_user: "{{ www_user }}" - name: setup GRUNT on boot - shell: echo "sudo -u vagrant cd /vagrant/cakephp && grunt watch" >> /etc/rc.local + shell: echo "#!/bin/bash\ncd /vagrant/cakephp && sudo -u vagrant grunt watch" >> /etc/rc.local && 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 From 4e5c8ae99bf04344471359ee5333e4e3e7d0caaf Mon Sep 17 00:00:00 2001 From: Ryan Marrs Date: Fri, 2 Jun 2017 08:36:34 -0400 Subject: [PATCH 12/21] fixed auto-start of grunt by moving to a template file --- playbooks/roles/cakephp/tasks/main.yml | 7 ++++++- playbooks/roles/cakephp/templates/rc.local.j2 | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 playbooks/roles/cakephp/templates/rc.local.j2 diff --git a/playbooks/roles/cakephp/tasks/main.yml b/playbooks/roles/cakephp/tasks/main.yml index bb274ef..0936066 100644 --- a/playbooks/roles/cakephp/tasks/main.yml +++ b/playbooks/roles/cakephp/tasks/main.yml @@ -114,8 +114,13 @@ become: true become_user: "{{ www_user }}" +- name: Copy over rc.local file + template: + src=rc.local.j2 + dest=/etc/rc.local + - name: setup GRUNT on boot - shell: echo "#!/bin/bash\ncd /vagrant/cakephp && sudo -u vagrant grunt watch" >> /etc/rc.local && sudo systemctl enable rc-local.service + 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 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 From 25ede6fba8dad4147d825c9d981f21ff165893cc Mon Sep 17 00:00:00 2001 From: Ryan Marrs Date: Mon, 5 Jun 2017 11:25:19 -0400 Subject: [PATCH 13/21] updated Readme.md to reflect https --- Readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Readme.md b/Readme.md index 44d1ffd..5dd1304 100644 --- a/Readme.md +++ b/Readme.md @@ -11,8 +11,8 @@ 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/ The installation process will create folders symfony-standard, laravel-quickstart, cakephp inside From be67f366583f2c8ee52e99b7d71c130797eeecf4 Mon Sep 17 00:00:00 2001 From: Ryan Marrs Date: Sun, 25 Jun 2017 17:06:08 -0400 Subject: [PATCH 14/21] fixed default scss --- playbooks/roles/cakephp/tasks/main.yml | 6 +++--- .../cakephp/templates/{custom.scss.j2 => main.scss.j2} | 0 2 files changed, 3 insertions(+), 3 deletions(-) rename playbooks/roles/cakephp/templates/{custom.scss.j2 => main.scss.j2} (100%) diff --git a/playbooks/roles/cakephp/tasks/main.yml b/playbooks/roles/cakephp/tasks/main.yml index 0936066..f321734 100644 --- a/playbooks/roles/cakephp/tasks/main.yml +++ b/playbooks/roles/cakephp/tasks/main.yml @@ -102,8 +102,8 @@ - name: Copy default layout with new sass template: - src=custom.scss.j2 - dest=/vagrant/cakephp/webroot/scss/custom.scss + src=main.scss.j2 + dest=/vagrant/cakephp/webroot/scss/main.scss become: true become_user: "{{ www_user }}" @@ -130,4 +130,4 @@ - name: start GRUNT watch shell: cd /vagrant/cakephp && grunt watch & become: true - become_user: "{{ www_user }}" \ No newline at end of file + become_user: "{{ www_user }}" diff --git a/playbooks/roles/cakephp/templates/custom.scss.j2 b/playbooks/roles/cakephp/templates/main.scss.j2 similarity index 100% rename from playbooks/roles/cakephp/templates/custom.scss.j2 rename to playbooks/roles/cakephp/templates/main.scss.j2 From 017d6f52c154ecce188e8a657f8b2807e0f09869 Mon Sep 17 00:00:00 2001 From: Ryan Marrs Date: Wed, 27 Sep 2017 14:57:43 -0400 Subject: [PATCH 15/21] fixed sass modules failing --- playbooks/roles/cakephp/tasks/main.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/playbooks/roles/cakephp/tasks/main.yml b/playbooks/roles/cakephp/tasks/main.yml index f321734..60296b1 100644 --- a/playbooks/roles/cakephp/tasks/main.yml +++ b/playbooks/roles/cakephp/tasks/main.yml @@ -78,6 +78,14 @@ 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 From f665af1765b1209a12d5ec7562d94571df5b9250 Mon Sep 17 00:00:00 2001 From: Ryan Marrs Date: Wed, 17 Jan 2018 17:34:06 -0500 Subject: [PATCH 16/21] updated the cakephp task to not fail if the cakephp directory already exists. Allows a vagrant destroy / vagrant up refresh rolled back Ubuntu to 16.04 --- Vagrantfile | 6 +++--- playbooks/roles/cakephp/tasks/main.yml | 12 ++++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 31ef495..c5e7427 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -3,9 +3,9 @@ Vagrant.require_version ">= 1.7.0" Vagrant.configure(2) do |config| - #config.vm.box = "bento/ubuntu-16.04" + config.vm.box = "bento/ubuntu-16.04" #config.vm.box = "xenji/ubuntu-17.04-server" - config.vm.box = "wholebits/ubuntu17.04-64" + #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. @@ -24,4 +24,4 @@ Vagrant.configure(2) do |config| 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/cakephp/tasks/main.yml b/playbooks/roles/cakephp/tasks/main.yml index 60296b1..c030471 100644 --- a/playbooks/roles/cakephp/tasks/main.yml +++ b/playbooks/roles/cakephp/tasks/main.yml @@ -9,6 +9,8 @@ shell: cd /vagrant && composer create-project --prefer-dist cakephp/app cakephp become: true become_user: "{{ www_user }}" + ignore_errors: yes + - name: Remove default CakePHP app.php file: @@ -100,6 +102,7 @@ shell: mkdir /vagrant/cakephp/webroot/scss become: true become_user: "{{ www_user }}" + ignore_errors: yes - name: Copy default layout with new sass template: @@ -107,6 +110,7 @@ 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: @@ -114,6 +118,7 @@ dest=/vagrant/cakephp/webroot/scss/main.scss become: true become_user: "{{ www_user }}" + ignore_errors: yes - name: Copy js with new custom js template: @@ -121,11 +126,13 @@ 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 @@ -134,8 +141,5 @@ shell: cp -fr /vagrant/cakephp/node_modules/foundation-icons /vagrant/cakephp/webroot/font/foundation-icons become: true become_user: "{{ www_user }}" + ignore_errors: yes -- name: start GRUNT watch - shell: cd /vagrant/cakephp && grunt watch & - become: true - become_user: "{{ www_user }}" From 9bc5e786b66fbac742ec9650a87e5a0e70490af4 Mon Sep 17 00:00:00 2001 From: Ryan Marrs Date: Thu, 18 Jan 2018 00:49:43 -0500 Subject: [PATCH 17/21] added wordpress installation task to 192.168.50.4:8084 upgraded packages, etc --- .gitignore | 1 + Readme.md | 1 + playbooks/roles/base/tasks/main.yml | 5 +- playbooks/roles/cakephp/tasks/main.yml | 6 +- playbooks/roles/wordpress/meta/main.yml | 6 + playbooks/roles/wordpress/tasks/main.yml | 187 +++++++++ playbooks/roles/wordpress/templates/.env.j2 | 24 ++ .../roles/wordpress/templates/nginx.conf.j2 | 41 ++ .../roles/wordpress/templates/php-fpm.conf.j2 | 392 ++++++++++++++++++ .../roles/wordpress/templates/rc.local.j2 | 3 + .../wordpress/templates/wp-config.php.j2 | 90 ++++ playbooks/vagrant.yml | 7 +- 12 files changed, 757 insertions(+), 6 deletions(-) create mode 100644 playbooks/roles/wordpress/meta/main.yml create mode 100644 playbooks/roles/wordpress/tasks/main.yml create mode 100644 playbooks/roles/wordpress/templates/.env.j2 create mode 100644 playbooks/roles/wordpress/templates/nginx.conf.j2 create mode 100644 playbooks/roles/wordpress/templates/php-fpm.conf.j2 create mode 100644 playbooks/roles/wordpress/templates/rc.local.j2 create mode 100644 playbooks/roles/wordpress/templates/wp-config.php.j2 diff --git a/.gitignore b/.gitignore index 28c29f0..650d41f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,6 @@ .idea/ /cakephp/ /symfony-standard/ +/wordpress/ /laravel-quickstart/ /create_ssl.sh diff --git a/Readme.md b/Readme.md index 5dd1304..aefd40b 100644 --- a/Readme.md +++ b/Readme.md @@ -14,6 +14,7 @@ Installation * 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 folders symfony-standard, laravel-quickstart, cakephp inside the main directory of the repository. You can now start working inside diff --git a/playbooks/roles/base/tasks/main.yml b/playbooks/roles/base/tasks/main.yml index 1742606..56b4ead 100644 --- a/playbooks/roles/base/tasks/main.yml +++ b/playbooks/roles/base/tasks/main.yml @@ -1,5 +1,6 @@ - name: Install required base packages apt: name={{ item }} state=present + with_items: - curl - git @@ -9,7 +10,9 @@ - npm - ruby +- name: System upgrade + command: apt-get upgrade -y -qq + - 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/tasks/main.yml b/playbooks/roles/cakephp/tasks/main.yml index c030471..24edfa5 100644 --- a/playbooks/roles/cakephp/tasks/main.yml +++ b/playbooks/roles/cakephp/tasks/main.yml @@ -6,12 +6,14 @@ mysql_user: name=cakephp password=cakephp priv=*.*:ALL state=present - name: Install CakePHP - shell: cd /vagrant && composer create-project --prefer-dist cakephp/app 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 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..838b313 --- /dev/null +++ b/playbooks/roles/wordpress/tasks/main.yml @@ -0,0 +1,187 @@ +--- +- 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 + +# - 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: && tar +# 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/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 @@ + Date: Thu, 18 Jan 2018 00:57:35 -0500 Subject: [PATCH 18/21] removing unnecessary comments --- playbooks/roles/wordpress/tasks/main.yml | 132 ----------------------- 1 file changed, 132 deletions(-) diff --git a/playbooks/roles/wordpress/tasks/main.yml b/playbooks/roles/wordpress/tasks/main.yml index 838b313..4879de8 100644 --- a/playbooks/roles/wordpress/tasks/main.yml +++ b/playbooks/roles/wordpress/tasks/main.yml @@ -53,135 +53,3 @@ state=link notify: - restart nginx - -# - 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: && tar -# 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 - From 4efb729901ee7c1305d3f5acf6aa356512e23e90 Mon Sep 17 00:00:00 2001 From: Ryan Marrs Date: Thu, 18 Jan 2018 00:58:21 -0500 Subject: [PATCH 19/21] defaulted to all environments on --- playbooks/vagrant.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/playbooks/vagrant.yml b/playbooks/vagrant.yml index 35c6591..21a1fca 100644 --- a/playbooks/vagrant.yml +++ b/playbooks/vagrant.yml @@ -15,7 +15,7 @@ - php - php-devtools - php-fpm -# - cakephp -# - laravel-quickstart -# - symfony-standard + - cakephp + - laravel-quickstart + - symfony-standard - wordpress From 2c8d9780b6e027f082e140c3e3c9fa1db441f815 Mon Sep 17 00:00:00 2001 From: Ryan Marrs Date: Thu, 18 Jan 2018 01:01:09 -0500 Subject: [PATCH 20/21] update Readme.md --- Readme.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index aefd40b..ef20976 100644 --- a/Readme.md +++ b/Readme.md @@ -16,7 +16,7 @@ Installation * 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 folders symfony-standard, laravel-quickstart, cakephp 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 these folders directly on your host computer using your favourite IDE. Changes done there will be reflected directly on the vagrant box as the @@ -41,6 +41,7 @@ Installed components * [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) From c764b39b03219ba7bca8e2bfc608ef3b760e408d Mon Sep 17 00:00:00 2001 From: Ryan Marrs Date: Mon, 26 Feb 2018 15:41:01 -0500 Subject: [PATCH 21/21] removed system update - hangs --- playbooks/roles/base/tasks/main.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/playbooks/roles/base/tasks/main.yml b/playbooks/roles/base/tasks/main.yml index 56b4ead..c536f4d 100644 --- a/playbooks/roles/base/tasks/main.yml +++ b/playbooks/roles/base/tasks/main.yml @@ -10,9 +10,6 @@ - npm - ruby -- name: System upgrade - command: apt-get upgrade -y -qq - - name: Install NodeJS shell: curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - && sudo apt-get install -y nodejs