PhalconPHP Puppet module (compiles zephir, phalconphp, and installs the devtools)

Hi everyone!

UPDATE This module is now available here: https://github.com/phalcon/puppet

I've just finished up putting together a puppet module. Please check it out and feel free to let me know any issues and/or contribute:

GitHub:

https://github.com/pennycoders/puppet-phalconphp

NOTE: The plugin only has only been tested on CentOS 6.5 x64 so far.



81.1k

Great job!



3.4k

Thanks! Really appreciate it.

edited Feb '14

Nice, but some items can be done more clearly )) For e.g. https://github.com/pennycoders/puppet-phalconphp/blob/master/manifests/deps/sys.pp

Can be replaced with:

$packages = [
    "package1",
    "package2"
]

package { $packages:
    ensure => "installed",
    require => Exec['apt-get update']
}


3.4k
edited Feb '14

Yeah, i guess it can be replaced with that, however, i do think it's best if it checks whether the packages are already defined or not, but basically you are right, 'cuz then i could do something like this:

$packages = [
    "package1",
    "package2"
]

each( $packages) |$key, $package| {
          if defined(Package[$package])==false{
            package {$package: ensure => present}
         }
}

Also, as far as debian based distros go, i don't use debian much, but i will try to make the module work with debian as well, as soon as i get some time.



3.4k

Just updated the module according to the above, and made a first attempt to make it debian compatible (not exactly sure about the package names for debian, though). If any of you guys can test, that'd be great!

Cheers,

Alex.

Wrapped exception:
Could not match |$key,
Error: Could not match |$key, at /tmp/vagrant-puppet-1/modules-0/phalconphp/manifests/deps/sys.pp:41 on node vagrant.local

I'am using puppet v.3.4.1

Also add please 'ubuntu', 'debian' to case statement.



3.4k
edited Feb '14

Ok, all that is done. Can you test please?

I did remove the $key from the each loop. I am using the latest stable version of puppet, but it's called with future parser.

It was working for me before this latest commit, and it is working now.

Please check the source code below:

```text https://raw.github.com/pennycoders/puppet-phalconphp/master/manifests/deps/sys.pp ```

Awaiting your feedback

edited Feb '14

I has an error (with versions: 3.3.2, 3.4.1, 3.4.3):

Could not match |$value|
Error: Could not match |$value| at /tmp/vagrant-puppet-1/modules-0/phalconphp/manifests/deps/sys.pp:46 on node vagrant.local

It doesn't understand 'each' statement... Only works with - https://gist.github.com/lantian/9249058

But I'm stuck with another error:

Warning: Scope(Php::Augeas[php-load-phalcon-2.0]): Could not look up qualified variable 'php::config_file'; class php has not been evaluated
Error: Unknown function params_lookup at /tmp/vagrant-puppet-1/modules-0/php/manifests/init.pp:171 on node vagrant.local

It is example42/php module...



3.4k
edited Feb '14

Ok, so i've looked into it deeper, and i've found that you need the example42/puppi package in order to be able to be able to use paramslookup. I would advise you to check your vagrant box one more time, so you can make sure everything is in order, since on my machine, it works flawlessly. If you have used puphpet, that might have something to do with it. Also, regarding the could not match error, i've renamed the variables so that they are more specific. See the reason here:http://docs.puppetlabs.com/guides/troubleshooting.html#could-not-match-definename-at-manifestppnnn-on-node-nodename. Also, as far as the paramslookup error goes, i did add the puppi module as a dependency. Please, let me know, and thank you for your feedback!



3.4k

BTW, please note, if you are encountering the same issue (could not match...), please call the phalconphp class with compatsysdeps=>true

Added example42/puppi, but:

Warning: Scope(Php::Augeas[php-load-phalcon-2.0]): Could not look up qualified variable 'php::config_file'; class php has not been evaluated
Error: Validation of Augeas[php_ini-php-load-phalcon-2.0] failed: You must specify both the lens and incl parameters, or neither. at /tmp/vagrant-puppet-1/modules-0/php/manifests/augeas.pp:74
Wrapped exception:
You must specify both the lens and incl parameters, or neither.


3.4k
edited Feb '14

Hey Ivan,

I think the issue is within the php module version you are using, or some inconsistency between the debian and redhat version. Please, could you look into it? I do not use debian myself. Also, if you could send me the vagrant box config you are testing this on, that might be helpful. As you see, i do require the php class inside manifests/deps/framework.pp

php::augeas { 'php-load-phalcon-2.0':
      entry   => 'EXT/extension',
      value   => 'phalcon.so',
      require => [
        Class['php'],
        Exec['remove-phalcon-src-2.0']]
    }

Also, try using the master branch (specify it as the master framework. If you do, however use the 2.0.0 branch, try to set the install_zephir parameter for the class, so that it uses the test-install script, which seems to work. Again, on my CentOS 6.5 server it runs perfectly, both on my local machine, and on the production server.

Cheers,

Alex.

Ok, when i will have more time - i will try to investigate the issue, thanks.



3.4k

Hey guys,

Just a quick update, been working on a module for a bit more today. I will get an ubuntu vagrant up myself, when i get a chance, currently i'm working on a few mission critical tasks.

Cheers,

Alex.



3.4k

Hey guys,

Just a quick update, before i was getting a nasty pdo-related error when i was running php with phalcon installed. ou Turns out that phalconphp needs to be loaded AFTER the pdo extension. Also, please note that i've adjusted the module so that it prevents that from happening. Hope you find this module useful. I don't trust sys administrators to fulfill my dev. needs, so i figured this is a good way to boost both the adopption rate, and show a good sample of automation.



81.1k

Hey Alex, keep up the work, when it's ready we can add this to the download page

Hey guys,

Just a quick update, before i was getting a nasty pdo-related error when i was running php with phalcon installed. ou Turns out that phalconphp needs to be loaded AFTER the pdo extension. Also, please note that i've adjusted the module so that it prevents that from happening. Hope you find this module useful. I don't trust sys administrators to fulfill my dev. needs, so i figured this is a good way to boost both the adopption rate, and show a good sample of automation.



3.4k
edited Mar '14

Well, it is definitely ready, at least for CentOS/RHEL, i've testend and re-tested a lot, but as soon as i get it sorted for debian, i can post that in here. It compiles both the stable (1.2.x) version of the framework, and the 2.0.0 branch (due to the zephir compilation error, the method on github does not work yet), see here, but as soon that's sorted, it should be fully functional.

Cheers,

Alex.



81.1k

Alex, maybe include Phalcon 2/Zephir is not necessary now since maybe their installation is willing to change. Could you release it without these components?



3.4k
edited Mar '14

Hey,

Well, i've set the default branch to master, plus, there is not much to change of the installation procedure changes, and since i will need the if blocks for when phalcon 2.x comes out, i think it'll be good. The only point of installing the two was to experiment with them, and they have both worked. 1.x is rock solid for me. If you want, sure, i can simply remove the ability to install 2.x, but it's not really a gain. The default branch for the module defaults to master, which is stable, right ?

Cheers,

Alex.



3.4k
edited Mar '14

Hey Guys, just to let you know,

In order to compile the latest stable branch, you can just use this sequence of code, within your puppet manifest:

class { 'phalconphp':
        ensure_sys_deps => true
  }


81.1k

Hey Alex, could you please upload your repo to https://github.com/phalcon/puppet?



3.4k

Sure, but i do not seem to have access, can you add me as a collaborator to the repo ? Username is pennycoders.

Cheers,

Alex.



3.4k
edited Mar '14

Also, if you want i can upload a full vagrant configuration, to a different repo, that will actually give the users a development environment. It's really nice, and all they'll have to do to use it is edit JSON.



81.1k

I added you as collaborator,

Regarding a Vagrant configuration. that would be great, it would make the development more enjoyable, we already have this repo: https://github.com/phalcon/vagrant, it does not use puppet, but maybe it could be extended to use it



3.4k
edited Mar '14

I've already set one up, but it's not just phalcon, it's way more complex than that. Sent you an email to the email address listed on github (you can test it, it's fully functional). All you gotta' do is run vagrant up, but since is not quite documented yet, it wouldn't be wise to get it up for mass usage, although nothing is stopping anybody from using it). That's a bit easier to manage, since all you have to do is edit json. I am going to work on a good documentation, and a stripped down version, so that you guys can use it. I always prefr puppet to ssh, due to the fact that it's much better structured, and it is "field-tested" for dependency management. Everything that's on that box is meant to be FAST, which i think is what this framework is all about. You can play with it any time you want, though, but i'll get a well documented version up, which is only going to contain what a phalcon dev might be interested in.

Cheers,

Alex.



3.4k


3.4k
edited Apr '14

Just updated the module, so that you can now use puppet to install phalconphp in production as well.

Please check the PhalconPHP Puppet module repo

Cheers,

Alex.