beetboxvm / beetbox

Pre-provisioned L*MP stack
http://beetbox.rtfd.org
92 stars 19 forks source link

Who's up for Beetbox using Centos / RHEL? #354

Closed christopher-hopper closed 7 years ago

christopher-hopper commented 7 years ago

When developing and testing code it is essential to have a local environment that matches the intended target as closely as possible. The PHP binaries installed on Debian / Ubuntu are not the same as those you'll get for CentOS / RHEL. Nor are many or all of the other key elements of the web stack.

Many of the Ansible galaxy roles relied upon by Beetbox already support both Debian and RHEL based distributions. So they will work nicely when run on Ubuntu or CentOS without needing a lot of work.

The Ansible playbooks and roles for Beetbox itself all assume Ubuntu as the target. Nothing wrong with that by the way, as this is the target distribution.

We could open Beetbox up to support both Debian and RHEL based distros by adjusting some of the patterns used in the Beetbox Ansible code to be more distro aware.

Imagine this:

vagrant box add beet/centos

Example

Here's some sample Ansible code that installs the Vi Improved text editor. It will work on either Ubuntu or Centos:

- name: "Install Vi Improved."
  package:
    name: "{{ (ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux') | ternary('vim-enhanced', 'vim') }}"
    state: latest
ivangrynenko commented 7 years ago

Would be a real step forward, however I suspect this may create maintainability issues. For me, I prefer CentOS 7 as the server OS even for web development, all projects I run are CentOS.

thom8 commented 7 years ago

@christopher-hopper this has aways been part of the plan however we decided to initially focus on a single OS and version and make it really stable.

The templated packer scripts should make this a lot easier too.

https://github.com/beetboxvm/beetbox/tree/master/provisioning/ansible/roles/beetbox-packer/templates

I even started some work on this a few months ago -- https://github.com/thom8/beetbox/commit/43f28080cf2281887ebfaf5773e7ab6fcc969589

christopher-hopper commented 7 years ago

@ivrh @thom8 as a first step, I'd suggest a fork, or parallel branch:

  1. Configure CI to run all existing tests against both CentOS and Ubuntu OS.
  2. Address each test failure until code works on both OSs
  3. Once all tests work on both OSs, merge the fork/branch back to main project
  4. All new features then need to pass tests on both OSs before inclusion

Maintainability issues should be dealt with via the tests. This effort could begin to address any areas that need more adequate coverage. I did look at the packer scripts a while back and thought this could be done quite well using the structure you've already got. Nice work.

christopher-hopper commented 7 years ago

As the majority of included Ansible Galaxy roles already have test coverage on both OSs this effort would probably involve pushing some changes to those minority that don't currently support CentOS.

Where an Ansible role maintainer will not or cannot support CentOS, consider :

  1. Seeking alternative Ansible Galaxy role
  2. Forking the role project to fix with a view to merging back upstream
  3. Removing the role functionality (maybe it's not a good fit if it cannot or will not work on any Linux distro)
christopher-hopper commented 7 years ago

This post by Jeff Geerling may be a good place to start in setting up multi-platform testing:

thom8 commented 7 years ago

Configure CI to run all existing tests against both CentOS and Ubuntu OS.

@christopher-hopper I would start with updating the existing CI config to use docker with ubuntu 14.04 on circle CI. This can be done via a PR, then we can add a CentOS build with parallelism -- https://circleci.com/docs/setting-up-parallelism/

We currently use this feature in the Drupal role -- https://github.com/beetboxvm/ansible-role-beetbox-drupal/blob/master/circle.yml#L15 -&- https://circleci.com/gh/beetboxvm/ansible-role-beetbox-drupal/42

I prefer Circle CI for SSH debugging feature alone.

christopher-hopper commented 7 years ago

Sorry, did I suggest something other than CircleCI? If so, I didn't mean to. Whatever the CI platform, use of Docker containers would be the way to go given what I have read.

thom8 commented 7 years ago

384 just landed which adds a robo/docker task -- vendor/bin/robo provision

by default it runs on a ubuntu:14.04 base image but is configurable...

vendor/bin/robo provision centos:7 beet_test will demonstrate how broken this project is on centos atm but at least provides a starting point.

thom8 commented 7 years ago

Unlikely going to get time to work on this so I'm just going to recommend you use Drupal VM if you want CentOS / RHEL support.