Phansible - generate Vagrant + Ansible dev environments for PHP

Overview

Phansible

Build Status Scrutinizer Code Quality Code Coverage License

Phansible is a simple generator for Vagrant projects, targeting PHP development environments, using Ansible as Provisioner.

It was inspired by PuPHPet.

The project is built on top of Silex, using Flint.

Contributions

Contributions are always welcome, please have a look at our issues to see if there's something you could help with. You can also join us on gitter.

TO DO

  • Deprecate 1.0 branch and put master into production
  • CI our generated roles (@naxhh is working on this)
  • API for generating roles outside the Web (@erikaheidi is working on this)
  • New technologies (request for your favourite ones!)
  • More documentation on how to customize things
  • Take a look at our issues.

Setup

  • Clone the repo: git clone https://github.com/Phansible/phansible.git
  • Go into the phansible folder cd phansible/
  • Install the dependencies with composer: php composer install
  • Run the php built in server: php -S 0.0.0.0:8080 -t web/
  • You can now go on http://localhost:8080 to see your modification.

As an alternative, you can also use the included Vagrant setup (requires Ansible).

Tests

To run the tests just do:

 ./vendor/bin/phpunit

Code style

To check the code style just do:

 ./vendor/bin/phpcs --standard=psr2 ./src
 ./vendor/bin/phpmd src/ text codesize,controversial,design,naming,unusedcode

When no errors appear you are ready to push your commits!

Comments
  • Proposal to move code from the bundle controller to separate roles.

    Proposal to move code from the bundle controller to separate roles.

    Here is my small and simple proposal to move the setup function to separate roles. Each ansible role should have it's own php class to setup the correct vars that are needed for this role. This way the bundle controller will become tiny again :)

    PS: didn't fix the tests yet, since it was just a PR to discuss :)

    opened by sndpl 26
  • UI from Phpansible

    UI from Phpansible

    Merging the UI from Phpansible in order to merge the projects.

    Phpansible UI has a lot more options, but we focused only on the ones Phansible already has.

    opened by InFog 24
  • Not sure why php is not getting installed.

    Not sure why php is not getting installed.

    Hi,

    In order to save the time/bandwidth I downloaded a box from https://vagrantcloud.com/ubuntu/boxes/trusty64/versions/14.04/providers/virtualbox.box and used to change the config.vm.box = "file:///home/hari/Downloads/virtualbox.box". It can download easily. A few errors I noticed seems not respect to box, may be you can help with . Same is happening with @puphpet . See issue https://github.com/puphpet/puphpet/issues/1224

    ==> default: cp: 
    ==> default: cannot stat ‘/vagrant/ansible/inventories/dev’
    ==> default: : No such file or directory
    ==> default: cat: 
    ==> default: /vagrant/ansible/files/authorized_keys
    ==> default: : No such file or directory
    ==> default: ERROR: the playbook: /vagrant/ansible/playbook.yml could not be found
    The SSH command responded with a non-zero exit status. Vagrant
    assumes that this means the command failed. The output for this command
    should be in the log above. Please read the output to determine what
    went wrong.
    \w > \u@\h [php:5.5.9-system]\n$ ls
    ansible  Vagrantfile
    \w > \u@\h [php:5.5.9-system]\n$ vagrant status
    /opt/vagrant/bin/../embedded/gems/gems/vagrant-1.6.5/lib/vagrant/pre-rubygems.rb:31: warning: Insecure world writable dir /var/www in PATH, mode 040777
    /opt/vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /var/www in PATH, mode 040777
    Current machine states:
    
    default                   running (virtualbox)
    
    The VM is running. To stop this VM, you can run `vagrant halt` to
    shut it down forcefully, or you can run `vagrant suspend` to simply
    suspend the virtual machine. In either case, to restart it again,
    simply run `vagrant up`.
    \w > \u@\h [php:5.5.9-system]\n$ vagrant ssh
    /opt/vagrant/bin/../embedded/gems/gems/vagrant-1.6.5/lib/vagrant/pre-rubygems.rb:31: warning: Insecure world writable dir /var/www in PATH, mode 040777
    /opt/vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /var/www in PATH, mode 040777
    Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-40-generic x86_64)
    
     * Documentation:  https://help.ubuntu.com/
    
      System information as of Thu Nov 27 01:17:53 UTC 2014
    
      System load:  0.37              Processes:           86
      Usage of /:   2.7% of 39.34GB   Users logged in:     0
      Memory usage: 16%               IP address for eth0: 10.0.2.15
      Swap usage:   0%
    
      Graph this data and manage this system at:
        https://landscape.canonical.com/
    
      Get cloud support with Ubuntu Advantage Cloud Guest:
        http://www.ubuntu.com/business/services/cloud
    
    0 packages can be updated.
    0 updates are security updates.
    
    
    vagrant@vagrant-ubuntu-trusty-64:~$ php -v
    The program 'php' is currently not installed. To run 'php' please ask your administrator to install the package 'php5-cli'
    
    opened by harikt 21
  • Error when attempting to run vagrant up for the first time

    Error when attempting to run vagrant up for the first time

    ERROR: The file ansible/inventories/dev is marked as executable, but failed to execute correctly. If this is not supposed to be an executable script, correct this with chmod -x ansible/inventories/dev. Ansible failed to complete successfully. Any error output should be visible above. Please fix these errors and try again.

    opened by thecrimpmaster 18
  • [RFC] Resolve #187

    [RFC] Resolve #187

    This PR address the issue #187

    The main changes were done on each relational database[1] YAML file and its TWIG template respectively

    The dump file must remain at the root level[2]

    [1] MySQL, MariaDB, PostgreSQL [2] /path/to/your/extracted_phansible/your_sql.sql

    opened by kinncj 17
  • Solr download url 404

    Solr download url 404

    The URL to download solr (5.2.0, or 5.3.0 tested) isn't working.

    TASK: [solr | Download] ******************************************************* 
    failed: [192.168.33.99] => {"dest": "/tmp", "failed": true, "gid": 0, "group": "root", "mode": "01777", "owner": "root", "response": "HTTP Error 404: Not Found", "size": 4096, "state": "directory", "status_code": 404, "uid": 0, "url": "http://mirrors.supportex.net/apache//solr-5.2.0.tgz"}
    msg: Request failed
    
    FATAL: all hosts have already failed -- aborting
    
    opened by spoetnik 16
  • support for blackfire.io

    support for blackfire.io

    The PR adds support for blackfire.io code analysis service. In the form you can provide server id and token that are necessary for the profiler to work.

    opened by leafnode 16
  • Hostname is not defined.

    Hostname is not defined.

    I've an error when running a default generated playbook using Vagrant in windows.

    The error is:

    ==> default: TASK: [init | Update /etc/hosts] **********************************************
    ==> default: fatal: [192.168.33.99] => One or more undefined variables: 'hostname' is undefined
    

    You can check the full log: http://pastebin.com/xgSLExX3

    Checking for #110 I've found this error.

    Seems that this hostname is added in the Vagrant file.

    Debugging the content returns:

    ==> default: ok: [192.168.33.99] => {
    ==> default:     "hostname": "{{ hostname }}"
    ==> default: }
    
    bug 
    opened by naxhh 14
  • New Rules on the Road.

    New Rules on the Road.

    Ok, guys. I've been thinking a lot in the last days, and I'm just not happy on how this project was going.

    First of all, I find it really unfair that my name was removed from the "authors" on composer.json, and I didn't say anything before because I really thought that both @InFog and @fabiorphp would be more active in the project development, which didn't really happen. It's just not fair! I created this project, the name, the actual system and even the server where it is hosted. So YES, I am the author and the lead developer here, whether you like it or not.

    The merge of phansible with phpansible didn't happen as I expected it would be, and I'm just unhappy with the results and the project status right now. I want to take control again over what I created.

    We will have new roles now. I'm taking the responsibility of merging the pull requests, approving or not things, in this repository. If you guys want to take care of the phansible-roles repository, it's great. But I will take responsibility on phansible.com from now on .

    If you don't agree with all of this, you are free to create a fork, respecting the MIT license. Or you can separate the projects, in order to work again in phpansible.com. I might as well change the front-end soon if you want to use this front-end.

    I'm sorry, but I just can't go ahead in the way it is now.

    opened by erikaheidi 13
  • Feature/roles from repos

    Feature/roles from repos

    So this is the current way we will clone roles from their repos.

    As @debo pointed out in chats. We could add galaxy so it will be easier. But first I really want to deploy 0.7.3

    I've pending to check the deploy script.. So it will update the dependencies. But since I'm the only one doing that. That could wait. But it will in 0.7.3 for sure.

    Roles in repo take in a conceptual change. You don't test roles with phansible UI. If you want to test the role you do it in the repo of the role itself. In the UI you only test that phansible creates the correct var files and includes the role in the bundle.

    With this conceptual change testing phansible UI will become a lot easier and testing roles can be automated without pains as we are currently doing.

    opened by naxhh 12
  • Contribution for CentOS support

    Contribution for CentOS support

    Hey @naxhh @erikaheidi pointed me in your direction. I'm willing to step-up on this one. I seen that where was a previous issue open later closed with no progress. Are you ok with me to go on with this? How would you prefer me to proceed?

    opened by debo 12
  • Incorrect PHP version in PHP-FPM

    Incorrect PHP version in PHP-FPM

    Utilizing Phansible I've managed to fix all the bugs to bring up a LEMP stack properly.

    I have ran php -v and 5.6.30 for CLI is installed. However when I ran through the forward nginx web - I am getting errors. With phpinfo(); from the web I have discovered that php5-fpm is set and that is on native ubuntu 5.5.9.

    PHP 5.6 did get installed under /usr/sbin/php-fpm5.6 however. How do i get the correct version of PHP installed both for CLI (currently working) and fpm (currently not work) within ansible playbook rather than copying files over since I have to distribute this vagrant ansible setup across projects.

    opened by beerbuddha 0
  • ondrej/php5 no longer available

    ondrej/php5 no longer available

    I've just tried to boot up a newly configured box, and been told that the PPA could not be found.

    Digging in to the PHP role it was using ondrej/php5 as the PPA. It looks like this was previously deprecated, and therefore may have been removed.

    I've changed to ondrej/php, and everything seems to have worked OK, so think that this might need updating.

    opened by toby-griffiths 0
  •  vagrant up : No package matching 'server.packages' is available

    vagrant up : No package matching 'server.packages' is available

    • I used http://phansible.com/ to generate https://file.io/v3TnEr
    • when run vagrant up it gives "No package matching 'server.packages' is available" (log : https://pastebin.mozilla.org/8954010)
    • non of packages I've selected has been installed.

    I am using windows and hosts file has been updated. Anything has to be changed?

    opened by dumindu 7
  • Errors on Vagrant Up...

    Errors on Vagrant Up...

    Suddenly started getting errors on booting up VMs: changed overnight with no changes in my local environment. The error message has changed (which again suggests it's not a local issue), but It seems to be to do with loading PHP. Any ideas? Thanks in advance for your help!

    Here's the tail end of the log:

    ==> default: TASK [php : Add ppa Repository] ************************************************ ==> default: fatal: [192.168.33.99]: FAILED! => {"changed": false, "failed": true, "msg": "failed to fetch PPA information, error was: HTTP Error 404: Not Found"} ==> default: ==> default: RUNNING HANDLER [apache : restart apache] ************************************** ==> default: to retry, use: --limit @/vagrant/ansible/playbook.retry ==> default: ==> default: PLAY RECAP ********************************************************************* ==> default: 192.168.33.99 : ok=20 changed=18 unreachable=0 failed=1
    The SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed. The output for this command should be in the log above. Please read the output to determine what went wrong.

    opened by JimPirrie 12
  • Getting errors on vagrant up

    Getting errors on vagrant up

    Hi, Trying to run a box and after vagrant up I'm getting the following errors:

    ....
    ==> default: stdin: is not a tty
    ....
    ==> default: gpg:
    ==> default: keyring `/tmp/tmprfhgdqk1/secring.gpg' created
    ==> default: gpg:
    ==> default: keyring `/tmp/tmprfhgdqk1/pubring.gpg' created
    ==> default: gpg:
    ==> default: requesting key 7BB9C367 from hkp server keyserver.ubuntu.com
    ==> default: gpg:
    ==> default: /tmp/tmprfhgdqk1/trustdb.gpg: trustdb created
    ==> default: gpg:
    ==> default: key 7BB9C367: public key "Launchpad PPA for Ansible, Inc." imported
    ==> default: gpg:
    ==> default: Total number processed: 1
    ==> default: gpg:
    ==> default:               imported: 1
    ==> default:   (RSA: 1)
    ....
    ==> default: dpkg-preconfigure: unable to re-open stdin: No such file or directory
    ....
    ==> default: cp:
    ==> default: cannot stat ‘/vagrant/ansible/inventories/dev’
    ==> default: : No such file or directory
    ==> default: cat:
    ==> default: /vagrant/ansible/files/authorized_keys
    ==> default: : No such file or directory
    ==> default: ERROR! the playbook: /vagrant/ansible/playbook.yml could not be found
    The SSH command responded with a non-zero exit status. Vagrant
    assumes that this means the command failed. The output for this command
    should be in the log above. Please read the output to determine what
    went wrong.
    

    I usually used already pre-made vagrant boxes before and creating my own for the first time.

    bug 
    opened by vatnoise 10
Releases(0.7.2)
Owner
phansible
Phansible lets you easily generate Ansible provisions for PHP web servers
phansible
Vagrant is a tool for building and distributing development environments.

Vagrant Website: https://www.vagrantup.com/ Source: https://github.com/hashicorp/vagrant HashiCorp Discuss: https://discuss.hashicorp.com/c/vagrant/24

HashiCorp 24.8k Jan 2, 2023
Vagrant-boxes - Setup scripts and docs for my vagrant boxes, primarily aimed at Web/SilverStripe developement

zauberfisch's vagrant boxes zauberfisch/silverstripe-debian64 Debian 10 x86_64 LAMP Box with many extra features, pre-configured for SilverStripe Sour

null 6 Jan 24, 2020
Up and running with small Docker environments

Vessel Up and running with small Docker dev environments. Documentation Full documentation can be found at https://vessel.shippingdocker.com. Install

Shipping Docker 1.1k Dec 17, 2022
Vagrant/Puppet GUI

PuPHPet PuPHPet - A simple GUI to set up virtual machines for PHP development What? PuPHPet is a web application that allows you to easily and quickly

PuPHPet 3.9k Dec 24, 2022
Protobox is vagrant web GUI

Protobox Protobox is a layer on top of vagrant and a web GUI to setup virtual machines for web development. A single YAML document controls everything

protobox 354 Nov 30, 2022
Shopware 6 app boilerplate + Symfony backend + Dockware docker dev environment 💙

Shopware 6 app boilerplate with Symfony backend This boilerplate template can be used to get up and running with a docker-based dev setup for Shopware

Rune Laenen 8 Oct 11, 2022
A package that allows you to generate simple and fast Docker configurations for your Laravel application!

A package that allows you to generate simple and fast Docker configurations for your Laravel application!

Lucas Nepomuceno 3 Oct 8, 2022
Brew PHP switcher is a simple shell script to switch your apache and CLI quickly between major versions of PHP

Brew PHP switcher is a simple shell script to switch your apache and CLI quickly between major versions of PHP. If you support multiple products/projects that are built using either brand new or old legacy PHP functionality. For users of Homebrew (or brew for short) currently only.

Phil Cook 872 Dec 22, 2022
Dockerized PHP development stack: Nginx, MySQL, MongoDB, PHP-FPM, HHVM, Memcached, Redis, Elasticsearch and RabbitMQ

PHP Dockerized Dockerized PHP development stack: Nginx, MySQL, MongoDB, PHP-FPM, HHVM, Memcached, Redis, Elasticsearch and RabbitMQ PHP Dockerized giv

Kasper Isager Dalsgarð 1.1k Dec 30, 2022
Monitor for any changes in your php application and automatically restart it (suitable for async apps).

PHP-watcher PHP-watcher helps develop long-running PHP applications by automatically restarting them when file changes in the directory are detected.

Sergey Zhuk 373 Dec 21, 2022
Full PHP development environment for Docker.

Full PHP development environment based on Docker. Use Docker First - Learn About It Later! Join Us Awesome People Laradock is an MIT-licensed open sou

laradock 11.7k Jan 7, 2023
Blazing fast macOS PHP development environment

Introduction Valet+ is a development environment for macOS. No Vagrant, no Docker, no /etc/hosts file. Go here for the valet+ documentation. Credits T

We Provide 1.5k Jan 2, 2023
Laravel 5 with Dockerized Gulp, PHP-FPM, MySQL and nginx using docker-compose

docker-laravel Laravel 5 with Dockerized PHP-FPM, MySQL and nginx using docker-compose Usage Get Composer docker-compose run --rm phpnginx curl -O htt

Harsh Vakharia 83 Feb 8, 2022
Docker with PHP 7.4 fpm, Nginx, Composer, PhpUnit and MaridaDB

Clean Docker with PHP Docker with PHP 7.4 fpm, Nginx, Composer, PhpUnit and MariaDB Starting app docker-compose up -d Main page

Grzegorz Bielski 7 Nov 17, 2022
DDEV-Local: a local PHP development environment system

ddev ddev is an open source tool that makes it simple to get local PHP development environments up and running in minutes. It's powerful and flexible

DDEV 1.6k Dec 29, 2022
Runs a PHP-based startpage in Docker

docker-php-startpage Runs a PHP-based startpage in Docker Source code: GitHub Docker container: Docker Hub Image base: PHP Init system: N/A Applicatio

Logan Marchione 25 Dec 28, 2022
Lamp Docker skeleton PHP + Nginx + Mysql + Redis

Stop installing the entire development stack on your local machine. This project will allow you to quickly start working with php. To install, you need to install docker locally.

Krepysh 9 Dec 27, 2022
ServD - a Docker PHP development environment heavily inspired by Laravel Valet and Laradock

ServD ServD is a Docker PHP development environment heavily inspired by Laravel Valet and Laradock, it supports multiple projects within a working dir

Matt Clinton 2 May 13, 2022
Finally a sane way to register available commands and arguments and match your command line in PHP

clue/commander Finally a sane way to register available commands and arguments and match your command line in PHP. You want to build a command line in

Christian Lück 172 Nov 27, 2022