From 0d65b499619d51b8d392c356d8bac56643468848 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Mon, 4 Jun 2018 19:50:10 +0100 Subject: [PATCH 01/86] Update projects role to skip MySQL priviledge setup when db_user in projects config is empty --- roles/projects/tasks/projects-conf-mysql.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/projects/tasks/projects-conf-mysql.yml b/roles/projects/tasks/projects-conf-mysql.yml index d1f03aa..98a40c4 100644 --- a/roles/projects/tasks/projects-conf-mysql.yml +++ b/roles/projects/tasks/projects-conf-mysql.yml @@ -17,4 +17,4 @@ append_privs: yes with_items: - "{{ projects }}" - when: item.db_user is defined + when: item.db_user != "" From e7a5552cb902bde8bb3449d9fb6cbab037eb334e Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Thu, 7 Jun 2018 08:48:55 +0100 Subject: [PATCH 02/86] Increase VM memory --- Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index d1c31d0..fb6a420 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -30,7 +30,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.provider "virtualbox" do |vb| vb.name = "devbox" vb.cpus = 2 - vb.customize ["modifyvm", :id, "--memory", "1024"] + vb.customize ["modifyvm", :id, "--memory", "2048"] end # Workaround for ubuntu/xenial not having /usr/bin/python From 121a9931ba323b6a420d7a419dae332ff7d47f98 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Thu, 7 Jun 2018 13:58:07 +0100 Subject: [PATCH 03/86] Enable NFS support with bindfs for directory mapping --- Vagrantfile | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index fb6a420..53bd391 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -3,7 +3,7 @@ # Look at default.config.yml for setting configuration parameters on this file. VAGRANTFILE_API_VERSION = "2" -required_plugins = %w(vagrant-hostsupdater) +required_plugins = %w(vagrant-hostsupdater vagrant-bindfs) plugins_to_install = required_plugins.select { |plugin| not Vagrant.has_plugin? plugin } if not plugins_to_install.empty? @@ -17,13 +17,24 @@ end Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| - # Create devbox with vagrant parameters + # Define VM parameters config.vm.define "devbox" do |devbox| + + # Operating system devbox.vm.box = "ubuntu/xenial64" + + # Network devbox.vm.hostname = "dev.box" devbox.vm.network "private_network", ip: "10.10.10.10" - devbox.vm.synced_folder "~/projects", "/home/ubuntu/projects", - owner: "ubuntu", group: "www-data", mount_options: ["dmode=775,fmode=664"] + + # Folders + devbox.vm.synced_folder "~/projects", "/home/ubuntu/nfs", type: "nfs" + + devbox.bindfs.bind_folder "/home/ubuntu/nfs", "/home/ubuntu/projects", + perms: "u=rwX:g=rwD", + force_user: "ubuntu", + force_group: "www-data", + create_as_user: true end # Virtualbox parameters From 998df0b3a356b399b5af02715193bc933baeb599 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Thu, 7 Jun 2018 15:52:48 +0100 Subject: [PATCH 04/86] Enable Vagrantfile to read parameters from config.yml --- Vagrantfile | 42 +++++++++++++++++++++++++++++++----------- default.config.yml | 42 +++++++++++++++++++++++++++--------------- 2 files changed, 58 insertions(+), 26 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 53bd391..895ad69 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,8 +1,26 @@ # Devbox Vagrant file. -# +require 'yaml' + # Look at default.config.yml for setting configuration parameters on this file. VAGRANTFILE_API_VERSION = "2" +# Load configuration parameters from config file. +config_yml = YAML.load_file("config.yml") + +# Project domains +project_domains = [] + +config_yml['projects'].each do |project| + project.each do |key, value| + if key == 'domain' and value != "" + project_domains.push(value) + end + end +end + +puts project_domains + +# Install if required and load plugins. required_plugins = %w(vagrant-hostsupdater vagrant-bindfs) plugins_to_install = required_plugins.select { |plugin| not Vagrant.has_plugin? plugin } @@ -15,33 +33,35 @@ if not plugins_to_install.empty? end end +# Start configuring Vagrant Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Define VM parameters - config.vm.define "devbox" do |devbox| + config.vm.define config_yml['vm_name'] do |devbox| # Operating system devbox.vm.box = "ubuntu/xenial64" # Network - devbox.vm.hostname = "dev.box" - devbox.vm.network "private_network", ip: "10.10.10.10" + devbox.vm.network "private_network", ip: config_yml['vm_ip'] + devbox.vm.hostname = config_yml['vm_hostname'] + devbox.hostsupdater.aliases = project_domains # Folders - devbox.vm.synced_folder "~/projects", "/home/ubuntu/nfs", type: "nfs" + devbox.vm.synced_folder config_yml['host_path'], config_yml['tmp_path'], type: config_yml['vm_network_type'] - devbox.bindfs.bind_folder "/home/ubuntu/nfs", "/home/ubuntu/projects", - perms: "u=rwX:g=rwD", - force_user: "ubuntu", - force_group: "www-data", + devbox.bindfs.bind_folder config_yml['tmp_path'], config_yml['guest_path'], + perms: config_yml['vm_folder_perm'], + force_user: config_yml['vm_user'], + force_group: config_yml['vm_group'], create_as_user: true end # Virtualbox parameters config.vm.provider "virtualbox" do |vb| - vb.name = "devbox" + vb.name = config_yml['vm_name'] vb.cpus = 2 - vb.customize ["modifyvm", :id, "--memory", "2048"] + vb.customize ["modifyvm", :id, "--memory", config_yml['vm_ram']] end # Workaround for ubuntu/xenial not having /usr/bin/python diff --git a/default.config.yml b/default.config.yml index daf8253..e620473 100644 --- a/default.config.yml +++ b/default.config.yml @@ -2,6 +2,26 @@ # Configuration variables. # ############################ +# Machine +vm_name: "devbox" +vm_hostname: "dev.box" +vm_ram: "2048" +vm_ip: "10.10.10.10" +vm_user: "ubuntu" +vm_group: "www-data" + +# Folder mapping +vm_network_type: "nfs" +vm_folder_perm: "u=rwX:g=rwD" +host_path: "~/projects" +guest_path: "/home/ubuntu/projects" +tmp_path: "/home/ubuntu/nfs" + +# Git configuration +git_user: "" +git_eemail: "" +git_rsa_key: "" + # Remote user name used in devbox remote_user: ubuntu @@ -22,7 +42,7 @@ config_roles: - projects # Projects root -projects_root: "/home/{{ remote_user }}/projects" +projects_path: "{{ guest_path }}" # Projects # @@ -40,24 +60,16 @@ projects_root: "/home/{{ remote_user }}/projects" projects: - - domain: "d8.demo" - project: "{{ projects_root }}/D8/00-DEMO" - docroot: "tech/web" + - domain: "" + project: "" + docroot: "" db_user: "" db_pass: "" - db_name: "d8demo" - tech: "drupal" - - # - domain: "" - # project: "" - # docroot: "" - # db_user: "" - # db_pass: "" - # db_name: "" - # tech: "" + db_name: "" + tech: "" ## TODO - + # Additional packages # # Add additional packages in the variable below to be included in the server, From e87e04bdf6fa382e978f3ac7425703cb2cbb91ba Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Thu, 7 Jun 2018 23:05:12 +0100 Subject: [PATCH 05/86] Enable automatic git config --- Vagrantfile | 2 -- default.config.yml | 2 +- roles/common/files/ssh_config | 3 --- roles/common/tasks/main.yml | 29 ++++++++++++++++++++--------- roles/common/templates/gitconfig | 4 ++++ roles/common/templates/ssh_config | 7 +++++++ 6 files changed, 32 insertions(+), 15 deletions(-) delete mode 100644 roles/common/files/ssh_config create mode 100644 roles/common/templates/gitconfig create mode 100644 roles/common/templates/ssh_config diff --git a/Vagrantfile b/Vagrantfile index 895ad69..86df9cc 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -18,8 +18,6 @@ config_yml['projects'].each do |project| end end -puts project_domains - # Install if required and load plugins. required_plugins = %w(vagrant-hostsupdater vagrant-bindfs) plugins_to_install = required_plugins.select { |plugin| not Vagrant.has_plugin? plugin } diff --git a/default.config.yml b/default.config.yml index e620473..d4bf684 100644 --- a/default.config.yml +++ b/default.config.yml @@ -19,7 +19,7 @@ tmp_path: "/home/ubuntu/nfs" # Git configuration git_user: "" -git_eemail: "" +git_email: "" git_rsa_key: "" # Remote user name used in devbox diff --git a/roles/common/files/ssh_config b/roles/common/files/ssh_config deleted file mode 100644 index 101dc72..0000000 --- a/roles/common/files/ssh_config +++ /dev/null @@ -1,3 +0,0 @@ -Host github.com - HostName github.com - IdentityFile ~/.ssh/id_rsa diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index 9a095f4..f83739c 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -28,18 +28,29 @@ - name: Add user RSA key copy: - src: "{{ rsa_key }}" - dest: "~/.ssh/id_rsa" + src: "{{ git_rsa_key }}" + dest: "{{ git_rsa_key_dest }}" mode: 0400 - name: Add SSH config - copy: - src: ssh_config + template: + src: "ssh_config" dest: "~/.ssh/config" backup: yes -- name: Add Github fingerprint to known_hosts file - shell: "ssh-keyscan -H github.com >> ~/.ssh/known_hosts" - args: - creates: "~/.ssh/known_hosts" - +- name: Add global Git config file + template: + src: "gitconfig" + dest: "~/.gitconfig" + +# - name: Read number of known_hosts +# command: wc -l ~/.ssh/known_hosts +# register: number_of_known_hosts + +# - name: Add RSA fingerprint of repositories to known_hosts +# shell: "ssh-keyscan -H {{ item.host }} >> ~/.ssh/known_hosts" +# with_items: +# - "{{ repositories }}" +# args: +# creates: "~/.ssh/known_hosts" + diff --git a/roles/common/templates/gitconfig b/roles/common/templates/gitconfig new file mode 100644 index 0000000..526e84c --- /dev/null +++ b/roles/common/templates/gitconfig @@ -0,0 +1,4 @@ +[user] + name = {{ git_user }} + email = {{ git_email }} + diff --git a/roles/common/templates/ssh_config b/roles/common/templates/ssh_config new file mode 100644 index 0000000..42c6e93 --- /dev/null +++ b/roles/common/templates/ssh_config @@ -0,0 +1,7 @@ +{% for repo in repositories %} +Host {{ repo.name }} + HostName {{ repo.host }} + IdentityFile {{ git_rsa_key_dest }} + +{% endfor %} + From e13113fe1f1ba7467933d535fa741ad16b3f708f Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Thu, 7 Jun 2018 23:06:06 +0100 Subject: [PATCH 06/86] Update README with inforation about git --- README.md | 83 +++++++++++++++++++++---------------------------------- 1 file changed, 32 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index e386756..bc5487b 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Devbox works with the following software: Devbox assumes that projects are developed with Git and requires a valid RSA key from the local user which has been added in Github. -## Usage +## Install Get devbox in your local machine: @@ -38,13 +38,33 @@ environment: vagrant up ``` +## Usage + You can login to the devbox with the following command: ``` vagrant ssh ``` -Happy coding! See below for configuration parameters. +For changes that affect the operation of the server in `config.yml` you need +to reprovision the environment (e.g. when adding new projects): + +``` +vagrant provision +``` + +For changes that the virtual machine in `config.yml` you need to reload the +configuration (e.g. change the IP address): + +``` +varnish reload +``` + +To access vagrant help: + +``` +vagrant help +``` ## Configuration @@ -56,11 +76,14 @@ variables contained within. The `remote_user` variable is used to set the user in the guest machine. The default user in Vagrant is ubuntu and is reccomended to be left as is. -### Configuring an RSA key +### Configuring Git, an RSA key and repositories -The `rsa_key` variable accepts as input a path from the host machine which -should resolve to an rsa key. It is used to authenticate in github and should be -added there prior to any git related operations in the development server. +The git configuration section contains variables that control the configuration +of Git and RSA keys. You can control how your local key is named in devbox so +you can add your development key indepedently of any other key already set. + +The repositories configuration section contains a variable that is used to setup +the devbox `~/.ssh/config` file. ### Configuring the server stack @@ -102,6 +125,9 @@ For each project the following parameters can be set: - drupal - symfony +Each project has an associated domain which is being automatically discovered by +vagrant and added to your `/etc/hosts`. + ### Configuring additional software to be added The `additional_packages` variable allows additional software to be included in @@ -122,51 +148,6 @@ that file there are parameters about: Please follow through [vagrant documentation](https://www.vagrantup.com/docs/) for a more thorough understanding of how it can be tweaked. -## Usage - -### Using Vagrant - -To connect to the VM use the following: - -``` -vagrant ssh -``` - -For changes in `config.yml` to take effect use: - -``` -vagrant provision -``` - -For changes in `Vagrantfile` to take effect vagrant configuration need to be roloaded: - -``` -varnish reload -``` - -Access help via: - -``` -vagrant help -``` - -### Accessing projects - -Devbox listens to a private network with IP set to 10.10.10.10. Add an entry per -project in your `/etc/hosts` file: - -``` -10.10.10.10 PROJECT_DOMAIN -``` - -Then point your browser to the domain in port 8000: - -``` -http://PROJECT_DOMAIN -``` - -You should see the homepage of your project. - ## Contributions Everyone is welcome to contribute. The most established way to do so in github From f0024e6a6d0d76c74a23159cde47125acb16cb30 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Thu, 7 Jun 2018 23:52:54 +0100 Subject: [PATCH 07/86] Enabled auto configuration of known_hosts --- roles/common/tasks/main.yml | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index f83739c..5801446 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -43,14 +43,18 @@ src: "gitconfig" dest: "~/.gitconfig" -# - name: Read number of known_hosts -# command: wc -l ~/.ssh/known_hosts -# register: number_of_known_hosts - -# - name: Add RSA fingerprint of repositories to known_hosts -# shell: "ssh-keyscan -H {{ item.host }} >> ~/.ssh/known_hosts" -# with_items: -# - "{{ repositories }}" -# args: -# creates: "~/.ssh/known_hosts" - +- name: Register number of entries in known_hosts + shell: "cat ~/.ssh/known_hosts | wc -l" + register: number_of_known_hosts + +- name: Remove known_hosts + shell: "rm -fr ~/.ssh/known_hosts" + when: rebuild_known_hosts + args: + warn: false + +- name: Add RSA fingerprint of repositories to known_hosts + shell: "ssh-keyscan -H {{ item.host }} >> ~/.ssh/known_hosts" + with_items: + - "{{ repositories }}" + when: rebuild_known_hosts or repositories_count > number_of_known_hosts.stdout From 5f8e94f8769cc6e85488a2522ff1f6f0f4cd7732 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Fri, 8 Jun 2018 23:11:37 +0100 Subject: [PATCH 08/86] Clean up default.config.yml file --- default.config.yml | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/default.config.yml b/default.config.yml index d4bf684..9b6f070 100644 --- a/default.config.yml +++ b/default.config.yml @@ -20,35 +20,34 @@ tmp_path: "/home/ubuntu/nfs" # Git configuration git_user: "" git_email: "" -git_rsa_key: "" +git_rsa_key: "~/.ssh/id_rsa" +git_rsa_key_dest: "~/.ssh/id_rsa" + +# Repositories +repositories: + - { name: github, host: github.com } + - { name: bitbucket, host: bitbucket.com} + +repositories_count: "{{ repositories | length }}" +rebuild_known_hosts: false # Remote user name used in devbox remote_user: ubuntu -# RSA key location -rsa_key: "~/.ssh/id_rsa" - -# Configuration of server stack -# -# Configuration of devbox functionality. -# -# Comment out the parameters that are not needed to ensure that roles are not -# included in the project. -# +# Software stack config_roles: - apache - php - mysql - projects -# Projects root +# Projects + +# Projects path projects_path: "{{ guest_path }}" -# Projects -# -# Dictionary to add projects. -# Parameters: -# domain - string - URL to be used from host machine to access project. +# Project parameters +# # docroot - string - the location of the project in devbox. It's syntax # contains {{ remote_user }} to make it box indepedent. # db_user - string - the name of the database user to be used (empty for root) @@ -71,8 +70,6 @@ projects: ## TODO # Additional packages -# -# Add additional packages in the variable below to be included in the server, -additional_packages: - # - uncomment here + +# Additional tasks From 5a9e07728df72a6f17249b09df158228858e66d9 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Sat, 9 Jun 2018 10:23:02 +0100 Subject: [PATCH 09/86] Update README --- README.md | 85 ++++++++++++++++++++++++------------------------------- 1 file changed, 37 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index bc5487b..dd35f8e 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ environment: vagrant up ``` -## Usage +## Basic usage You can login to the devbox with the following command: @@ -71,10 +71,15 @@ vagrant help The development environment can be customised via the `config.yml` file and the variables contained within. -### Configuring a remote user +### Configuring the VM -The `remote_user` variable is used to set the user in the guest machine. The -default user in Vagrant is ubuntu and is reccomended to be left as is. +The virtual machine can be automatically configured via the variables in +**Machine** and **Folder mapping**. There are a number of options that allow +devbox to operate in various conditions. + +Folder mapping is achieved through NFS and bindfs to ensure that permisions are +set as expected. By default devbox is using 775 for directories and 644 for +files but behaviour can be overriden via `vm_folder_perm`. ### Configuring Git, an RSA key and repositories @@ -83,50 +88,40 @@ of Git and RSA keys. You can control how your local key is named in devbox so you can add your development key indepedently of any other key already set. The repositories configuration section contains a variable that is used to setup -the devbox `~/.ssh/config` file. +the devbox `~/.ssh/config` file. Public key fingerprints can be used to validate +a connection to a remote server. Devbox automatically adds RSA fingerprints +in `~/.ssh/known_hosts` for the repositories declared. ### Configuring the server stack The `config_roles` variable is used to customise the software stack configured in the server. Comment out roles not needed. -### Configuring your projects +### Configuring projects Vagrant allows to share directories between the host and the guest systems. Devbox takes advantage of that feature to expose local projects which can then be served through the LAMP stack. -Devbox expects a `projects` folder to exist in the same contains directory with -devbox: - -``` -. -├── devbox -└── projects - ├── projectA - ├── projectB - └── projectC -``` - -All directories contained withing projects will be exposed in `~/projects` in -the guest system. - -For each project the following parameters can be set: - -- domain (string): The URI to access project. -- docroot (string) The path of the project in devbox (user `{{ remote_user }}` - for indepedence -- db_user (string): The name of the database user to be used (root will be used - if empty) -- db_pass (string): The passwrd of the database user to be used (root will be used if empty) -- db_name (string): The database name to be used (if empty database creation is skipped) -- tech (string): The technology used in the project. Options include: - - hugo - - drupal - - symfony - -Each project has an associated domain which is being automatically discovered by -vagrant and added to your `/etc/hosts`. +Devbox is configurable to act as a standalone server hosting many projects or as +a development environment within a particular project. In either case it expects +that the folder containing the project or projects to be declared via +`projects_path`. + +Each project is configured via the `projects` dictionary which accepts the +following parameters: + + - **domain** (_string_): The URI to access project in the browser. The value is + automatically picked up and added to `/etc/hosts`. + - **docroot** (_string_) The path of the project in devbox. Can be any + location or combined with `projects_path`. + - **db_user** (_string_): The database user to be used. User is added if does + not exist. Leave empty to use root. + - **db_pass** (_string_): The database password for the user above. Leave empty to + use root's password. + - **db_name** (_string_): The database to be used. If empty database creation is skipped + - **tech** (_string_): The technology used in the project. Options include: + empty, hugo, drupal, wordpress, symfony. ### Configuring additional software to be added @@ -135,18 +130,12 @@ the main build. It is intended for smaller packages that do not require customisation. If more software with significant customisation is needed consider to open a pull request. -### Configuring Vagrant - -Devbox offers a complete development environment out of the box. Vagrant is -controled through a `Vagrantfile` bunlded at the root of the repository. Within -that file there are parameters about: - - - vagrant options about the base image, synchronising folders, network, etc - - virtual machine options about memory, etc - - provision options about ansible +### Configuring additional tasks to be performed -Please follow through [vagrant documentation](https://www.vagrantup.com/docs/) -for a more thorough understanding of how it can be tweaked. +The `additional_tasks` variable allows additional tasks to be performed after +the server has been provisioned. This can be used for some adhoc configuration +like downloading emacs configuration specific to the user or adding custom +aliases to `.bashrc`. ## Contributions From 8416125f7d334e92f600100498733109f8072a21 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Sat, 9 Jun 2018 10:23:46 +0100 Subject: [PATCH 10/86] Remove use of reserved remote_user variable --- default.config.yml | 3 --- playbook.yml | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/default.config.yml b/default.config.yml index 9b6f070..e356075 100644 --- a/default.config.yml +++ b/default.config.yml @@ -31,9 +31,6 @@ repositories: repositories_count: "{{ repositories | length }}" rebuild_known_hosts: false -# Remote user name used in devbox -remote_user: ubuntu - # Software stack config_roles: - apache diff --git a/playbook.yml b/playbook.yml index 20a7704..8c64454 100644 --- a/playbook.yml +++ b/playbook.yml @@ -5,7 +5,7 @@ ########################################## - hosts: all - remote_user: "{{ remote_user }}" + remote_user: "{{ vm_user }}" vars_files: - config.yml gather_facts: yes From 5eeb7f256984cd2494a9ddb02974d0cea72ead2e Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Sat, 9 Jun 2018 11:11:12 +0100 Subject: [PATCH 11/86] Update PHP role for correct xdebug setup --- roles/php/files/xdebug.ini | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/roles/php/files/xdebug.ini b/roles/php/files/xdebug.ini index ce6fe0d..bd50eff 100644 --- a/roles/php/files/xdebug.ini +++ b/roles/php/files/xdebug.ini @@ -1,5 +1,6 @@ zend_extension=xdebug.so -xdebug.remote_enable=1 -xdebug.remote_port=9000 -xdebug.remote_handle=dbgp -xdebug_remote_connect_back=1 +xdebug.remote_enable = On +xdebug.remote_port = 9000 +xdebug.remote_handle = dbgp +xdebug.remote_connect_back = On +xdebug.remote_autostart = On From 4fecc697c854d24c63c1778ec5e3092e553db993 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Sat, 9 Jun 2018 18:31:21 +0100 Subject: [PATCH 12/86] Enable PHP FPM with xdebug --- roles/apache/tasks/main.yml | 9 +++++---- roles/apache/vars/main.yml | 8 +++++++- roles/php/vars/main.yml | 2 +- roles/projects/tasks/projects-conf-apache.yml | 7 +++++++ roles/projects/templates/generic.vhost.j2 | 7 +++++++ 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/roles/apache/tasks/main.yml b/roles/apache/tasks/main.yml index f9e07ef..5ebf984 100644 --- a/roles/apache/tasks/main.yml +++ b/roles/apache/tasks/main.yml @@ -1,18 +1,19 @@ --- -- name: Install packages +- name: Install Apache server become: yes apt: name: "{{ item }}" state: present - with_items: "{{ packages_apache }}" + with_items: "{{ apache_packages }}" notify: restart apache -- name: Enable Apache mod_rewrite +- name: Enable Apache modules become: yes apache2_module: - name: rewrite + name: "{{ item }}" state: present + with_items: "{{ apache_modules }}" notify: restart apache # TODO: Add configuration to harden the server (signature off, etc) diff --git a/roles/apache/vars/main.yml b/roles/apache/vars/main.yml index af8e0c8..3e8f60b 100644 --- a/roles/apache/vars/main.yml +++ b/roles/apache/vars/main.yml @@ -3,6 +3,12 @@ server_admin: admin@example.com # Software packages to be installed. -packages_apache: +apache_packages: - apache2 - apache2-utils + +apache_modules: + - rewrite + - proxy + - proxy_fcgi + diff --git a/roles/php/vars/main.yml b/roles/php/vars/main.yml index d8a50e9..d8f9169 100644 --- a/roles/php/vars/main.yml +++ b/roles/php/vars/main.yml @@ -15,4 +15,4 @@ packages_php: - php7.0-zip - php7.0-mbstring - php-xdebug - - libapache2-mod-php + diff --git a/roles/projects/tasks/projects-conf-apache.yml b/roles/projects/tasks/projects-conf-apache.yml index 42c97c4..65a27f2 100644 --- a/roles/projects/tasks/projects-conf-apache.yml +++ b/roles/projects/tasks/projects-conf-apache.yml @@ -1,5 +1,12 @@ --- +- name: Register PHP FPM socket + shell: "cat {{ php_config_dir }}/fpm/pool.d/www.conf | grep 'fpm.sock' | cut -f2 -d '=' | tr -d ' '" + register: php_fpm_socket + +- debug: + var: php_fpm_socket.stdout + - name: Create project docroots become: yes file: diff --git a/roles/projects/templates/generic.vhost.j2 b/roles/projects/templates/generic.vhost.j2 index f626edc..f69d095 100644 --- a/roles/projects/templates/generic.vhost.j2 +++ b/roles/projects/templates/generic.vhost.j2 @@ -9,6 +9,13 @@ DocumentRoot {{ item.project }}/{{ item.docroot }} Require all granted + + + + + SetHandler "proxy:unix:{{ php_fpm_socket.stdout }}|fcgi://localhost/" + + ErrorLog /var/log/apache2/{{ item.domain }}_error.log CustomLog /var/log/apache2/{{ item.domain }}_access.log combined From 953048b9bebafc36af95736f653ac965e1abd015 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Sat, 9 Jun 2018 19:06:26 +0100 Subject: [PATCH 13/86] Update README with instructions to setup Eclipse with xdebug --- README.md | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index dd35f8e..11c4530 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,6 @@ Devbox works with the following software: - VirtualBox - Ubuntu Xenial 16.04 -Devbox assumes that projects are developed with Git and requires a valid RSA key -from the local user which has been added in Github. - ## Install Get devbox in your local machine: @@ -40,21 +37,21 @@ vagrant up ## Basic usage -You can login to the devbox with the following command: +Login to devbox via SSH: ``` vagrant ssh ``` -For changes that affect the operation of the server in `config.yml` you need -to reprovision the environment (e.g. when adding new projects): +For server changes in `config.yml` to take effect (e.g. add a new project) you +need to reprovision the environment: ``` vagrant provision ``` -For changes that the virtual machine in `config.yml` you need to reload the -configuration (e.g. change the IP address): +For virtual machine changes in `config.yml` to take effect (e.g. change the IP +address) you need to reload the configuration: ``` varnish reload @@ -123,6 +120,39 @@ following parameters: - **tech** (_string_): The technology used in the project. Options include: empty, hugo, drupal, wordpress, symfony. +### Configuring Xdebug +Xdebug is enabled by default but you would need to set it up to your IDE. For +Eclipse you need to do the following: + + 1. Add a new server + 2. Configure the new server with xdebug + 3. Run the debugger + +To setup a server go to `Window > Preferences > PHP > Servers` and add new. It +will ask for the following: + + - Server tab + - Server name: add the individual project name + - Base url: the domain configured in project + - Document root: the location of the project on your host system + - Debbuger tab + - Debugger: xdebug + - Port: 9000 + +Next locate a file from your project in PHP Explorer, right click and select +`Debug as > Debug configurations`. It will ask for the following: + + - Server tab + - PHP server: select the one you just created + - File: select the project index file + - Debuger tab + - Ensure XDebug is selected + - Enable 'Break At First Line' + - Click debug + +This will launch a new window and a dialog box will appear informing about the +debug perspective in Eclipse. Accept and start debugging. + ### Configuring additional software to be added The `additional_packages` variable allows additional software to be included in From 4d4c8cc9d1a39278b720325a76ba1e01b2652a0d Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Mon, 11 Jun 2018 10:44:06 +0100 Subject: [PATCH 14/86] Remove debug message from Projects role. --- roles/projects/tasks/projects-conf-apache.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/roles/projects/tasks/projects-conf-apache.yml b/roles/projects/tasks/projects-conf-apache.yml index 65a27f2..12a3f63 100644 --- a/roles/projects/tasks/projects-conf-apache.yml +++ b/roles/projects/tasks/projects-conf-apache.yml @@ -4,9 +4,6 @@ shell: "cat {{ php_config_dir }}/fpm/pool.d/www.conf | grep 'fpm.sock' | cut -f2 -d '=' | tr -d ' '" register: php_fpm_socket -- debug: - var: php_fpm_socket.stdout - - name: Create project docroots become: yes file: From f7df02a0e843592194d844b61bbaa8a9e217e1d3 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Mon, 11 Jun 2018 10:45:52 +0100 Subject: [PATCH 15/86] Removed apache role depedency from php role --- roles/php/meta/main.yml | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 roles/php/meta/main.yml diff --git a/roles/php/meta/main.yml b/roles/php/meta/main.yml deleted file mode 100644 index db4223c..0000000 --- a/roles/php/meta/main.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- - -dependencies: - - { role: apache } \ No newline at end of file From 91ac26719b7d26ad0a4599fff9f4eb5d24927cdf Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Mon, 11 Jun 2018 10:54:37 +0100 Subject: [PATCH 16/86] Add apache role depedency in projects role --- roles/projects/meta/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/projects/meta/main.yml b/roles/projects/meta/main.yml index 8516a7b..075ad61 100644 --- a/roles/projects/meta/main.yml +++ b/roles/projects/meta/main.yml @@ -1,5 +1,6 @@ --- dependencies: + - { role: apache } - { role: php } - { role: mysql } From 97a0062a85704e79d9af308e9a3589f0c12e2d5c Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Mon, 11 Jun 2018 11:39:31 +0100 Subject: [PATCH 17/86] Enable auto discovery of PHP config directory --- roles/php/tasks/main.yml | 7 +++++++ roles/php/vars/main.yml | 2 -- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/roles/php/tasks/main.yml b/roles/php/tasks/main.yml index e49632f..792d995 100644 --- a/roles/php/tasks/main.yml +++ b/roles/php/tasks/main.yml @@ -8,5 +8,12 @@ with_items: "{{ packages_php }}" notify: restart apache +- name: Register PHP config path + shell: "php --ini | grep 'Configuration File (php.ini) Path:' | cut -d ':' -f2 | tr -d ' ' | cut -d '/' -f1-4" + register: php_config_path + +- set_fact: + php_config_dir: "{{ php_config_path.stdout }}" + - include: php-xdebug.yml - include: php-composer.yml diff --git a/roles/php/vars/main.yml b/roles/php/vars/main.yml index d8f9169..546c4d0 100644 --- a/roles/php/vars/main.yml +++ b/roles/php/vars/main.yml @@ -1,6 +1,4 @@ --- -# PHP configuration directory. -php_config_dir: "/etc/php/7.0/" # PHP packages to be installed. packages_php: From 264b6b3ede1b2e1420314c775d6778a8e9a9ec6b Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Mon, 11 Jun 2018 11:49:55 +0100 Subject: [PATCH 18/86] Cleaned up tasks for xdebug setup --- roles/php/tasks/php-xdebug.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/roles/php/tasks/php-xdebug.yml b/roles/php/tasks/php-xdebug.yml index 2235b2a..62f0ca0 100644 --- a/roles/php/tasks/php-xdebug.yml +++ b/roles/php/tasks/php-xdebug.yml @@ -1,17 +1,5 @@ --- -# - name: Update xdebug config file -# blockinfile: -# path: "{{ php_config_dir }}/mods_available/xdebug.ini" -# block: | -# xdebug.remote_enable=1 -# xdebug.remote_port=9000 -# xdebug.remote_handle=dbgp -# xdebug_remote_connect_back=1 -# create: yes -# state: present -# backup: yes - - name: Copy xdebug.ini to appropriate location become: yes copy: From 14d5408b66e7ffee3708dfdeef8927d7b7fffefb Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Mon, 11 Jun 2018 12:57:49 +0100 Subject: [PATCH 19/86] Removed depedencies from projects role --- roles/projects/meta/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/projects/meta/main.yml b/roles/projects/meta/main.yml index 075ad61..653c41f 100644 --- a/roles/projects/meta/main.yml +++ b/roles/projects/meta/main.yml @@ -1,6 +1,6 @@ --- -dependencies: - - { role: apache } - - { role: php } - - { role: mysql } +# dependencies: +# - { role: apache } +# - { role: php } +# - { role: mysql } From d2f80f4742dec2677e1beb8bd8bfe54424cda0d3 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Mon, 11 Jun 2018 14:54:10 +0100 Subject: [PATCH 20/86] Update to ubuntu 18.04 (ubuntu/bionic64) --- Vagrantfile | 2 +- host_vars/devbox.yml | 4 ++-- roles/php/vars/main.yml | 19 +++++++++---------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 86df9cc..6d47377 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -38,7 +38,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.define config_yml['vm_name'] do |devbox| # Operating system - devbox.vm.box = "ubuntu/xenial64" + devbox.vm.box = "ubuntu/bionic64" # Network devbox.vm.network "private_network", ip: config_yml['vm_ip'] diff --git a/host_vars/devbox.yml b/host_vars/devbox.yml index f14f26a..feb115b 100644 --- a/host_vars/devbox.yml +++ b/host_vars/devbox.yml @@ -2,5 +2,5 @@ ansible_host: "127.0.0.1" ansible_port: "2222" -ansible_user: "ubuntu" -ansible_private_key_file: ".vagrant/machines/devbox/virtualbox/private_key" \ No newline at end of file +ansible_user: "vagrant" +ansible_private_key_file: ".vagrant/machines/devbox/virtualbox/private_key" diff --git a/roles/php/vars/main.yml b/roles/php/vars/main.yml index 546c4d0..e2c4808 100644 --- a/roles/php/vars/main.yml +++ b/roles/php/vars/main.yml @@ -2,15 +2,14 @@ # PHP packages to be installed. packages_php: - - php7.0 - - php7.0-mcrypt - - php7.0-cli - - php7.0-common - - php7.0-curl - - php7.0-dev - - php7.0-fpm - - php7.0-gd - - php7.0-zip - - php7.0-mbstring + - php + - php-cli + - php-common + - php-curl + - php-dev + - php-fpm + - php-gd + - php-zip + - php-mbstring - php-xdebug From 11ce591fe8caf011e771b676521b0da7e127f97d Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Mon, 11 Jun 2018 15:00:13 +0100 Subject: [PATCH 21/86] Update README for Ubuntu Bionic 18.04 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 11c4530..7238ee8 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Devbox works with the following software: - Vagrant >= 2.1.1 - Ansible >= 2.5 - VirtualBox - - Ubuntu Xenial 16.04 + - Ubuntu Bionic 18.04 ## Install From b2657586217000943208246cea5e5f52edf6b44f Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Tue, 12 Jun 2018 21:26:34 +0100 Subject: [PATCH 22/86] Amend default.config.yml to use the vagrant user instead of ubuntu for 18.04 --- default.config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/default.config.yml b/default.config.yml index e356075..09c7ece 100644 --- a/default.config.yml +++ b/default.config.yml @@ -7,15 +7,15 @@ vm_name: "devbox" vm_hostname: "dev.box" vm_ram: "2048" vm_ip: "10.10.10.10" -vm_user: "ubuntu" +vm_user: "vagrant" vm_group: "www-data" # Folder mapping vm_network_type: "nfs" vm_folder_perm: "u=rwX:g=rwD" host_path: "~/projects" -guest_path: "/home/ubuntu/projects" -tmp_path: "/home/ubuntu/nfs" +guest_path: "/home/vagrant/projects" +tmp_path: "/home/vagrant/nfs" # Git configuration git_user: "" From 8317f8c0455a63acc2b19d62390e2ad2917974a9 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Tue, 12 Jun 2018 21:25:26 +0100 Subject: [PATCH 23/86] Add logic for project setup based on type or git repo --- roles/projects/tasks/main.yml | 53 ++++++++++++++++++- roles/projects/tasks/projects-conf-apache.yml | 6 +-- .../tasks/projects-project-custom.yml | 5 ++ .../tasks/projects-project-drupal.yml | 5 ++ roles/projects/tasks/projects-project-git.yml | 7 +++ .../projects/tasks/projects-project-hugo.yml | 5 ++ .../tasks/projects-project-symfony.yml | 5 ++ roles/projects/templates/generic.vhost.j2 | 4 +- 8 files changed, 81 insertions(+), 9 deletions(-) create mode 100644 roles/projects/tasks/projects-project-custom.yml create mode 100644 roles/projects/tasks/projects-project-drupal.yml create mode 100644 roles/projects/tasks/projects-project-git.yml create mode 100644 roles/projects/tasks/projects-project-hugo.yml create mode 100644 roles/projects/tasks/projects-project-symfony.yml diff --git a/roles/projects/tasks/main.yml b/roles/projects/tasks/main.yml index 76f7daf..35fa1c4 100644 --- a/roles/projects/tasks/main.yml +++ b/roles/projects/tasks/main.yml @@ -1,4 +1,53 @@ --- -- include: projects-conf-apache.yml -- include: projects-conf-mysql.yml +- name: Register PHP FPM socket + shell: "cat {{ php_config_dir }}/fpm/pool.d/www.conf | grep 'fpm.sock' | cut -f2 -d '=' | tr -d ' '" + register: php_fpm_socket + +- name: Create project path or ensure it exists + file: + path: "{{ item.path }}" + group: www-data + mode: 0775 + state: directory + with_items: "{{ projects }}" + +- name: Discover which projects have .git files + stat: + path: "{{ item.path }}/.git" + with_items: "{{ projects }}" + register: dot_git + +# - debug: +# var: dot_git + +- name: Initialise projects with repositories + include_tasks: projects-project-git.yml + with_items: "{{ dot_git.results }}" + when: (item.stat.exists == false) and (item.item.repo is defined) and (item.item.repo != '') + +- name: Initialise custom or empty projects + include_tasks: projects-project-custom.yml + with_items: "{{ projects }}" + when: (item.repo == '') and (item.type == '' or item.type == 'custom') + +- name: Initialise Hugo projects + include_tasks: projects-project-hugo.yml + with_items: "{{ projects }}" + when: (item.repo == '') and (item.type == 'hugo') + +- name: Initialise Drupal projects + include_tasks: projects-project-drupal.yml + with_items: "{{ projects }}" + when: (item.repo == '') and (item.type == 'drupal') + +- name: Initialise Symfony projects + include_tasks: projects-project-symfony.yml + with_items: "{{ projects }}" + when: (item.repo == '') and (item.type == 'symfony') + +- name: Execute Apache config + include_tasks: projects-conf-apache.yml + +- name: Execute MySQL config + include_tasks: projects-conf-mysql.yml diff --git a/roles/projects/tasks/projects-conf-apache.yml b/roles/projects/tasks/projects-conf-apache.yml index 12a3f63..ef2444d 100644 --- a/roles/projects/tasks/projects-conf-apache.yml +++ b/roles/projects/tasks/projects-conf-apache.yml @@ -1,13 +1,9 @@ --- -- name: Register PHP FPM socket - shell: "cat {{ php_config_dir }}/fpm/pool.d/www.conf | grep 'fpm.sock' | cut -f2 -d '=' | tr -d ' '" - register: php_fpm_socket - - name: Create project docroots become: yes file: - path: "{{ item.project }}/{{ item.docroot }}" + path: "{{ item.path }}/{{ item.docroot }}" group: www-data mode: 0775 state: directory diff --git a/roles/projects/tasks/projects-project-custom.yml b/roles/projects/tasks/projects-project-custom.yml new file mode 100644 index 0000000..cb5df26 --- /dev/null +++ b/roles/projects/tasks/projects-project-custom.yml @@ -0,0 +1,5 @@ +--- + +- debug: + msg: "Project {{ item.domain }} is a custom or empty project." + diff --git a/roles/projects/tasks/projects-project-drupal.yml b/roles/projects/tasks/projects-project-drupal.yml new file mode 100644 index 0000000..84ab605 --- /dev/null +++ b/roles/projects/tasks/projects-project-drupal.yml @@ -0,0 +1,5 @@ +--- + +- debug: + msg: "Project {{ item.domain }} is a Drupal project." + diff --git a/roles/projects/tasks/projects-project-git.yml b/roles/projects/tasks/projects-project-git.yml new file mode 100644 index 0000000..569a62a --- /dev/null +++ b/roles/projects/tasks/projects-project-git.yml @@ -0,0 +1,7 @@ +--- + +- name: Clone repositories + git: + repo: "{{ item.item.repo }}" + dest: "{{ item.item.path }}" + diff --git a/roles/projects/tasks/projects-project-hugo.yml b/roles/projects/tasks/projects-project-hugo.yml new file mode 100644 index 0000000..9afc772 --- /dev/null +++ b/roles/projects/tasks/projects-project-hugo.yml @@ -0,0 +1,5 @@ +--- + +- debug: + msg: "Project {{ item.domain }} is a hugo project." + diff --git a/roles/projects/tasks/projects-project-symfony.yml b/roles/projects/tasks/projects-project-symfony.yml new file mode 100644 index 0000000..d32c951 --- /dev/null +++ b/roles/projects/tasks/projects-project-symfony.yml @@ -0,0 +1,5 @@ +--- + +- debug: + msg: "Project {{ item.domain }} is a symfony project." + diff --git a/roles/projects/templates/generic.vhost.j2 b/roles/projects/templates/generic.vhost.j2 index f69d095..4b75845 100644 --- a/roles/projects/templates/generic.vhost.j2 +++ b/roles/projects/templates/generic.vhost.j2 @@ -1,9 +1,9 @@ ServerName {{ item.domain }} -DocumentRoot {{ item.project }}/{{ item.docroot }} +DocumentRoot {{ item.path }}/{{ item.docroot }} - + Options FollowSymLinks AllowOverride All Require all granted From 7bb1eaf58d7923d414c8918594e7229bd4fec7f7 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Tue, 12 Jun 2018 22:20:35 +0100 Subject: [PATCH 24/86] Update conditionals to ensure that projects with .git are passed straight to apache tasks --- roles/projects/tasks/main.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/roles/projects/tasks/main.yml b/roles/projects/tasks/main.yml index 35fa1c4..4d1cb98 100644 --- a/roles/projects/tasks/main.yml +++ b/roles/projects/tasks/main.yml @@ -24,27 +24,27 @@ - name: Initialise projects with repositories include_tasks: projects-project-git.yml with_items: "{{ dot_git.results }}" - when: (item.stat.exists == false) and (item.item.repo is defined) and (item.item.repo != '') + when: (item.stat.exists == false) and (item.item.repo != '') -- name: Initialise custom or empty projects - include_tasks: projects-project-custom.yml - with_items: "{{ projects }}" - when: (item.repo == '') and (item.type == '' or item.type == 'custom') +# - name: Initialise custom or empty projects +# include_tasks: projects-project-custom.yml +# with_items: "{{ dot_git.results }}" +# when: (item.stat.exists == false) and (item.repo == '') and (item.type == '' or item.type == 'custom') -- name: Initialise Hugo projects - include_tasks: projects-project-hugo.yml - with_items: "{{ projects }}" - when: (item.repo == '') and (item.type == 'hugo') +# - name: Initialise Hugo projects +# include_tasks: projects-project-hugo.yml +# with_items: "{{ dot_git.results }}" +# when: (item.stat.exists == false) and (item.repo == '') and (item.type == 'hugo') - name: Initialise Drupal projects include_tasks: projects-project-drupal.yml - with_items: "{{ projects }}" - when: (item.repo == '') and (item.type == 'drupal') + with_items: "{{ dot_git.results }}" + when: (item.stat.exists == false) and (item.repo == '') and (item.type == 'drupal') -- name: Initialise Symfony projects - include_tasks: projects-project-symfony.yml - with_items: "{{ projects }}" - when: (item.repo == '') and (item.type == 'symfony') +# - name: Initialise Symfony projects +# include_tasks: projects-project-symfony.yml +# with_items: "{{ dot_git.results }}" +# when: (item.stat.exists == false) and (item.repo == '') and (item.type == 'symfony') - name: Execute Apache config include_tasks: projects-conf-apache.yml From a4972d8572ebc97e3e529cbfc3121e0037c0b36c Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Wed, 13 Jun 2018 16:58:07 +0100 Subject: [PATCH 25/86] Move composer to /usr/local/bin --- roles/php/tasks/php-composer.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/roles/php/tasks/php-composer.yml b/roles/php/tasks/php-composer.yml index 4deae42..ec89c71 100644 --- a/roles/php/tasks/php-composer.yml +++ b/roles/php/tasks/php-composer.yml @@ -1,17 +1,19 @@ --- -- name: Install composer +- name: Download and install composer shell: "curl -sS https://getcomposer.org/installer | php" args: - creates: "~/bin/composer" + creates: "/usr/local/bin/composer" -- name: Move composer to ~/bin - shell: "mv ~/composer.phar ~/bin/composer" +- name: Move composer to /usr/local/bin + shell: "sudo mv ~/composer.phar /usr/local/bin/composer" args: - creates: "~/bin/composer" + creates: "/usr/local/bin/composer" - name: Make composer executable + become: yes file: - path: "~/bin/composer" + path: "/usr/local/bin/composer" mode: a+x state: file + From 84c1402e7a1a34ef26bd18cfe38422fbf6aa2063 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Wed, 13 Jun 2018 16:59:07 +0100 Subject: [PATCH 26/86] Comment out code for setting up projects because composer is buggy --- roles/projects/tasks/main.yml | 10 +++++----- roles/projects/tasks/projects-project-symfony.yml | 14 +++++++++++++- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/roles/projects/tasks/main.yml b/roles/projects/tasks/main.yml index 4d1cb98..8ba4826 100644 --- a/roles/projects/tasks/main.yml +++ b/roles/projects/tasks/main.yml @@ -36,15 +36,15 @@ # with_items: "{{ dot_git.results }}" # when: (item.stat.exists == false) and (item.repo == '') and (item.type == 'hugo') -- name: Initialise Drupal projects - include_tasks: projects-project-drupal.yml - with_items: "{{ dot_git.results }}" - when: (item.stat.exists == false) and (item.repo == '') and (item.type == 'drupal') +# - name: Initialise Drupal projects +# include_tasks: projects-project-drupal.yml +# with_items: "{{ dot_git.results }}" +# when: (item.stat.exists == false) and (item.repo == '') and (item.type == 'drupal') # - name: Initialise Symfony projects # include_tasks: projects-project-symfony.yml # with_items: "{{ dot_git.results }}" -# when: (item.stat.exists == false) and (item.repo == '') and (item.type == 'symfony') +# when: (item.stat.exists == false) and (item.item.repo == '') and (item.type == 'symfony') - name: Execute Apache config include_tasks: projects-conf-apache.yml diff --git a/roles/projects/tasks/projects-project-symfony.yml b/roles/projects/tasks/projects-project-symfony.yml index d32c951..d6d2f16 100644 --- a/roles/projects/tasks/projects-project-symfony.yml +++ b/roles/projects/tasks/projects-project-symfony.yml @@ -1,5 +1,17 @@ --- - debug: - msg: "Project {{ item.domain }} is a symfony project." + msg: "Project {{ item.item.path }} is a symfony project." + +- composer: + command: "create-project" + arguments: "symfony/skeleton . --quiet" + working_dir: "{{ item.item.path }}" + +- name: Initialise git repo in the Symfony application + command: "git init ." + chdir: "{{ item.item.path }}" + args: + creates: "{{ item.item.path }}/.git" + From c1851981f4684399bf505f5f0acac5974efdcbd6 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Wed, 13 Jun 2018 22:05:36 +0100 Subject: [PATCH 27/86] Add motd --- roles/common/files/motd | 12 ++++++++++++ roles/common/tasks/main.yml | 7 +++++++ 2 files changed, 19 insertions(+) create mode 100644 roles/common/files/motd diff --git a/roles/common/files/motd b/roles/common/files/motd new file mode 100644 index 0000000..50712a6 --- /dev/null +++ b/roles/common/files/motd @@ -0,0 +1,12 @@ +#!/bin/sh + +cat << 'EOF' + + .o8 .o8 + "888 "888 +.oooo888 .ooooo. oooo ooo 888oooo. .ooooo. oooo ooo +d88' `888 d88' `88b `88. .8' d88' `88b d88' `88b `88b..8P' +888 888 888ooo888 `88..8' 888 888 888 888 Y888' +888 888 888 .o `888' 888 888 888 888 .o8"'88b +`Y8bod88P" `Y8bod8P' `8' `Y8bod8P' `Y8bod8P' o88' 888o + diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index 5801446..ab9dc63 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -13,6 +13,13 @@ state: present with_items: "{{ packages_utils }}" +- name: Update devbox motd + become: yes + copy: + src: "motd" + dest: "/etc/update-motd.d/00-a_motd_for_devbox" + mode: a+x + - name: Create ~/bin directory file: path: "~/bin" From 286689f31027ea42bcbe6fe2b6956457eaa93e78 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Fri, 19 Oct 2018 11:14:29 +0100 Subject: [PATCH 28/86] Update default.config.yml --- default.config.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/default.config.yml b/default.config.yml index 09c7ece..e079719 100644 --- a/default.config.yml +++ b/default.config.yml @@ -47,22 +47,25 @@ projects_path: "{{ guest_path }}" # # docroot - string - the location of the project in devbox. It's syntax # contains {{ remote_user }} to make it box indepedent. +# path - string - the main projects path # db_user - string - the name of the database user to be used (empty for root) # db_pass - string - the passwrd of the database user to be used (empty for # root) # db_name - string - the database name to be used (if empty database is # skipped) # tech - string - the technology used in the project (hugo, drupal, symfony) +# repo - string - git url of the project projects: - domain: "" - project: "" + path: "" docroot: "" db_user: "" db_pass: "" db_name: "" tech: "" + repo: "" ## TODO From ef9c2199696cb45f94defffe4de02860ecf21502 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Fri, 19 Oct 2018 16:09:53 +0100 Subject: [PATCH 29/86] Update devbox for Laravel support --- roles/common/tasks/main.yml | 12 +++--------- roles/common/vars/main.yml | 1 + roles/php/tasks/main.yml | 1 + roles/php/tasks/php-composer.yml | 9 +++++++++ roles/php/tasks/php-laravel.yml | 7 +++++++ 5 files changed, 21 insertions(+), 9 deletions(-) create mode 100644 roles/php/tasks/php-laravel.yml diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index ab9dc63..4cd6f61 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -2,9 +2,10 @@ - name: Update apt become: yes - apt: + apt: + upgrade: yes update_cache: yes - cache_valid_time: 8400 + cache_valid_time: 86400 #one day - name: Install utilities become: yes @@ -26,13 +27,6 @@ state: directory mode: 0775 -- name: Add ~/bin to PATH - lineinfile: - dest: "~/.profile" - regexp: "PATH" - line: "PATH=\"$HOME/bin:$PATH\"" - backup: yes - - name: Add user RSA key copy: src: "{{ git_rsa_key }}" diff --git a/roles/common/vars/main.yml b/roles/common/vars/main.yml index d4c55ac..520fcf0 100644 --- a/roles/common/vars/main.yml +++ b/roles/common/vars/main.yml @@ -12,3 +12,4 @@ packages_utils: - git - tmux - shellcheck + - unzip diff --git a/roles/php/tasks/main.yml b/roles/php/tasks/main.yml index 792d995..b37a825 100644 --- a/roles/php/tasks/main.yml +++ b/roles/php/tasks/main.yml @@ -17,3 +17,4 @@ - include: php-xdebug.yml - include: php-composer.yml +- include: php-laravel.yml diff --git a/roles/php/tasks/php-composer.yml b/roles/php/tasks/php-composer.yml index ec89c71..6cfc0e2 100644 --- a/roles/php/tasks/php-composer.yml +++ b/roles/php/tasks/php-composer.yml @@ -17,3 +17,12 @@ mode: a+x state: file +- name: Add Composer's system-wide vendor dir to path + blockinfile: + path: "~/.profile" + block: | + # set PATH so it includes Composer's system-wide vendor directory if it exists + if [ -d "$HOME/.config/composer/vendor/bin/" ] ; then + PATH="$HOME/.config/composer/vendor/bin/:$PATH" + fi + backup: yes diff --git a/roles/php/tasks/php-laravel.yml b/roles/php/tasks/php-laravel.yml new file mode 100644 index 0000000..8fe8cfc --- /dev/null +++ b/roles/php/tasks/php-laravel.yml @@ -0,0 +1,7 @@ +--- + +- name: Install Laravel installer + composer: + command: require + global_command: yes + arguments: "laravel/installer" From f79f60d9975e33d7fd4d7314582c7916e5551924 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Wed, 14 Nov 2018 11:53:45 +0000 Subject: [PATCH 30/86] Comment out ansible host_vars to use Vagrant autogenerated. --- host_vars/devbox.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/host_vars/devbox.yml b/host_vars/devbox.yml index feb115b..8cc35f0 100644 --- a/host_vars/devbox.yml +++ b/host_vars/devbox.yml @@ -1,6 +1,6 @@ --- -ansible_host: "127.0.0.1" -ansible_port: "2222" -ansible_user: "vagrant" -ansible_private_key_file: ".vagrant/machines/devbox/virtualbox/private_key" +# ansible_host: "127.0.0.1" +# ansible_port: "2222" +# ansible_user: "vagrant" +# ansible_private_key_file: ".vagrant/machines/devbox/virtualbox/private_key" From 91ee40ea9f0fd3209a9b7dcc452b2d86f65bd015 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Mon, 19 Nov 2018 16:47:15 +0000 Subject: [PATCH 31/86] Add vagrant-vbguest plugin to keep OS guest additions consistent for VirtualBox --- Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index 6d47377..b4da8f6 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -19,7 +19,7 @@ config_yml['projects'].each do |project| end # Install if required and load plugins. -required_plugins = %w(vagrant-hostsupdater vagrant-bindfs) +required_plugins = %w(vagrant-hostsupdater vagrant-bindfs vagrant-vbguest) plugins_to_install = required_plugins.select { |plugin| not Vagrant.has_plugin? plugin } if not plugins_to_install.empty? From 044916aff194ac595619ae1ac101fd216478d502 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Mon, 19 Nov 2018 16:47:55 +0000 Subject: [PATCH 32/86] Increase PHP memory limit to 1024 --- roles/php/tasks/main.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/roles/php/tasks/main.yml b/roles/php/tasks/main.yml index b37a825..4a795ea 100644 --- a/roles/php/tasks/main.yml +++ b/roles/php/tasks/main.yml @@ -15,6 +15,13 @@ - set_fact: php_config_dir: "{{ php_config_path.stdout }}" +- name: Update PHP memory limit + become: yes + lineinfile: + path: "{{ php_config_dir }}/fpm/php.ini" + regexp: "^memory_limit" + line: "memory_limit = 1024M" + - include: php-xdebug.yml - include: php-composer.yml - include: php-laravel.yml From d192be7d859a55b63f59cb056bd75037a9ac7ad8 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Tue, 20 Nov 2018 13:52:08 +0000 Subject: [PATCH 33/86] Remove enablereuse ProxyPass parameter from vhost config --- roles/projects/templates/generic.vhost.j2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/projects/templates/generic.vhost.j2 b/roles/projects/templates/generic.vhost.j2 index 4b75845..8f546f1 100644 --- a/roles/projects/templates/generic.vhost.j2 +++ b/roles/projects/templates/generic.vhost.j2 @@ -9,13 +9,13 @@ DocumentRoot {{ item.path }}/{{ item.docroot }} Require all granted - - - SetHandler "proxy:unix:{{ php_fpm_socket.stdout }}|fcgi://localhost/" + + + ErrorLog /var/log/apache2/{{ item.domain }}_error.log CustomLog /var/log/apache2/{{ item.domain }}_access.log combined From 98acadda91dfaabe9a9fb0de06f4ac3ab3c8b769 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Tue, 20 Nov 2018 13:57:40 +0000 Subject: [PATCH 34/86] Add htop utility --- roles/common/vars/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/roles/common/vars/main.yml b/roles/common/vars/main.yml index 520fcf0..949d9b6 100644 --- a/roles/common/vars/main.yml +++ b/roles/common/vars/main.yml @@ -13,3 +13,5 @@ packages_utils: - tmux - shellcheck - unzip + - htop + From e21814ce3de2700fe7fb1f1bc813dba88ea50e20 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Fri, 24 Jan 2020 14:01:33 +0000 Subject: [PATCH 35/86] Clean up project section of default.config.yml file --- default.config.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/default.config.yml b/default.config.yml index e079719..ead594d 100644 --- a/default.config.yml +++ b/default.config.yml @@ -56,16 +56,16 @@ projects_path: "{{ guest_path }}" # tech - string - the technology used in the project (hugo, drupal, symfony) # repo - string - git url of the project -projects: +#projects: - - domain: "" - path: "" - docroot: "" - db_user: "" - db_pass: "" - db_name: "" - tech: "" - repo: "" + #- domain: "" + #path: "" + #docroot: "" + #db_user: "" + #db_pass: "" + #db_name: "" + #tech: "" + #repo: "" ## TODO From 3ff5385038f67b0c05b66d314f52d41a455494ce Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Fri, 24 Jan 2020 14:03:41 +0000 Subject: [PATCH 36/86] Add Adminer support for MySQL web administration --- roles/mysql/tasks/main.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/roles/mysql/tasks/main.yml b/roles/mysql/tasks/main.yml index 57fad71..d5a9a62 100644 --- a/roles/mysql/tasks/main.yml +++ b/roles/mysql/tasks/main.yml @@ -42,3 +42,13 @@ dest: "~/.my.cnf" mode: 0600 when: not mysql_pass.stat.exists + +- name: Create Adminer directory + become: yes + file: + path: "/var/www/html/adminer" + state: directory + +- name: Download and install Adminer + become: yes + shell: "wget -q -O /var/www/html/adminer/index.php https://github.com/vrana/adminer/releases/download/v4.7.5/adminer-4.7.5-mysql-en.php" From 264c8e4d190518c22655032ed766e56d61007b04 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Fri, 24 Jan 2020 15:01:39 +0000 Subject: [PATCH 37/86] Remove with_items from apt module --- roles/apache/tasks/main.yml | 5 ++--- roles/common/tasks/main.yml | 3 +-- roles/mysql/tasks/main.yml | 3 +-- roles/php/tasks/main.yml | 5 ++--- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/roles/apache/tasks/main.yml b/roles/apache/tasks/main.yml index 5ebf984..ffecd77 100644 --- a/roles/apache/tasks/main.yml +++ b/roles/apache/tasks/main.yml @@ -1,11 +1,10 @@ --- -- name: Install Apache server +- name: Install Apache Web Server packages become: yes apt: - name: "{{ item }}" + name: "{{ apache_packages }}" state: present - with_items: "{{ apache_packages }}" notify: restart apache - name: Enable Apache modules diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index 4cd6f61..1f246f3 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -10,9 +10,8 @@ - name: Install utilities become: yes apt: - name: "{{ item }}" + name: "{{ packages_utils }}" state: present - with_items: "{{ packages_utils }}" - name: Update devbox motd become: yes diff --git a/roles/mysql/tasks/main.yml b/roles/mysql/tasks/main.yml index d5a9a62..fa01157 100644 --- a/roles/mysql/tasks/main.yml +++ b/roles/mysql/tasks/main.yml @@ -12,9 +12,8 @@ - name: Install MySQL packages become: yes apt: - name: "{{ item }}" + name: "{{ packages_mysql }}" state: present - with_items: "{{ packages_mysql }}" notify: restart mysql - name: Create MySQL root password diff --git a/roles/php/tasks/main.yml b/roles/php/tasks/main.yml index 4a795ea..f1c05e5 100644 --- a/roles/php/tasks/main.yml +++ b/roles/php/tasks/main.yml @@ -1,11 +1,10 @@ --- -- name: Install packages +- name: Install PHP packages become: yes apt: - name: "{{ item }}" + name: "{{ packages_php }}" state: present - with_items: "{{ packages_php }}" notify: restart apache - name: Register PHP config path From 0e2df3326aa37b8dce38ea383fe02aff39efae8e Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Fri, 24 Jan 2020 15:14:12 +0000 Subject: [PATCH 38/86] Create databases only if a database entry exists in config.yml file --- roles/projects/tasks/projects-conf-mysql.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/projects/tasks/projects-conf-mysql.yml b/roles/projects/tasks/projects-conf-mysql.yml index 98a40c4..b0fe45e 100644 --- a/roles/projects/tasks/projects-conf-mysql.yml +++ b/roles/projects/tasks/projects-conf-mysql.yml @@ -6,6 +6,7 @@ state: present with_items: - "{{ projects }}" + when: item.db_name != "" - name: Add users and privileges to project databases mysql_user: From a32d0fea17e0001e3fd997a0972a66236a51c1d5 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Fri, 24 Jan 2020 15:43:06 +0000 Subject: [PATCH 39/86] Update uprade apt command to not issue warning --- roles/common/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index 1f246f3..1fab955 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -3,7 +3,7 @@ - name: Update apt become: yes apt: - upgrade: yes + upgrade: "yes" update_cache: yes cache_valid_time: 86400 #one day From 5fdff4a3012f1f581dabb5d7a540103dd8932ea8 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Fri, 24 Jan 2020 15:43:45 +0000 Subject: [PATCH 40/86] Remove sudo from shell command during composer installation --- roles/php/tasks/php-composer.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/roles/php/tasks/php-composer.yml b/roles/php/tasks/php-composer.yml index 6cfc0e2..38f35f1 100644 --- a/roles/php/tasks/php-composer.yml +++ b/roles/php/tasks/php-composer.yml @@ -6,8 +6,10 @@ creates: "/usr/local/bin/composer" - name: Move composer to /usr/local/bin - shell: "sudo mv ~/composer.phar /usr/local/bin/composer" + become: yes + shell: "mv composer.phar /usr/local/bin/composer" args: + chdir: "/home/{{ vm_user }}" creates: "/usr/local/bin/composer" - name: Make composer executable From 500f3d8e2836343c77dfb9cd3567e7db688b1136 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Fri, 24 Jan 2020 15:47:38 +0000 Subject: [PATCH 41/86] Download Adminer only once --- roles/mysql/tasks/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/roles/mysql/tasks/main.yml b/roles/mysql/tasks/main.yml index fa01157..fc10c6d 100644 --- a/roles/mysql/tasks/main.yml +++ b/roles/mysql/tasks/main.yml @@ -51,3 +51,5 @@ - name: Download and install Adminer become: yes shell: "wget -q -O /var/www/html/adminer/index.php https://github.com/vrana/adminer/releases/download/v4.7.5/adminer-4.7.5-mysql-en.php" + args: + creates: "/var/www/html/adminer/index.php" From f62907b392bc17b6ece101a0fd2f1934334f7a59 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Fri, 24 Jan 2020 16:00:47 +0000 Subject: [PATCH 42/86] Added Ansible 2.0 compatibility mode --- Vagrantfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Vagrantfile b/Vagrantfile index b4da8f6..d4866e9 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -69,6 +69,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Provision with Ansible config.vm.provision "ansible" do |ansible| ansible.playbook = "playbook.yml" + ansible.compatibility_mode = "2.0" end end From 5ef79cf9405e02c91d8d1bf4d3fd7ff0b75a3f9f Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Fri, 24 Jan 2020 16:04:15 +0000 Subject: [PATCH 43/86] Remove warning from manual shell command invocation (composer & Adminer) --- roles/mysql/tasks/main.yml | 1 + roles/php/tasks/php-composer.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/roles/mysql/tasks/main.yml b/roles/mysql/tasks/main.yml index fc10c6d..8e07805 100644 --- a/roles/mysql/tasks/main.yml +++ b/roles/mysql/tasks/main.yml @@ -53,3 +53,4 @@ shell: "wget -q -O /var/www/html/adminer/index.php https://github.com/vrana/adminer/releases/download/v4.7.5/adminer-4.7.5-mysql-en.php" args: creates: "/var/www/html/adminer/index.php" + warn: false diff --git a/roles/php/tasks/php-composer.yml b/roles/php/tasks/php-composer.yml index 38f35f1..ed5ffcb 100644 --- a/roles/php/tasks/php-composer.yml +++ b/roles/php/tasks/php-composer.yml @@ -4,6 +4,7 @@ shell: "curl -sS https://getcomposer.org/installer | php" args: creates: "/usr/local/bin/composer" + warn: false - name: Move composer to /usr/local/bin become: yes From b8b630aa3f095bc7d0934be59ba07f0774519707 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Fri, 24 Jan 2020 16:39:50 +0000 Subject: [PATCH 44/86] Repaired MOTD file --- roles/common/files/motd | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/common/files/motd b/roles/common/files/motd index 50712a6..8bc14d4 100644 --- a/roles/common/files/motd +++ b/roles/common/files/motd @@ -10,3 +10,4 @@ d88' `888 d88' `88b `88. .8' d88' `88b d88' `88b `88b..8P' 888 888 888 .o `888' 888 888 888 888 .o8"'88b `Y8bod88P" `Y8bod8P' `8' `Y8bod8P' `Y8bod8P' o88' 888o +EOF From 58032ad06a8679325c6f49c6a9df44686ee4559d Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Mon, 27 Jan 2020 16:31:48 +0000 Subject: [PATCH 45/86] Update custom motd filename with dashes instead of underscores --- roles/common/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index 1fab955..bb94bae 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -17,7 +17,7 @@ become: yes copy: src: "motd" - dest: "/etc/update-motd.d/00-a_motd_for_devbox" + dest: "/etc/update-motd.d/00-devbox-motd" mode: a+x - name: Create ~/bin directory From 55b1802b31e3aca9d4276ba15a8ef228fa27b110 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Mon, 27 Jan 2020 17:07:08 +0000 Subject: [PATCH 46/86] Reformat heredoc for devbox motd --- roles/common/files/motd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/common/files/motd b/roles/common/files/motd index 8bc14d4..e5de228 100644 --- a/roles/common/files/motd +++ b/roles/common/files/motd @@ -2,7 +2,7 @@ cat << 'EOF' - .o8 .o8 + .o8 .o8 "888 "888 .oooo888 .ooooo. oooo ooo 888oooo. .ooooo. oooo ooo d88' `888 d88' `88b `88. .8' d88' `88b d88' `88b `88b..8P' From 3196e498ff58ad273344998e3b453c92bb2e7c24 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Tue, 4 Feb 2020 12:18:20 +0000 Subject: [PATCH 47/86] Update playbook.yml to execute additional roles when the variable is defined --- playbook.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/playbook.yml b/playbook.yml index 8c64454..75305e9 100644 --- a/playbook.yml +++ b/playbook.yml @@ -21,3 +21,4 @@ - "{{ config_roles }}" loop_control: loop_var: "roles" + when: config_roles is defined From 0bb4e0985e4590f70e3d857a300c6ae3fc9eb0d4 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Tue, 4 Feb 2020 12:20:03 +0000 Subject: [PATCH 48/86] Add Mautic PHP extension depedencies --- roles/php/vars/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/roles/php/vars/main.yml b/roles/php/vars/main.yml index e2c4808..8bbf696 100644 --- a/roles/php/vars/main.yml +++ b/roles/php/vars/main.yml @@ -11,5 +11,7 @@ packages_php: - php-gd - php-zip - php-mbstring + - php-mailparse + - php-imap - php-xdebug From 56d7cfcf175b59fabbfe1ba1f4707b96c8e6f6cf Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Tue, 4 Feb 2020 12:21:30 +0000 Subject: [PATCH 49/86] Add NodeSource apt repository and key --- roles/common/tasks/main.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index bb94bae..a28d7b1 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -1,5 +1,17 @@ --- +- name: Add NodeSource apt repository key + become: yes + apt_key: + url: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key" + state: present + +- name: Install NodeSource apt repository + become: yes + apt_repository: + repo: "deb https://deb.nodesource.com/node_10.x bionic main" + state: present + - name: Update apt become: yes apt: From 28322c9be12e3a40e27ee25478caa9c2405ab107 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Tue, 4 Feb 2020 12:47:53 +0000 Subject: [PATCH 50/86] Add nodejs role with Mautic nodejs depedencies --- roles/nodejs/tasks/main.yml | 15 +++++++++++++++ roles/nodejs/vars/main.yml | 9 +++++++++ 2 files changed, 24 insertions(+) create mode 100644 roles/nodejs/tasks/main.yml create mode 100644 roles/nodejs/vars/main.yml diff --git a/roles/nodejs/tasks/main.yml b/roles/nodejs/tasks/main.yml new file mode 100644 index 0000000..e883c1f --- /dev/null +++ b/roles/nodejs/tasks/main.yml @@ -0,0 +1,15 @@ +--- + +- name: Install NodeJS packages + become: yes + apt: + name: "{{ packages_node }}" + state: present + +- name: Install NPM packages + become: yes + npm: + name: "{{ item }}" + global: yes + state: present + with_items: "{{ packages_npm }}" diff --git a/roles/nodejs/vars/main.yml b/roles/nodejs/vars/main.yml new file mode 100644 index 0000000..c713b52 --- /dev/null +++ b/roles/nodejs/vars/main.yml @@ -0,0 +1,9 @@ +--- + +# NodeJS packages to be installed. +packages_node: + - nodejs + +# NPM packages to be installed. +packages_npm: + - grunt From bdf9e01b4f3865be173b637a52f457bc679aa7eb Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Tue, 4 Feb 2020 12:48:26 +0000 Subject: [PATCH 51/86] Add nodejs role to default.config.yml --- default.config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/default.config.yml b/default.config.yml index ead594d..33f76ff 100644 --- a/default.config.yml +++ b/default.config.yml @@ -33,6 +33,7 @@ rebuild_known_hosts: false # Software stack config_roles: + - nodejs - apache - php - mysql From 5a06f152bdf0d3fc8fc24756763335905ffc55f3 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Tue, 4 Feb 2020 14:36:42 +0000 Subject: [PATCH 52/86] Add bcmath Mautic depedency --- roles/php/vars/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/php/vars/main.yml b/roles/php/vars/main.yml index 8bbf696..73f5cd2 100644 --- a/roles/php/vars/main.yml +++ b/roles/php/vars/main.yml @@ -13,5 +13,6 @@ packages_php: - php-mbstring - php-mailparse - php-imap + - php-bcmath - php-xdebug From 2f92762e287b9af7fe2e5582fc3dfcddfd1548d7 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Tue, 4 Feb 2020 15:47:00 +0000 Subject: [PATCH 53/86] Pull out VM CPUs configuration into config file --- Vagrantfile | 2 +- default.config.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index d4866e9..a0cf946 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -58,7 +58,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Virtualbox parameters config.vm.provider "virtualbox" do |vb| vb.name = config_yml['vm_name'] - vb.cpus = 2 + vb.cpus = config_yml['vm_cpus'] vb.customize ["modifyvm", :id, "--memory", config_yml['vm_ram']] end diff --git a/default.config.yml b/default.config.yml index 33f76ff..91f3554 100644 --- a/default.config.yml +++ b/default.config.yml @@ -5,6 +5,7 @@ # Machine vm_name: "devbox" vm_hostname: "dev.box" +vm_cpus: "4" vm_ram: "2048" vm_ip: "10.10.10.10" vm_user: "vagrant" From 1e9ba4dffba83bfd59dc4f67a1c7901029cb5178 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Tue, 4 Feb 2020 15:47:47 +0000 Subject: [PATCH 54/86] Update PHP role for Mautic depedencies and performance --- default.config.yml | 4 ++++ roles/php/handlers/main.yml | 2 +- roles/php/tasks/main.yml | 13 +++++++++++-- roles/php/tasks/php-xdebug.yml | 1 + roles/php/vars/main.yml | 1 + 5 files changed, 18 insertions(+), 3 deletions(-) diff --git a/default.config.yml b/default.config.yml index 91f3554..607b9e5 100644 --- a/default.config.yml +++ b/default.config.yml @@ -40,6 +40,10 @@ config_roles: - mysql - projects +# PHP +php_memory_limit: "1536M" +php_timezone: "Europe/London" + # Projects # Projects path diff --git a/roles/php/handlers/main.yml b/roles/php/handlers/main.yml index 2b9b744..8846a3a 100644 --- a/roles/php/handlers/main.yml +++ b/roles/php/handlers/main.yml @@ -2,4 +2,4 @@ - name: restart php become: yes - service: name=php7.0-fpm state=restarted + service: name=php7.2-fpm state=restarted diff --git a/roles/php/tasks/main.yml b/roles/php/tasks/main.yml index f1c05e5..b477f57 100644 --- a/roles/php/tasks/main.yml +++ b/roles/php/tasks/main.yml @@ -5,7 +5,7 @@ apt: name: "{{ packages_php }}" state: present - notify: restart apache + notify: restart php - name: Register PHP config path shell: "php --ini | grep 'Configuration File (php.ini) Path:' | cut -d ':' -f2 | tr -d ' ' | cut -d '/' -f1-4" @@ -19,7 +19,16 @@ lineinfile: path: "{{ php_config_dir }}/fpm/php.ini" regexp: "^memory_limit" - line: "memory_limit = 1024M" + line: "memory_limit = {{ php_memory_limit }}" + notify: restart php + +- name: Update PHP timezone + become: yes + lineinfile: + path: "{{ php_config_dir }}/fpm/php.ini" + regexp: "^;date.timezone" + line: "date.timezone = {{ php_timezone }}" + notify: restart php - include: php-xdebug.yml - include: php-composer.yml diff --git a/roles/php/tasks/php-xdebug.yml b/roles/php/tasks/php-xdebug.yml index 62f0ca0..b665671 100644 --- a/roles/php/tasks/php-xdebug.yml +++ b/roles/php/tasks/php-xdebug.yml @@ -6,3 +6,4 @@ src: xdebug.ini dest: "{{ php_config_dir }}/mods-available/xdebug.ini" backup: yes + notify: restart php diff --git a/roles/php/vars/main.yml b/roles/php/vars/main.yml index 73f5cd2..718c0ee 100644 --- a/roles/php/vars/main.yml +++ b/roles/php/vars/main.yml @@ -14,5 +14,6 @@ packages_php: - php-mailparse - php-imap - php-bcmath + - php-intl - php-xdebug From fabfe0d66687f4430cb755de8afb7fa526284000 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Thu, 8 Oct 2020 15:57:03 +0100 Subject: [PATCH 55/86] Update box reference to ubuntu/focal64 --- Vagrantfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index a0cf946..c2ebb59 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -38,7 +38,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.define config_yml['vm_name'] do |devbox| # Operating system - devbox.vm.box = "ubuntu/bionic64" + devbox.vm.box = "ubuntu/focal64" # Network devbox.vm.network "private_network", ip: config_yml['vm_ip'] @@ -62,9 +62,9 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| vb.customize ["modifyvm", :id, "--memory", config_yml['vm_ram']] end - # Workaround for ubuntu/xenial not having /usr/bin/python - config.vm.provision "shell", - inline: "if [[ ! -f /usr/bin/python ]]; then sudo ln -s /usr/bin/python3 /usr/bin/python; fi" + # # Workaround for ubuntu/xenial not having /usr/bin/python + # config.vm.provision "shell", + # inline: "if [[ ! -f /usr/bin/python ]]; then sudo ln -s /usr/bin/python3 /usr/bin/python; fi" # Provision with Ansible config.vm.provision "ansible" do |ansible| From 3e68e994545b9d428c6a6f66f72a9c36377a0700 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Thu, 8 Oct 2020 16:00:27 +0100 Subject: [PATCH 56/86] Close #14: Add all related node config in js role --- roles/common/tasks/main.yml | 19 ------------------- roles/nodejs/tasks/main.yml | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index a28d7b1..2afd5f7 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -1,24 +1,5 @@ --- -- name: Add NodeSource apt repository key - become: yes - apt_key: - url: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key" - state: present - -- name: Install NodeSource apt repository - become: yes - apt_repository: - repo: "deb https://deb.nodesource.com/node_10.x bionic main" - state: present - -- name: Update apt - become: yes - apt: - upgrade: "yes" - update_cache: yes - cache_valid_time: 86400 #one day - - name: Install utilities become: yes apt: diff --git a/roles/nodejs/tasks/main.yml b/roles/nodejs/tasks/main.yml index e883c1f..553691e 100644 --- a/roles/nodejs/tasks/main.yml +++ b/roles/nodejs/tasks/main.yml @@ -1,5 +1,24 @@ --- +- name: Add NodeSource apt repository key + become: yes + apt_key: + url: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key" + state: present + +- name: Install NodeSource apt repository + become: yes + apt_repository: + repo: "deb https://deb.nodesource.com/node_14.x focal main" + state: present + +- name: Update apt + become: yes + apt: + upgrade: "yes" + update_cache: yes + cache_valid_time: 86400 #one day + - name: Install NodeJS packages become: yes apt: From 3f19fa5dea7da14f0ae1c49ac046ec95a6879122 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Thu, 8 Oct 2020 16:08:28 +0100 Subject: [PATCH 57/86] Update for Ubuntu 20.04 python3 substitution --- roles/mysql/vars/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/mysql/vars/main.yml b/roles/mysql/vars/main.yml index 6ba33e7..61066ca 100644 --- a/roles/mysql/vars/main.yml +++ b/roles/mysql/vars/main.yml @@ -7,5 +7,5 @@ mysql_user: "root" packages_mysql: - mysql-server - php-mysql - - python-mysqldb + - python3-mysqldb \ No newline at end of file From ddfd9f76f9c7ba0936287f8aca33cd7ff6209b53 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Thu, 8 Oct 2020 16:26:51 +0100 Subject: [PATCH 58/86] Update Ubuntu version to 20.04 LTS --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7238ee8..040593f 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Devbox works with the following software: - Vagrant >= 2.1.1 - Ansible >= 2.5 - VirtualBox - - Ubuntu Bionic 18.04 + - Ubuntu Bionic 20.04 ## Install From ee6f8182e966298544f3dda216fad337ca55591e Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Thu, 8 Oct 2020 16:28:38 +0100 Subject: [PATCH 59/86] Update PHP systemd definition to 7.4 --- roles/php/handlers/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/php/handlers/main.yml b/roles/php/handlers/main.yml index 8846a3a..c9955ae 100644 --- a/roles/php/handlers/main.yml +++ b/roles/php/handlers/main.yml @@ -2,4 +2,4 @@ - name: restart php become: yes - service: name=php7.2-fpm state=restarted + service: name=php7.4-fpm state=restarted From a3a2f1fd12dbe0837a87c8fcd64f054b99981a2e Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Thu, 8 Oct 2020 16:29:07 +0100 Subject: [PATCH 60/86] Add zlib PHP extension --- roles/php/vars/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/php/vars/main.yml b/roles/php/vars/main.yml index 718c0ee..694b926 100644 --- a/roles/php/vars/main.yml +++ b/roles/php/vars/main.yml @@ -10,10 +10,10 @@ packages_php: - php-fpm - php-gd - php-zip + - php-zlib - php-mbstring - php-mailparse - php-imap - php-bcmath - php-intl - php-xdebug - From 8e2585e976522fe2633812ffe8737726863f6708 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Sat, 10 Oct 2020 17:04:04 +0100 Subject: [PATCH 61/86] Removed php-zlib extension. It does not exist --- roles/php/vars/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/roles/php/vars/main.yml b/roles/php/vars/main.yml index 694b926..fa57b11 100644 --- a/roles/php/vars/main.yml +++ b/roles/php/vars/main.yml @@ -10,7 +10,6 @@ packages_php: - php-fpm - php-gd - php-zip - - php-zlib - php-mbstring - php-mailparse - php-imap From 3f85e98a771d361c7c1a05f6bfc6898bd79a111c Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Sat, 10 Oct 2020 19:08:09 +0100 Subject: [PATCH 62/86] Close #10 and Close #11 --- default.config.yml | 5 +++++ roles/php/defaults/main.yml | 5 +++++ roles/php/tasks/main.yml | 10 ++++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/default.config.yml b/default.config.yml index 607b9e5..7d92bd7 100644 --- a/default.config.yml +++ b/default.config.yml @@ -43,6 +43,11 @@ config_roles: # PHP php_memory_limit: "1536M" php_timezone: "Europe/London" +php_xdebug: true +php_laravel: false +php_symfony: false +php_drupal: false +php_wp: false # Projects diff --git a/roles/php/defaults/main.yml b/roles/php/defaults/main.yml index e69de29..0c68d93 100644 --- a/roles/php/defaults/main.yml +++ b/roles/php/defaults/main.yml @@ -0,0 +1,5 @@ +php_xdebug: true +php_laravel: true +php_symfony: true +php_drupal: true +php_wp: true diff --git a/roles/php/tasks/main.yml b/roles/php/tasks/main.yml index b477f57..0bdc9d2 100644 --- a/roles/php/tasks/main.yml +++ b/roles/php/tasks/main.yml @@ -30,6 +30,12 @@ line: "date.timezone = {{ php_timezone }}" notify: restart php -- include: php-xdebug.yml - include: php-composer.yml -- include: php-laravel.yml + +- name: Enable xdebug + include_tasks: php-xdebug.yml + when: php_xdebug == true + +- name: Enable laravel integration + include_tasks: php-laravel.yml + when: php_laravel == true From 6cf2bc5bc364019a5f2486384b038ce431ec301f Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Mon, 12 Oct 2020 15:52:18 +0100 Subject: [PATCH 63/86] Close #16: Enable Ubuntu 20.04 official image to boot with vagrant 2.2.10 and virtualbox 6.1 --- README.md | 12 ++++++------ Vagrantfile | 5 ++++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 040593f..d505ac2 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,17 @@ ## Prerequisites -Devbox is a virtual devevelopment box for PHP and JavaScruipt development +Devbox is a virtual devevelopment box for PHP and JavaScript development (including frameworks like Hugo, Symfony, WordPress and Drupal). Using the LAMP stack provided you can start development without worrying about setting up your computer as a development environment. Devbox works with the following software: - - Vagrant >= 2.1.1 - - Ansible >= 2.5 - - VirtualBox - - Ubuntu Bionic 20.04 + - Vagrant >= 2.2.10 + - Ansible >= 2.9.6 + - VirtualBox >= 6.1 + - Ubuntu 20.04.1 LTS (Focal Fossa) ## Install @@ -66,7 +66,7 @@ vagrant help ## Configuration The development environment can be customised via the `config.yml` file and the -variables contained within. +variables contained within. ### Configuring the VM diff --git a/Vagrantfile b/Vagrantfile index c2ebb59..6594b09 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -36,7 +36,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Define VM parameters config.vm.define config_yml['vm_name'] do |devbox| - + # Operating system devbox.vm.box = "ubuntu/focal64" @@ -60,6 +60,9 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| vb.name = config_yml['vm_name'] vb.cpus = config_yml['vm_cpus'] vb.customize ["modifyvm", :id, "--memory", config_yml['vm_ram']] + + # Workaround for ubuntu/focal64 and virtualbox 6.1 + vb.customize ["modifyvm", :id, "--uartmode1", "file", File::NULL] end # # Workaround for ubuntu/xenial not having /usr/bin/python From 18448fa0cb0a69b0da0d18527a6c269b1dc1eaae Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Tue, 13 Oct 2020 15:27:56 +0100 Subject: [PATCH 64/86] Close #17: Add Drush support --- roles/php/tasks/main.yml | 4 ++++ roles/php/tasks/php-drupal.yml | 7 +++++++ 2 files changed, 11 insertions(+) create mode 100644 roles/php/tasks/php-drupal.yml diff --git a/roles/php/tasks/main.yml b/roles/php/tasks/main.yml index 0bdc9d2..75c75d3 100644 --- a/roles/php/tasks/main.yml +++ b/roles/php/tasks/main.yml @@ -39,3 +39,7 @@ - name: Enable laravel integration include_tasks: php-laravel.yml when: php_laravel == true + +- name: Enable Drupal tools + include_tasks: php-drupal.yml + when: php_drupal == true diff --git a/roles/php/tasks/php-drupal.yml b/roles/php/tasks/php-drupal.yml new file mode 100644 index 0000000..65f0b5e --- /dev/null +++ b/roles/php/tasks/php-drupal.yml @@ -0,0 +1,7 @@ +--- + +- name: Install Drush + composer: + command: require + global_command: yes + arguments: "drush/drush:^10.0.0" From 1a3834d7da3ff14939f0ad0724520783bb3595cb Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Tue, 13 Oct 2020 15:28:31 +0100 Subject: [PATCH 65/86] Add directive to update composer to latest version --- roles/php/tasks/php-composer.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/roles/php/tasks/php-composer.yml b/roles/php/tasks/php-composer.yml index ed5ffcb..9b00140 100644 --- a/roles/php/tasks/php-composer.yml +++ b/roles/php/tasks/php-composer.yml @@ -29,3 +29,9 @@ PATH="$HOME/.config/composer/vendor/bin/:$PATH" fi backup: yes + +- name: Update composer to latest version + become: yes + composer: + command: self-update + global-command: yes From 46ecea566d4d00be234796643fc8d7616464aec2 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Tue, 13 Oct 2020 16:21:48 +0100 Subject: [PATCH 66/86] Close #18: Enable correct encoding and collation for created databases --- roles/projects/tasks/projects-conf-mysql.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/roles/projects/tasks/projects-conf-mysql.yml b/roles/projects/tasks/projects-conf-mysql.yml index b0fe45e..b888938 100644 --- a/roles/projects/tasks/projects-conf-mysql.yml +++ b/roles/projects/tasks/projects-conf-mysql.yml @@ -4,6 +4,8 @@ mysql_db: name: "{{ item.db_name }}" state: present + collation: utf8mb4_unicode_ci + encoding: utf8mb4 with_items: - "{{ projects }}" when: item.db_name != "" From 5574e8dc69bf37c6ceb3994bf24bb220d0135929 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Tue, 13 Oct 2020 17:40:38 +0100 Subject: [PATCH 67/86] Create drupal project codebase and setting files --- default.config.yml | 4 ++-- roles/projects/tasks/main.yml | 8 ++++---- .../projects/tasks/projects-project-drupal.yml | 18 ++++++++++++++++-- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/default.config.yml b/default.config.yml index 7d92bd7..0d590a0 100644 --- a/default.config.yml +++ b/default.config.yml @@ -64,7 +64,7 @@ projects_path: "{{ guest_path }}" # root) # db_name - string - the database name to be used (if empty database is # skipped) -# tech - string - the technology used in the project (hugo, drupal, symfony) +# type - string - the technology used in the project (hugo, drupal, symfony) # repo - string - git url of the project #projects: @@ -75,7 +75,7 @@ projects_path: "{{ guest_path }}" #db_user: "" #db_pass: "" #db_name: "" - #tech: "" + #type: "" #repo: "" ## TODO diff --git a/roles/projects/tasks/main.yml b/roles/projects/tasks/main.yml index 8ba4826..b972699 100644 --- a/roles/projects/tasks/main.yml +++ b/roles/projects/tasks/main.yml @@ -36,10 +36,10 @@ # with_items: "{{ dot_git.results }}" # when: (item.stat.exists == false) and (item.repo == '') and (item.type == 'hugo') -# - name: Initialise Drupal projects -# include_tasks: projects-project-drupal.yml -# with_items: "{{ dot_git.results }}" -# when: (item.stat.exists == false) and (item.repo == '') and (item.type == 'drupal') +- name: Initialise Drupal projects + include_tasks: projects-project-drupal.yml + with_items: "{{ dot_git.results }}" + when: (item.stat.exists == false) and (item.item.repo == '') and (item.item.type == 'drupal') # - name: Initialise Symfony projects # include_tasks: projects-project-symfony.yml diff --git a/roles/projects/tasks/projects-project-drupal.yml b/roles/projects/tasks/projects-project-drupal.yml index 84ab605..eb0a3e8 100644 --- a/roles/projects/tasks/projects-project-drupal.yml +++ b/roles/projects/tasks/projects-project-drupal.yml @@ -1,5 +1,19 @@ --- -- debug: - msg: "Project {{ item.domain }} is a Drupal project." +- name: Create codebase + composer: + command: create-project + arguments: drupal/recommended-project . + working-dir: "{{ item.item.path }}" +- name: Create settings.php + copy: + src: "{{ item.item.path }}/{{ item.item.docroot }}/sites/default/default.settings.php" + dest: "{{ item.item.path }}/{{ item.item.docroot }}/sites/default/settings.php" + remote_src: yes + +- name: Create settings.local.php + copy: + src: "{{ item.item.path }}/{{ item.item.docroot }}/sites/example.settings.local.php" + dest: "{{ item.item.path }}/{{ item.item.docroot }}/sites/default/settings.local.php" + remote_src: yes From a348b248705bc82f35271372691818c92a87f8a7 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Tue, 13 Oct 2020 18:25:21 +0100 Subject: [PATCH 68/86] Add twig cache dir outside of NFS mount --- roles/projects/tasks/projects-project-drupal.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/roles/projects/tasks/projects-project-drupal.yml b/roles/projects/tasks/projects-project-drupal.yml index eb0a3e8..4a688b2 100644 --- a/roles/projects/tasks/projects-project-drupal.yml +++ b/roles/projects/tasks/projects-project-drupal.yml @@ -17,3 +17,18 @@ src: "{{ item.item.path }}/{{ item.item.docroot }}/sites/example.settings.local.php" dest: "{{ item.item.path }}/{{ item.item.docroot }}/sites/default/settings.local.php" remote_src: yes + +- name: Create cached twig files templates + become: yes + file: + path: /tmp/twig-cache + owner: www-data + group: www-data + state: directory + +- name: Update cache twig definition on settings.local.php + blockinfile: + path: "{{ item.item.path }}/{{ item.item.docroot }}/sites/default/settings.local.php" + block: | + $settings['php_storage']['twig']['directory'] = 'tmp/twig-cache/php'; + $settings['php_storage']['twig']['secret'] = $settings['hash_salt']; From bfe63f22cbbab987ce38fa0f9e7517933fc7f2fb Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Wed, 14 Oct 2020 11:38:56 +0100 Subject: [PATCH 69/86] Fixed typo on twig cache dir, and ensure settings file are not recreated --- roles/projects/tasks/projects-project-drupal.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/roles/projects/tasks/projects-project-drupal.yml b/roles/projects/tasks/projects-project-drupal.yml index 4a688b2..0286590 100644 --- a/roles/projects/tasks/projects-project-drupal.yml +++ b/roles/projects/tasks/projects-project-drupal.yml @@ -11,12 +11,14 @@ src: "{{ item.item.path }}/{{ item.item.docroot }}/sites/default/default.settings.php" dest: "{{ item.item.path }}/{{ item.item.docroot }}/sites/default/settings.php" remote_src: yes + force: no - name: Create settings.local.php copy: src: "{{ item.item.path }}/{{ item.item.docroot }}/sites/example.settings.local.php" dest: "{{ item.item.path }}/{{ item.item.docroot }}/sites/default/settings.local.php" remote_src: yes + force: no - name: Create cached twig files templates become: yes @@ -30,5 +32,5 @@ blockinfile: path: "{{ item.item.path }}/{{ item.item.docroot }}/sites/default/settings.local.php" block: | - $settings['php_storage']['twig']['directory'] = 'tmp/twig-cache/php'; + $settings['php_storage']['twig']['directory'] = '/tmp/twig-cache/php'; $settings['php_storage']['twig']['secret'] = $settings['hash_salt']; From 5545b28ada3c9208dbb8946f891a405d72058ec8 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Thu, 15 Oct 2020 16:13:59 +0100 Subject: [PATCH 70/86] Create global variables for DB and source them in Apache --- roles/mysql/tasks/main.yml | 15 +++++++++++++++ roles/mysql/templates/apache-envvars.j2 | 2 ++ 2 files changed, 17 insertions(+) create mode 100644 roles/mysql/templates/apache-envvars.j2 diff --git a/roles/mysql/tasks/main.yml b/roles/mysql/tasks/main.yml index 8e07805..58489d0 100644 --- a/roles/mysql/tasks/main.yml +++ b/roles/mysql/tasks/main.yml @@ -41,6 +41,21 @@ dest: "~/.my.cnf" mode: 0600 when: not mysql_pass.stat.exists + +- name: Create DB environment variables for Apache envvars + template: + src: apache-envvars.j2 + dest: "~/.apache-envvars" + mode: 0700 + when: not mysql_pass.stat.exists + +- name: Register DB environment variables with Apache envvars + become: yes + blockinfile: + path: /etc/apache2/envvars + block: ". /home/{{ vm_user }}/.apache-envvars" + when: not mysql_pass.stat.exists + notify: restart apache - name: Create Adminer directory become: yes diff --git a/roles/mysql/templates/apache-envvars.j2 b/roles/mysql/templates/apache-envvars.j2 new file mode 100644 index 0000000..c83a53d --- /dev/null +++ b/roles/mysql/templates/apache-envvars.j2 @@ -0,0 +1,2 @@ +export DB_USER=root +export DB_PASS={{ mysql_root_pass.stdout }} From 95b1c18054080eab7b8da70fafb3e274fadf7231 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Thu, 15 Oct 2020 16:55:27 +0100 Subject: [PATCH 71/86] Enable drupal specific vhost template with environment variables --- roles/projects/tasks/projects-conf-apache.yml | 2 +- roles/projects/templates/drupal.vhost.j2 | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 roles/projects/templates/drupal.vhost.j2 diff --git a/roles/projects/tasks/projects-conf-apache.yml b/roles/projects/tasks/projects-conf-apache.yml index ef2444d..ced0b16 100644 --- a/roles/projects/tasks/projects-conf-apache.yml +++ b/roles/projects/tasks/projects-conf-apache.yml @@ -12,7 +12,7 @@ - name: Create project vhosts become: yes template: - src: "generic.vhost.j2" + src: "{{ item.type }}.vhost.j2" dest: "/etc/apache2/sites-available/{{ item.domain }}.conf" owner: root group: root diff --git a/roles/projects/templates/drupal.vhost.j2 b/roles/projects/templates/drupal.vhost.j2 new file mode 100644 index 0000000..4be1488 --- /dev/null +++ b/roles/projects/templates/drupal.vhost.j2 @@ -0,0 +1,26 @@ + + + ServerName {{ item.domain }} + DocumentRoot {{ item.path }}/{{ item.docroot }} + + + Options FollowSymLinks + AllowOverride All + Require all granted + + + + SetHandler "proxy:unix:{{ php_fpm_socket.stdout }}|fcgi://localhost/" + + + + + + ErrorLog ${APACHE_LOG_DIR}/{{ item.domain }}_error.log + CustomLog ${APACHE_LOG_DIR}/{{ item.domain }}_access.log combined + + SetEnv DB_USER ${DB_USER} + SetEnv DB_PASS ${DB_PASS} + SetEnv DB_NAME {{ item.database }} + + From 60353f412ab278e0d45e3d9ad1e619402cfd77d6 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Thu, 15 Oct 2020 16:58:12 +0100 Subject: [PATCH 72/86] Simplify database creation --- roles/projects/tasks/projects-conf-mysql.yml | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/roles/projects/tasks/projects-conf-mysql.yml b/roles/projects/tasks/projects-conf-mysql.yml index b888938..b90d72e 100644 --- a/roles/projects/tasks/projects-conf-mysql.yml +++ b/roles/projects/tasks/projects-conf-mysql.yml @@ -2,22 +2,11 @@ - name: Create project databases mysql_db: - name: "{{ item.db_name }}" + name: "{{ item.database }}" state: present collation: utf8mb4_unicode_ci encoding: utf8mb4 with_items: - "{{ projects }}" - when: item.db_name != "" - -- name: Add users and privileges to project databases - mysql_user: - name: "{{ item.db_user }}" - host: localhost - password: "{{ item.db_pass }}" - priv: "{{ item.db_name }}.*:ALL,GRANT" - state: present - append_privs: yes - with_items: - - "{{ projects }}" - when: item.db_user != "" + when: (item.database is defined) and (item.database != "") + \ No newline at end of file From a481f022e05b5112f1832823372f7cc37d9c1f65 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Thu, 15 Oct 2020 17:52:02 +0100 Subject: [PATCH 73/86] Automatically adjust Drupal's settings.php file --- .../tasks/projects-project-drupal.yml | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/roles/projects/tasks/projects-project-drupal.yml b/roles/projects/tasks/projects-project-drupal.yml index 0286590..178ff45 100644 --- a/roles/projects/tasks/projects-project-drupal.yml +++ b/roles/projects/tasks/projects-project-drupal.yml @@ -13,6 +13,37 @@ remote_src: yes force: no +- name: Update Drupal's hash_salt setting + lineinfile: + path: "{{ item.item.path }}/{{ item.item.docroot }}/sites/default/settings.php" + regexp: "^\\$settings\\['hash_salt" + line: "$settings['hash_salt'] = 'DvkOcqLrxtGYNv25npi1r2+UEF43EASGk4JdSTVRCx4KSvygbbRWRps6WbLwP2NnZeOhJ36X0g==';" + +- name: Update Drupal's config directory setting + lineinfile: + path: "{{ item.item.path }}/{{ item.item.docroot }}/sites/default/settings.php" + regexp: "^\\#\\ \\$settings\\['config_sync_directory" + line: "$settings['config_sync_directory'] = '../config/sync';" + +- name: Add database config into Drupal's settings + blockinfile: + path: "{{ item.item.path }}/{{ item.item.docroot }}/sites/default/settings.php" + block: | + $databases['default']['default'] = [ + 'database' => getenv('DB_NAME'), + 'username' => getenv('DB_USER'), + 'password' => getenv('DB_PASS'), + 'host' => 'localhost', + 'port' => '3306', + 'driver' => 'mysql', + 'prefix' => '', + 'collation' => 'utf8mb4_general_ci', + ]; + + if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) { + include $app_root . '/' . $site_path . '/settings.local.php'; + } + - name: Create settings.local.php copy: src: "{{ item.item.path }}/{{ item.item.docroot }}/sites/example.settings.local.php" From b44c037f2272f6d967dab479895246a017ac8d14 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Thu, 15 Oct 2020 18:18:11 +0100 Subject: [PATCH 74/86] Update README and config files with simplified instructions on project setup --- README.md | 9 +++------ default.config.yml | 20 +++++++------------- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index d505ac2..a5bfd7f 100644 --- a/README.md +++ b/README.md @@ -112,13 +112,10 @@ following parameters: automatically picked up and added to `/etc/hosts`. - **docroot** (_string_) The path of the project in devbox. Can be any location or combined with `projects_path`. - - **db_user** (_string_): The database user to be used. User is added if does - not exist. Leave empty to use root. - - **db_pass** (_string_): The database password for the user above. Leave empty to - use root's password. - - **db_name** (_string_): The database to be used. If empty database creation is skipped - - **tech** (_string_): The technology used in the project. Options include: + - **type** (_string_): The technology used in the project. Options include: empty, hugo, drupal, wordpress, symfony. + - **database** (_string_): The database to be used. If empty database creation is skipped + - **repo** (_string_): a git path to checkout existing projects (uses path) ### Configuring Xdebug Xdebug is enabled by default but you would need to set it up to your IDE. For diff --git a/default.config.yml b/default.config.yml index 0d590a0..417f12b 100644 --- a/default.config.yml +++ b/default.config.yml @@ -56,26 +56,20 @@ projects_path: "{{ guest_path }}" # Project parameters # -# docroot - string - the location of the project in devbox. It's syntax -# contains {{ remote_user }} to make it box indepedent. -# path - string - the main projects path -# db_user - string - the name of the database user to be used (empty for root) -# db_pass - string - the passwrd of the database user to be used (empty for -# root) -# db_name - string - the database name to be used (if empty database is -# skipped) -# type - string - the technology used in the project (hugo, drupal, symfony) -# repo - string - git url of the project +# domain - string (required) - the local domain to access the project +# path - string (required) - the location of the project +# docroot - string (required) - the location of docroot within the project +# type - string (required) - the technology used in the project (generic, hugo, drupal, symfony, wp, laravel) +# db_name - string (optional) - the database name to be used +# repo - string (optional) - a git path to checkout existing projects (uses path) #projects: #- domain: "" #path: "" #docroot: "" - #db_user: "" - #db_pass: "" - #db_name: "" #type: "" + #database: "" #repo: "" ## TODO From d7817fb06bf6da4d02e1cee5a6418425ba1de5f0 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Mon, 19 Oct 2020 17:47:14 +0100 Subject: [PATCH 75/86] Enable global environment variable in configuration --- default.config.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/default.config.yml b/default.config.yml index 417f12b..17cf8b5 100644 --- a/default.config.yml +++ b/default.config.yml @@ -32,6 +32,15 @@ repositories: repositories_count: "{{ repositories | length }}" rebuild_known_hosts: false +# Environment variables +# +# Append to add more +# name - string (required) - name of environment variable +# value - string (required) - value of environment variable + +environment_variables: + - { name: "ENV", value: "local" } + # Software stack config_roles: - nodejs From 1df939f31356edf4cc6a8c6c369fe863161d2f23 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Mon, 19 Oct 2020 17:47:53 +0100 Subject: [PATCH 76/86] Read environment variables from config and add them export them to environment --- roles/common/tasks/main.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index 2afd5f7..3658db0 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -19,6 +19,32 @@ state: directory mode: 0775 +- name: Create enviromental variables + file: + path: "~/.envvars" + state: touch + mode: 0700 + +- name: Add config enviromental variables + blockinfile: + path: "~/.envvars" + block: | + export {{ item.name }}={{ item.value }} + marker: "# {mark} ANSIBLE MANAGED BLOCK {{ item.name }}" + with_items: + - "{{ environment_variables }}" + when: + - environment_variables is defined + +- name: Add enviromental variables to .bashrc + blockinfile: + path: "~/.bashrc" + block: | + # Source environmental variables set by user + if [ -f ~/.envvars ]; then + . ~/.envvars + fi + - name: Add user RSA key copy: src: "{{ git_rsa_key }}" From a7bf6b1f195d58f7d5a78add3377704da99db966 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Mon, 19 Oct 2020 17:58:23 +0100 Subject: [PATCH 77/86] Source system enviroment variables to Apache envvars --- roles/apache/tasks/main.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/roles/apache/tasks/main.yml b/roles/apache/tasks/main.yml index ffecd77..3411627 100644 --- a/roles/apache/tasks/main.yml +++ b/roles/apache/tasks/main.yml @@ -15,4 +15,11 @@ with_items: "{{ apache_modules }}" notify: restart apache +- name: Register environment variables with Apache + become: yes + blockinfile: + path: /etc/apache2/envvars + block: ". /home/{{ vm_user }}/.envvars" + notify: restart apache + # TODO: Add configuration to harden the server (signature off, etc) From 9f1ab70f54a7d2d280ae9de9a5d9cb94154f20fb Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Mon, 19 Oct 2020 18:32:16 +0100 Subject: [PATCH 78/86] Add MySQL environment variables in .envvars --- roles/mysql/tasks/main.yml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/roles/mysql/tasks/main.yml b/roles/mysql/tasks/main.yml index 58489d0..016ac7a 100644 --- a/roles/mysql/tasks/main.yml +++ b/roles/mysql/tasks/main.yml @@ -42,18 +42,15 @@ mode: 0600 when: not mysql_pass.stat.exists -- name: Create DB environment variables for Apache envvars - template: - src: apache-envvars.j2 - dest: "~/.apache-envvars" - mode: 0700 - when: not mysql_pass.stat.exists - -- name: Register DB environment variables with Apache envvars - become: yes +- name: Add DB environmental variables to .envvars blockinfile: - path: /etc/apache2/envvars - block: ". /home/{{ vm_user }}/.apache-envvars" + path: "~/.envvars" + block: | + export {{ item.name }}={{ item.value }} + marker: "# {mark} ANSIBLE MANAGED BLOCK {{ item.name }}" + loop: + - { name: "DB_USER", value: "root" } + - { name: "DB_PASS", value: "{{ mysql_root_pass.stdout }}" } when: not mysql_pass.stat.exists notify: restart apache From d750574e142f6dc0fe18ff5828f88e175ae17153 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Tue, 20 Oct 2020 18:00:41 +0100 Subject: [PATCH 79/86] Update Drupal setup tasks to use desired version setting from config --- roles/projects/tasks/projects-project-drupal.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/roles/projects/tasks/projects-project-drupal.yml b/roles/projects/tasks/projects-project-drupal.yml index 178ff45..baecd34 100644 --- a/roles/projects/tasks/projects-project-drupal.yml +++ b/roles/projects/tasks/projects-project-drupal.yml @@ -1,10 +1,18 @@ --- -- name: Create codebase +- name: Create codebase with specific package version + composer: + command: create-project + arguments: drupal/recommended-project:{{ item.item.version }} . + working-dir: "{{ item.item.path }}" + when: ( item.item.version is defined ) and ( item.item.version != "") + +- name: Create codebase with latest stable composer: command: create-project arguments: drupal/recommended-project . working-dir: "{{ item.item.path }}" + when: ( item.item.version is not defined ) or ( item.item.version == "") - name: Create settings.php copy: From 4fabb81a0f6d6ce068bc173deab198aeec9dfa7e Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Tue, 20 Oct 2020 18:02:08 +0100 Subject: [PATCH 80/86] Update default.config.yml with version string for project configuration --- default.config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/default.config.yml b/default.config.yml index 17cf8b5..5d45a40 100644 --- a/default.config.yml +++ b/default.config.yml @@ -69,7 +69,8 @@ projects_path: "{{ guest_path }}" # path - string (required) - the location of the project # docroot - string (required) - the location of docroot within the project # type - string (required) - the technology used in the project (generic, hugo, drupal, symfony, wp, laravel) -# db_name - string (optional) - the database name to be used +# version - string (optional) - the software version required by composer +# database - string (optional) - the database name to be used # repo - string (optional) - a git path to checkout existing projects (uses path) #projects: From 234a8ab9e98c06d85a3a36577229751b8446d17c Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Wed, 21 Oct 2020 22:19:53 +0100 Subject: [PATCH 81/86] Adjust CHANGELOG.md for intendation --- CHANGELOG.md | 55 +++++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6a139e..614c140 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,48 +8,55 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [2.2.0] - 2018-06-02 ### Added -- Enabled private network settings -- Added configuration parameters for RSA key and github authentication -- Added vagrant-hostsupdater to set host's `/etc/hosts` file automatically + + - Enabled private network settings + - Added configuration parameters for RSA key and github authentication + - Added vagrant-hostsupdater to set host's `/etc/hosts` file automatically ### Changed -- Changed php role to setup xdebug properly -- Changed the order and depedencies for apache and php roles -- Changed roles include in the playbook to be configurable in -- Changed `variables.yml` into `default.config.yml` and requires it to be copied - into `config.yml` for configuration of devbox -- Cleaned up `projects` variable + + - Changed php role to setup xdebug properly + - Changed the order and depedencies for apache and php roles + - Changed roles include in the playbook to be configurable in + - Changed `variables.yml` into `default.config.yml` and requires it to be copied into `config.yml` for configuration of devbox + - Cleaned up `projects` variable ### Removed -- Removed temporarly enabed public network + + - Removed temporarly enabed public network ## [2.1.0] - 2017-04-08 ### Added -- New project role to handle project specific configuration -- Added `php-mbstring` -- Changed host with new Ansible variable syntax (> 2.0) -- Splits several YAML files into multiple and adds include statements to - individual `main.yml` files. + + - New project role to handle project specific configuration + - Added `php-mbstring` + - Changed host with new Ansible variable syntax (> 2.0) + - Splits several YAML files into multiple and adds include statements to + individual `main.yml` files. ### Removed -- All configuration regarding projects (vhost and database) now resides with the -project role. + + - All configuration regarding projects (vhost and database) now resides with the + project role. ## [2.0.0] - 2017-04-06 ### Added -- Split the code into roles to be more manageable -- Adds CHANGELOG.md -- Tags release 1.0.0 + + - Split the code into roles to be more manageable + - Adds CHANGELOG.md + - Tags release 1.0.0 ### Change -- Changes to ansible code syntax to be compatible with Ansible 2.2.1 -- Changes to vagrant code syntax to be compatible with Vagrant 1.9.2 -- Changes to vagrant to use Ubuntu Xenial 16.04 + + - Changes to ansible code syntax to be compatible with Ansible 2.2.1 + - Changes to vagrant code syntax to be compatible with Vagrant 1.9.2 + - Changes to vagrant to use Ubuntu Xenial 16.04 ## [1.0.0] - 2015-08-24 ### Added -- First release of code + + - First release of code From fbb23769eb34437a606863996145b8d809a8a753 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Wed, 21 Oct 2020 22:28:30 +0100 Subject: [PATCH 82/86] Correct typo in default.config.yml --- default.config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default.config.yml b/default.config.yml index 5d45a40..6048bc9 100644 --- a/default.config.yml +++ b/default.config.yml @@ -27,7 +27,7 @@ git_rsa_key_dest: "~/.ssh/id_rsa" # Repositories repositories: - { name: github, host: github.com } - - { name: bitbucket, host: bitbucket.com} + - { name: bitbucket, host: bitbucket.com } repositories_count: "{{ repositories | length }}" rebuild_known_hosts: false From 7a388786c515c49f1a1e2d9bd42e41d3cbb5824e Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Wed, 21 Oct 2020 22:39:12 +0100 Subject: [PATCH 83/86] Move update apt into the beggining of the tasks --- roles/common/tasks/main.yml | 9 ++++++++- roles/nodejs/tasks/main.yml | 7 ------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index 3658db0..897de84 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -1,8 +1,15 @@ --- +- name: Update apt + become: yes + apt: + upgrade: "yes" + update_cache: yes + cache_valid_time: 86400 #one day + - name: Install utilities become: yes - apt: + apt: name: "{{ packages_utils }}" state: present diff --git a/roles/nodejs/tasks/main.yml b/roles/nodejs/tasks/main.yml index 553691e..24c5093 100644 --- a/roles/nodejs/tasks/main.yml +++ b/roles/nodejs/tasks/main.yml @@ -12,13 +12,6 @@ repo: "deb https://deb.nodesource.com/node_14.x focal main" state: present -- name: Update apt - become: yes - apt: - upgrade: "yes" - update_cache: yes - cache_valid_time: 86400 #one day - - name: Install NodeJS packages become: yes apt: From 65b4f2e19e49d57e681aef92531a4183ac23c3c0 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Mon, 14 Dec 2020 11:46:15 +0000 Subject: [PATCH 84/86] Add version directive on default config project collection --- default.config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/default.config.yml b/default.config.yml index 6048bc9..a3c370b 100644 --- a/default.config.yml +++ b/default.config.yml @@ -79,6 +79,7 @@ projects_path: "{{ guest_path }}" #path: "" #docroot: "" #type: "" + #version: "" #database: "" #repo: "" From 74b7417a51faffe14a19937eed4025958f018432 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Mon, 14 Dec 2020 12:02:18 +0000 Subject: [PATCH 85/86] Update project setup task with comment on behaviour --- roles/projects/tasks/main.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/roles/projects/tasks/main.yml b/roles/projects/tasks/main.yml index b972699..5c0f54b 100644 --- a/roles/projects/tasks/main.yml +++ b/roles/projects/tasks/main.yml @@ -21,6 +21,15 @@ # - debug: # var: dot_git +# Project setup behaviour +# +# IF a git repository has been declared in projects configuration +# THEN repository gets checkout +# +# IF a git repository has not been declared in projects configuration +# AND a .git directory does not exist in the directory +# THEN the task is run based on tech value chosen + - name: Initialise projects with repositories include_tasks: projects-project-git.yml with_items: "{{ dot_git.results }}" From f37f6dc4cd352b6cf20a5a90d73efb25a906a735 Mon Sep 17 00:00:00 2001 From: Tassos Koutlas Date: Mon, 14 Dec 2020 13:10:03 +0000 Subject: [PATCH 86/86] Remove sudo execution of composer self-update and add no-interaction flag --- roles/php/tasks/php-composer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/php/tasks/php-composer.yml b/roles/php/tasks/php-composer.yml index 9b00140..8f86004 100644 --- a/roles/php/tasks/php-composer.yml +++ b/roles/php/tasks/php-composer.yml @@ -31,7 +31,7 @@ backup: yes - name: Update composer to latest version - become: yes composer: command: self-update + arguments: --no-interaction global-command: yes