geerlingguy / drupalci-sonar-jenkins

DEPRECATED - Drupal CI environment with SonarQube and Jenkins for Drupal Core code analysis.
41 stars 16 forks source link

After vagrant up, browser connection times out. Due to automatically added host entry not being correct #10

Closed richardtape closed 9 years ago

richardtape commented 9 years ago

Hey Jeff,

First, thanks so very, very much for putting all of this together and for your blog posts on the subject.

I've followed your instructions (I think!) but haven't quite managed to get anything visible browser-side. Here's some info which may help, but I'm kinda stuck as much of this stack is new to me.

Here's what I see if I do a --version

Vagrant 1.7.2 Virtualbox: 4.3.26 Ansible: ansible 1.9.0.1 configured module search path = None

And after a vagrant up (which produced no noticeable errors, and added the line to my hosts file automatically) but the browser timed out, I ran a vagrant provision, and got the following:

vagrant provision
==> drupalci: Running provisioner: ansible...
PYTHONUNBUFFERED=1 ANSIBLE_FORCE_COLOR=true ANSIBLE_HOST_KEY_CHECKING=false ANSIBLE_SSH_ARGS='-o UserKnownHostsFile=/dev/null -o ControlMaster=auto -o ControlPersist=60s' ansible-playbook --private-key=/Users/richardtape/.vagrant.d/insecure_private_key --user=vagrant --connection=ssh --limit='drupalci' --inventory-file=provisioning/inventory-local --sudo provisioning/playbook.yml

PLAY [drupalci] *************************************************************** 

GATHERING FACTS *************************************************************** 
ok: [192.168.99.9]

TASK: [Ensure unzip is installed.] ******************************************** 
ok: [192.168.99.9]

TASK: [geerlingguy.firewall | Ensure iptables is installed (RedHat).] ********* 
ok: [192.168.99.9]

TASK: [geerlingguy.firewall | Ensure iptables is installed (Debian).] ********* 
skipping: [192.168.99.9]

TASK: [geerlingguy.firewall | Flush iptables the first time playbook runs.] *** 
ok: [192.168.99.9]

TASK: [geerlingguy.firewall | Copy firewall script into place.] *************** 
ok: [192.168.99.9]

TASK: [geerlingguy.firewall | Copy firewall init script into place.] ********** 
ok: [192.168.99.9]

TASK: [geerlingguy.firewall | Ensure the firewall is enabled and will start on boot.] *** 
ok: [192.168.99.9]

TASK: [geerlingguy.repo-epel | Install EPEL repo.] **************************** 
ok: [192.168.99.9]

TASK: [geerlingguy.repo-epel | Import EPEL GPG key.] ************************** 
ok: [192.168.99.9]

TASK: [geerlingguy.repo-remi | Download Remi repo.] *************************** 
ok: [192.168.99.9]

TASK: [geerlingguy.repo-remi | Install Remi repo.] **************************** 
ok: [192.168.99.9]

TASK: [geerlingguy.ntp | Include OS-specific variables.] ********************** 
ok: [192.168.99.9]

TASK: [geerlingguy.ntp | Set the correct timezone.] *************************** 
ok: [192.168.99.9]

TASK: [geerlingguy.ntp | Install NTP (RedHat).] ******************************* 
ok: [192.168.99.9]

TASK: [geerlingguy.ntp | Install NTP (Debian).] ******************************* 
skipping: [192.168.99.9]

TASK: [geerlingguy.ntp | Ensure NTP is running and enabled at system start.] *** 
skipping: [192.168.99.9]

TASK: [geerlingguy.ntp | Ensure NTP is stopped and disabled at system start.] *** 
changed: [192.168.99.9]

TASK: [geerlingguy.munin-node | Include OS-specific variables.] *************** 
ok: [192.168.99.9]

TASK: [geerlingguy.munin-node | Ensure munin-node is installed (RedHat).] ***** 
ok: [192.168.99.9]

TASK: [geerlingguy.munin-node | Ensure munin-node is installed (Debian).] ***** 
skipping: [192.168.99.9]

TASK: [geerlingguy.munin-node | Copy munin-node configuration.] *************** 
ok: [192.168.99.9]

TASK: [geerlingguy.munin-node | Generate plugin configuration.] *************** 
ok: [192.168.99.9]

TASK: [geerlingguy.munin-node | Enable additional plugins.] ******************* 
skipping: [192.168.99.9]

TASK: [geerlingguy.munin-node | Ensure munin-node is running.] **************** 
ok: [192.168.99.9]

TASK: [geerlingguy.git | Ensure git is installed (RedHat).] ******************* 
ok: [192.168.99.9] => (item=git,git-svn)

TASK: [geerlingguy.git | Ensure git is installed (Debian).] ******************* 
skipping: [192.168.99.9]

TASK: [geerlingguy.git | Ensure git's dependencies are installed (RedHat).] *** 
skipping: [192.168.99.9]

TASK: [geerlingguy.git | Ensure git's dependencies are installed (Debian).] *** 
skipping: [192.168.99.9]

TASK: [geerlingguy.git | Download git.] *************************************** 
skipping: [192.168.99.9]

TASK: [geerlingguy.git | Expand git archive.] ********************************* 
skipping: [192.168.99.9]

TASK: [geerlingguy.git | Check if git is installed.] ************************** 
skipping: [192.168.99.9]

TASK: [geerlingguy.git | Build git.] ****************************************** 
skipping: [192.168.99.9] => (item=all)
skipping: [192.168.99.9] => (item=install)

TASK: [geerlingguy.java | Include OS-specific variables.] ********************* 
ok: [192.168.99.9]

TASK: [geerlingguy.java | Define java_packages.] ****************************** 
skipping: [192.168.99.9]

TASK: [geerlingguy.java | Ensure Java is installed.] ************************** 
ok: [192.168.99.9] => (item=java-1.7.0-openjdk)

TASK: [geerlingguy.java | Update apt cache.] ********************************** 
skipping: [192.168.99.9]

TASK: [geerlingguy.java | Ensure Java is installed.] ************************** 
skipping: [192.168.99.9]

TASK: [geerlingguy.java | Include OS-specific variables.] ********************* 
ok: [192.168.99.9]

TASK: [geerlingguy.java | Define java_packages.] ****************************** 
skipping: [192.168.99.9]

TASK: [geerlingguy.java | Ensure Java is installed.] ************************** 
ok: [192.168.99.9] => (item=java-1.7.0-openjdk)

TASK: [geerlingguy.java | Update apt cache.] ********************************** 
skipping: [192.168.99.9]

TASK: [geerlingguy.java | Ensure Java is installed.] ************************** 
skipping: [192.168.99.9]

TASK: [geerlingguy.jenkins | Include OS-Specific variables] ******************* 
ok: [192.168.99.9]

TASK: [geerlingguy.jenkins | Define jenkins_repo_url] ************************* 
ok: [192.168.99.9]

TASK: [geerlingguy.jenkins | Define jenkins_repo_key_url] ********************* 
ok: [192.168.99.9]

TASK: [geerlingguy.jenkins | Ensure dependencies are installed.] ************** 
ok: [192.168.99.9]

TASK: [geerlingguy.jenkins | Ensure Jenkins repo is installed.] *************** 
ok: [192.168.99.9]

TASK: [geerlingguy.jenkins | Add Jenkins repo GPG key.] *********************** 
ok: [192.168.99.9]

TASK: [geerlingguy.jenkins | Ensure Jenkins is installed.] ******************** 
ok: [192.168.99.9]

TASK: [geerlingguy.jenkins | Ensure dependencies are installed.] ************** 
skipping: [192.168.99.9]

TASK: [geerlingguy.jenkins | Add Jenkins apt repository key.] ***************** 
skipping: [192.168.99.9]

TASK: [geerlingguy.jenkins | Add Jenkins apt repository.] ********************* 
skipping: [192.168.99.9]

TASK: [geerlingguy.jenkins | Ensure Jenkins is installed.] ******************** 
skipping: [192.168.99.9]

TASK: [geerlingguy.jenkins | Ensure Jenkins is started and runs on startup.] *** 
ok: [192.168.99.9]

TASK: [geerlingguy.jenkins | Wait for Jenkins to start up before proceeding.] *** 
ok: [192.168.99.9]

TASK: [geerlingguy.jenkins | Get the jenkins-cli jarfile from the Jenkins server.] *** 
ok: [192.168.99.9]

TASK: [geerlingguy.jenkins | Create Jenkins updates folder.] ****************** 
ok: [192.168.99.9]

TASK: [geerlingguy.jenkins | Update Jenkins plugin data.] ********************* 
ok: [192.168.99.9]

TASK: [geerlingguy.jenkins | Permissions for default.json updates info.] ****** 
ok: [192.168.99.9]

TASK: [geerlingguy.jenkins | Install Jenkins plugins.] ************************ 
ok: [192.168.99.9] => (item=phing)
ok: [192.168.99.9] => (item=git)
ok: [192.168.99.9] => (item=sonar)
ok: [192.168.99.9] => (item=ssh)

TASK: [geerlingguy.php | Include OS-specific variables.] ********************** 
ok: [192.168.99.9]

TASK: [geerlingguy.php | Define php_packages.] ******************************** 
skipping: [192.168.99.9]

TASK: [geerlingguy.php | Define php_webserver_daemon.] ************************ 
skipping: [192.168.99.9]

TASK: [geerlingguy.php | Define php_conf_path.] ******************************* 
ok: [192.168.99.9]

TASK: [geerlingguy.php | Define php_extension_conf_path.] ********************* 
skipping: [192.168.99.9]

TASK: [geerlingguy.php | Ensure PHP packages are installed.] ****************** 
ok: [192.168.99.9] => (item=php,php-devel,php-xml)

TASK: [geerlingguy.php | Update apt cache.] *********************************** 
skipping: [192.168.99.9]

TASK: [geerlingguy.php | Ensure PHP packages are installed.] ****************** 
skipping: [192.168.99.9]

TASK: [geerlingguy.php | Check the installed version of PHP.] ***************** 
ok: [192.168.99.9]

TASK: [geerlingguy.php | Disable opcache if PHP version is < 5.5.] ************ 
ok: [192.168.99.9]

TASK: [geerlingguy.php | Ensure configuration directories exist.] ************* 
ok: [192.168.99.9] => (item=/etc)
ok: [192.168.99.9] => (item=/etc/php.d)

TASK: [geerlingguy.php | Place PHP configuration file in place.] ************** 
ok: [192.168.99.9]

TASK: [geerlingguy.php | Place APC configuration file in place.] ************** 
ok: [192.168.99.9]

TASK: [geerlingguy.php | Place OpCache configuration file in place.] ********** 
skipping: [192.168.99.9]

TASK: [geerlingguy.php | Ensure php-fpm is started and enabled at boot (if configured).] *** 
skipping: [192.168.99.9]

TASK: [geerlingguy.php | Include OS-specific variables.] ********************** 
ok: [192.168.99.9]

TASK: [geerlingguy.php | Define php_packages.] ******************************** 
skipping: [192.168.99.9]

TASK: [geerlingguy.php | Define php_webserver_daemon.] ************************ 
skipping: [192.168.99.9]

TASK: [geerlingguy.php | Define php_conf_path.] ******************************* 
skipping: [192.168.99.9]

TASK: [geerlingguy.php | Define php_extension_conf_path.] ********************* 
skipping: [192.168.99.9]

TASK: [geerlingguy.php | Ensure PHP packages are installed.] ****************** 
ok: [192.168.99.9] => (item=php,php-devel,php-xml)

TASK: [geerlingguy.php | Update apt cache.] *********************************** 
skipping: [192.168.99.9]

TASK: [geerlingguy.php | Ensure PHP packages are installed.] ****************** 
skipping: [192.168.99.9]

TASK: [geerlingguy.php | Check the installed version of PHP.] ***************** 
ok: [192.168.99.9]

TASK: [geerlingguy.php | Disable opcache if PHP version is < 5.5.] ************ 
ok: [192.168.99.9]

TASK: [geerlingguy.php | Ensure configuration directories exist.] ************* 
ok: [192.168.99.9] => (item=/etc)
ok: [192.168.99.9] => (item=/etc/php.d)

TASK: [geerlingguy.php | Place PHP configuration file in place.] ************** 
ok: [192.168.99.9]

TASK: [geerlingguy.php | Place APC configuration file in place.] ************** 
ok: [192.168.99.9]

TASK: [geerlingguy.php | Place OpCache configuration file in place.] ********** 
skipping: [192.168.99.9]

TASK: [geerlingguy.php | Ensure php-fpm is started and enabled at boot (if configured).] *** 
skipping: [192.168.99.9]

TASK: [geerlingguy.composer | Ensure curl is installed (RedHat).] ************* 
ok: [192.168.99.9]

TASK: [geerlingguy.composer | Ensure curl is installed (Debian).] ************* 
skipping: [192.168.99.9]

TASK: [geerlingguy.composer | Install Composer into the current directory.] *** 
ok: [192.168.99.9]

TASK: [geerlingguy.composer | Move Composer into globally-accessible location.] *** 
ok: [192.168.99.9]

TASK: [geerlingguy.composer | Update Composer to latest version (if configured).] *** 
skipping: [192.168.99.9]

TASK: [geerlingguy.sonar-runner | Download sonar-runner.] ********************* 
ok: [192.168.99.9]

TASK: [geerlingguy.sonar-runner | Unzip sonar-runner.] ************************ 
ok: [192.168.99.9]

TASK: [geerlingguy.sonar-runner | Move sonar-runner into place.] ************** 
ok: [192.168.99.9]

TASK: [geerlingguy.sonar-runner | Copy sonar-runner properties into place.] *** 
ok: [192.168.99.9]

TASK: [geerlingguy.sonar-runner | Configure sonar-runner bash settings by copying script into profile.d.] *** 
ok: [192.168.99.9]

TASK: [geerlingguy.mysql | Include OS-specific variables.] ******************** 
ok: [192.168.99.9]

TASK: [geerlingguy.mysql | Define mysql_packages.] **************************** 
ok: [192.168.99.9]

TASK: [geerlingguy.mysql | Update postfix to the latest version (if extra repositories enabled).] *** 
skipping: [192.168.99.9]

TASK: [geerlingguy.mysql | Ensure MySQL packages are installed.] ************** 
ok: [192.168.99.9] => (item=mysql,mysql-server,MySQL-python)

TASK: [geerlingguy.mysql | Check if MySQL is already installed.] ************** 
skipping: [192.168.99.9]

TASK: [geerlingguy.mysql | Update apt cache if MySQL is not yet installed.] *** 
skipping: [192.168.99.9]

TASK: [geerlingguy.mysql | Ensure MySQL packages are installed.] ************** 
skipping: [192.168.99.9]

TASK: [geerlingguy.mysql | Ensure MySQL is stopped after initial install.] **** 
skipping: [192.168.99.9]

TASK: [geerlingguy.mysql | Delete innodb log files created by apt package after initial install.] *** 
skipping: [192.168.99.9]

TASK: [geerlingguy.mysql | Copy my.cnf global MySQL configuration.] *********** 
ok: [192.168.99.9]

TASK: [geerlingguy.mysql | Create slow query log file (if configured).] ******* 
skipping: [192.168.99.9]

TASK: [geerlingguy.mysql | Set ownership on slow query log file (if configured).] *** 
skipping: [192.168.99.9]

TASK: [geerlingguy.mysql | Ensure MySQL is started and enabled on boot.] ****** 
ok: [192.168.99.9]

TASK: [geerlingguy.mysql | Get list of hosts for the root user.] ************** 
ok: [192.168.99.9]

TASK: [geerlingguy.mysql | Update MySQL root password for localhost root account.] *** 
ok: [192.168.99.9] => (item=drupalci)
ok: [192.168.99.9] => (item=127.0.0.1)
ok: [192.168.99.9] => (item=localhost)

TASK: [geerlingguy.mysql | Copy .my.cnf file with root password credentials.] *** 
ok: [192.168.99.9]

TASK: [geerlingguy.mysql | Get list of hosts for the anonymous user.] ********* 
ok: [192.168.99.9]

TASK: [geerlingguy.mysql | Remove anonymous MySQL users.] ********************* 
skipping: [192.168.99.9]

TASK: [geerlingguy.mysql | Remove MySQL test database.] *********************** 
ok: [192.168.99.9]

TASK: [geerlingguy.mysql | Ensure MySQL databases are present.] *************** 
skipping: [192.168.99.9]

TASK: [geerlingguy.mysql | Ensure MySQL users are present.] ******************* 
skipping: [192.168.99.9]

TASK: [geerlingguy.mysql | Ensure replication user exists on master.] ********* 
skipping: [192.168.99.9]

TASK: [geerlingguy.mysql | Check slave replication status.] ******************* 
skipping: [192.168.99.9]

TASK: [geerlingguy.mysql | Check master replication status.] ****************** 
skipping: [192.168.99.9]

TASK: [geerlingguy.mysql | Configure replication on the slave.] *************** 
skipping: [192.168.99.9]

TASK: [geerlingguy.mysql | Start replication.] ******************************** 
skipping: [192.168.99.9]

TASK: [geerlingguy.sonar | Create a database for Sonar.] ********************** 
ok: [192.168.99.9]

TASK: [geerlingguy.sonar | Create a sonar user.] ****************************** 
ok: [192.168.99.9] => (item=localhost)
ok: [192.168.99.9] => (item=127.0.0.1)
ok: [192.168.99.9] => (item=::1)
ok: [192.168.99.9] => (item=localhost)

TASK: [geerlingguy.sonar | Download Sonar.] *********************************** 
ok: [192.168.99.9]

TASK: [geerlingguy.sonar | Unzip Sonar.] ************************************** 
ok: [192.168.99.9]

TASK: [geerlingguy.sonar | Move Sonar into place.] **************************** 
ok: [192.168.99.9]

TASK: [geerlingguy.sonar | Copy sonar properties file.] *********************** 
ok: [192.168.99.9]

TASK: [geerlingguy.sonar | Add sonar symlinks for service management.] ******** 
ok: [192.168.99.9] => (item=/usr/bin/sonar)
ok: [192.168.99.9] => (item=/etc/init.d/sonar)

TASK: [geerlingguy.sonar | Ensure Sonar is running and set to start on boot.] *** 
ok: [192.168.99.9]

TASK: [Install dependencies via Composer.] ************************************ 
changed: [192.168.99.9] => (item=pdepend/pdepend=~1.1)
changed: [192.168.99.9] => (item=phpunit/phpunit=3.7.32)
changed: [192.168.99.9] => (item=phpmd/phpmd=1.5.0)
changed: [192.168.99.9] => (item=sebastian/phpcpd=2.0.0)
changed: [192.168.99.9] => (item=squizlabs/php_codesniffer=1.5.3)
changed: [192.168.99.9] => (item=phing/phing=2.7.0)

TASK: [Symlink binaries so Jenkins and Sonar Runner can see them easily.] ***** 
ok: [192.168.99.9] => (item=pdepend)
ok: [192.168.99.9] => (item=phing)
ok: [192.168.99.9] => (item=phpcpd)
ok: [192.168.99.9] => (item=phpcs)
ok: [192.168.99.9] => (item=phpmd)
ok: [192.168.99.9] => (item=phpunit)

TASK: [Change ownership of entire Jenkins .composer directory.] *************** 
ok: [192.168.99.9]

TASK: [Download Drupal Coder module.] ***************************************** 
ok: [192.168.99.9]

TASK: [Expand Coder module archive.] ****************************************** 
ok: [192.168.99.9]

TASK: [Move Drupal standards into CodeSniffer directory.] ********************* 
ok: [192.168.99.9]

TASK: [Ensure Drupal Sonar config directory exists.] ************************** 
ok: [192.168.99.9]

TASK: [Copy Drupal Sonar properties files into place.] ************************ 
ok: [192.168.99.9] => (item=6)
ok: [192.168.99.9] => (item=7)
ok: [192.168.99.9] => (item=8)

TASK: [Check if Sonar Jenkins configuration file already exists.] ************* 
ok: [192.168.99.9]

TASK: [Copy Sonar Jenkins configuration to server.] *************************** 
skipping: [192.168.99.9] => (item={'dest': '/var/lib/jenkins/hudson.plugins.sonar.SonarPublisher.xml', 'src': 'jenkins/hudson.plugins.sonar.SonarPublisher.xml.j2'})
skipping: [192.168.99.9] => (item={'dest': '/var/lib/jenkins/hudson.plugins.sonar.SonarRunnerInstallation.xml', 'src': 'jenkins/hudson.plugins.sonar.SonarRunnerInstallation.xml.j2'})

TASK: [Copy in the Drupal Jenkins job templates.] ***************************** 
ok: [192.168.99.9] => (item=6)
ok: [192.168.99.9] => (item=7)
ok: [192.168.99.9] => (item=8)

TASK: [Import the Jenkins jobs.] ********************************************** 
skipping: [192.168.99.9] => (item=6)
skipping: [192.168.99.9] => (item=7)
skipping: [192.168.99.9] => (item=8)

TASK: [Ensure Drupal Jenkins phing config directory exists.] ****************** 
ok: [192.168.99.9]

TASK: [Copy Drupal Jenkins phing files into place.] *************************** 
ok: [192.168.99.9] => (item=6)
ok: [192.168.99.9] => (item=7)
ok: [192.168.99.9] => (item=8)

TASK: [Install Sonar PHP plugin.] ********************************************* 
ok: [192.168.99.9]

TASK: [Wait for Sonar to start.] ********************************************** 
ok: [192.168.99.9]

TASK: [Check if Sonar's database is already configured correctly.] ************ 
ok: [192.168.99.9]

TASK: [Wait for Sonar to start (again).] ************************************** 
skipping: [192.168.99.9]

TASK: [Copy Sonar database provisioning scripts to temp directory.] *********** 
skipping: [192.168.99.9] => (item=sonar-php-custom-rules.sql)
skipping: [192.168.99.9] => (item=sonar-php-profile-setup.sql)

TASK: [Set up Sonar MySQL database.] ****************************************** 
skipping: [192.168.99.9]

TASK: [Restart Sonar to pick up new rules.] *********************************** 
skipping: [192.168.99.9]

TASK: [Wait for Sonar to start (again).] ************************************** 
skipping: [192.168.99.9]

TASK: [Set up Sonar MySQL database (again).] ********************************** 
skipping: [192.168.99.9]

TASK: [Ensure Apache is not running.] ***************************************** 
ok: [192.168.99.9]

PLAY RECAP ******************************************************************** 
192.168.99.9               : ok=100  changed=2    unreachable=0    failed=0  

To the untrained eye... nothing obviously wrong.

Any ideas?

richardtape commented 9 years ago

Why and how is this always the way. The second I post an issue, I spot what is wrong.

The automatically added line to my hosts file wasn't correct.

It added

192.168.99.9 drupalci

i.e. without the .dev

Doh!

If I add the correct line, it works.

geerlingguy commented 9 years ago

@richardtape - ha, perfect! Glad you could get it fixed. Do you have the vagrant-hostsupdater plugin installed? Otherwise, the README has the correct instructions if you're manually editing your hosts file.

richardtape commented 9 years ago

Yeah I have it installed. That's how my hosts file got automatically updated. It's just the line that it adds is incorrect. I think the line that needs to be changed is

https://github.com/geerlingguy/drupalci-sonar-jenkins/blob/master/Vagrantfile#L17

I'll happily make a PR if that's the line that needs to switch.

geerlingguy commented 9 years ago

Can you test that change (remove the line from hosts file, update line 17, run vagrant up or vagrant halt then vagrant up again, then see if it adds the right hosts entry? Thanks for helping with this! I'll happily merge a PR if it fixes it for the hostsupdater plugin.

richardtape commented 9 years ago

OK done. The change does fix it. Have made a PR.