apigee / devportal-kickstart-drupal-ansible-installer

Ansible playbook for installing Apigee Kickstart developer portal for Drupal.
Apache License 2.0
5 stars 6 forks source link

Ansible installation failed on Centos7 in GCP #6

Closed gfrankliu closed 3 years ago

gfrankliu commented 4 years ago

Description

Ansible installation failed on Centos7 in GCP with below errors:

TASK [geerlingguy.drupal : Run composer install if composer.json is present.] ***
fatal: [web1]: FAILED! => {"changed": false, "msg": "Failed loading opcache.so: opcache.so: cannot open shared object file: No such file or directory Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages. Problem 1 - This package requires php ^7.2 but your PHP version (5.4.16) does not satisfy that requirement. Problem 2 - drupal/apigee_m10n 1.6.0 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement. - drupal/apigee_m10n 1.5.0 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement. - drupal/apigee_m10n 1.4.0 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement. - drupal/apigee_m10n 1.3.0 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement. - drupal/apigee_m10n 1.2.0 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement. - drupal/apigee_m10n 1.1.0 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement. - drupal/apigee_m10n 1.0.0 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement. - drupal/apigee_m10n 1.0.0-rc2 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement. - drupal/apigee_m10n 1.0.0-rc1 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement. - drupal/apigee_m10n 1.0.0-beta3 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement. - drupal/apigee_m10n 1.0.0-beta1 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement. - drupal/apigee_m10n 1.0.0-alpha3 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement. - drupal/apigee_m10n 1.0.0-alpha2 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement. - drupal/apigee_m10n 1.0.0-alpha1 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement. - drupal/apigee_m10n 1.x-dev requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement. - Installation request for drupal/apigee_m10n ^1.0.0 -> satisfiable by drupal/apigee_m10n[1.x-dev, 1.0.0-alpha1, 1.0.0-alpha2, 1.0.0-alpha3, 1.0.0-beta1, 1.0.0-beta3, 1.0.0-rc1, 1.0.0-rc2, 1.0.0, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.5.0, 1.6.0]. Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.", "stdout": "Failed loading opcache.so:  opcache.so: cannot open shared object file: No such file or directory\nLoading composer repositories with package information\nUpdating dependencies\nYour requirements could not be resolved to an installable set of packages.\n\n  Problem 1\n    - This package requires php ^7.2 but your PHP version (5.4.16) does not satisfy that requirement.\n  Problem 2\n    - drupal/apigee_m10n 1.6.0 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.\n    - drupal/apigee_m10n 1.5.0 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.\n    - drupal/apigee_m10n 1.4.0 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.\n    - drupal/apigee_m10n 1.3.0 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.\n    - drupal/apigee_m10n 1.2.0 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.\n    - drupal/apigee_m10n 1.1.0 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.\n    - drupal/apigee_m10n 1.0.0 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.\n    - drupal/apigee_m10n 1.0.0-rc2 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.\n    - drupal/apigee_m10n 1.0.0-rc1 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.\n    - drupal/apigee_m10n 1.0.0-beta3 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.\n    - drupal/apigee_m10n 1.0.0-beta1 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.\n    - drupal/apigee_m10n 1.0.0-alpha3 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.\n    - drupal/apigee_m10n 1.0.0-alpha2 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.\n    - drupal/apigee_m10n 1.0.0-alpha1 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.\n    - drupal/apigee_m10n 1.x-dev requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.\n    - Installation request for drupal/apigee_m10n ^1.0.0 -> satisfiable by drupal/apigee_m10n[1.x-dev, 1.0.0-alpha1, 1.0.0-alpha2, 1.0.0-alpha3, 1.0.0-beta1, 1.0.0-beta3, 1.0.0-rc1, 1.0.0-rc2, 1.0.0, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.5.0, 1.6.0].\n\nRunning update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.\n", "stdout_lines": ["Failed loading opcache.so:  opcache.so: cannot open shared object file: No such file or directory", "Loading composer repositories with package information", "Updating dependencies", "Your requirements could not be resolved to an installable set of packages.", "", "  Problem 1", "    - This package requires php ^7.2 but your PHP version (5.4.16) does not satisfy that requirement.", "  Problem 2", "    - drupal/apigee_m10n 1.6.0 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.", "    - drupal/apigee_m10n 1.5.0 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.", "    - drupal/apigee_m10n 1.4.0 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.", "    - drupal/apigee_m10n 1.3.0 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.", "    - drupal/apigee_m10n 1.2.0 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.", "    - drupal/apigee_m10n 1.1.0 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.", "    - drupal/apigee_m10n 1.0.0 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.", "    - drupal/apigee_m10n 1.0.0-rc2 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.", "    - drupal/apigee_m10n 1.0.0-rc1 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.", "    - drupal/apigee_m10n 1.0.0-beta3 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.", "    - drupal/apigee_m10n 1.0.0-beta1 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.", "    - drupal/apigee_m10n 1.0.0-alpha3 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.", "    - drupal/apigee_m10n 1.0.0-alpha2 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.", "    - drupal/apigee_m10n 1.0.0-alpha1 requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.", "    - drupal/apigee_m10n 1.x-dev requires php >=7.1 -> your PHP version (5.4.16) does not satisfy that requirement.", "    - Installation request for drupal/apigee_m10n ^1.0.0 -> satisfiable by drupal/apigee_m10n[1.x-dev, 1.0.0-alpha1, 1.0.0-alpha2, 1.0.0-alpha3, 1.0.0-beta1, 1.0.0-beta3, 1.0.0-rc1, 1.0.0-rc2, 1.0.0, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.5.0, 1.6.0].", "", "Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems."]}
 
PLAY RECAP *********************************************************************
db1                        : ok=30   changed=1    unreachable=0    failed=0    skipped=20   rescued=0    ignored=0   
web1                       : ok=48   changed=2    unreachable=0    failed=1    skipped=46   rescued=0    ignored=0

Steps to Reproduce

Steps to reproduce the behavior:

  1. Launch a standard centos 7 in GCP, no customizations
  2. cloned git repo on my local Macbook
  3. Follow the README, and towards the end, ansible throws those errors.
cnovak commented 4 years ago

@giteshk did you say you saw this same issue in Google Cloud due to the PHP RPMs being out of date?

giteshk commented 4 years ago

@cnovak I created a pull request for this https://github.com/apigee/devportal-kickstart-drupal-ansible-installer/pull/7

@gfrankliu can you try this out ?

gfrankliu commented 4 years ago

With @cnovak's suggestion, I have switched to centos 8 (which comes with php 7.2 by default, unlike centos 7 that comes with php5 by default). The ansible went much further, but failed with

TASK [Add NGINX configuration file for Devportal] ******************************
fatal: [web1]: FAILED! => {"changed": false, "checksum": "bdc143856efd2008730215b3d47bed3a517d9355", "msg": "Destination /etc/nginx/conf.d not writable"}

The "devportal" user has the sudo permission, but it seems for this particular job, it didn't use sudo.

Then I switched to use root user for ansible, and completed installation. Browsing the final website with nginx error 502 Bad Gateway. Disabling selinux fixed that error. Since selinux came by default enabled, if you don't support it, shouldn't ansible disable it?

giteshk commented 4 years ago

@gfrankliu I do believe that we should hardcode the php version to 7.3 Php 7.2 will end of life in the beginning of 2021. https://www.php.net/supported-versions.php I did see a whole bunch of errors because with the user permission too. But didn't get too far with testing the user.

We probably should disable selinux to accept traffic

gfrankliu commented 4 years ago

Though upstream (php.net) announced EOL, the old php5 from centos 7 and php7.2 from centos 8 are still supported by the vendor (Redhat) until that centos version is EOL.

As for user permissions, are you suggesting we should document it to install using root user, since we haven't tested non-root user?

As for selinux, we should either document it in README, or make ansible do the check and disable as needed.

gfrankliu commented 4 years ago

Here are my steps:

yum install -y epel-release yum install -y ansible git mkdir src cd src git clone https://github.com/apigee/devportal-kickstart-drupal-ansible-installer.git cd devportal-kickstart-drupal-ansible-installer cp test/hosts.yml . ansible-galaxy install -r requirements.yml ansible-playbook playbook.yml



- now devportal is available on http/80
gfrankliu commented 4 years ago

I also tried on GCP Debian 10 successfully. Here are the steps:

brentchang commented 3 years ago

Hi, I also tried the steps on CentOS 8 in GCP:

gcloud compute instances create devportal-test \
 --project aaa \
 --zone bbb \
 --subnet ccc \
 --network ddd \
 --tags=eee \
 --machine-type e2-standard-2 \
 --image-family centos-8 \
 --image-project centos-cloud \
 --boot-disk-size 50GB

install devportal

# SSH into the new instance launched above
#
sudo su -
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' \
   /etc/selinux/config

yum install -y epel-release
yum install -y ansible git
mkdir src
cd src
git clone https://github.com/apigee/devportal-kickstart-drupal-ansible-installer.git
cd devportal-kickstart-drupal-ansible-installer
cp test/hosts.yml .
ansible-galaxy install -r requirements.yml
ansible-playbook playbook.yml

However, the ansible-playbook playbook.yml failed with the following error messages:

TASK [geerlingguy.drupal : Run composer install if composer.json is present.] ***************
fatal: [localhost]: FAILED! => {
    "changed": false,
    "msg": "No lock file found. Updating dependencies instead of installing from lock file. Use composer update over composer install if you do not have a lock file. Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages. Problem 1 - drupal/core-dev[8.8.0-beta1, ..., 8.9.x-dev] require jcalderonzumba/mink-phantomjs-driver ^0.3.1 -> found jcalderonzumba/mink-phantomjs-driver[dev-master, 0.4.x-dev (alias of dev-master)] but it does not match the constraint. - drupal/core-vendor-hardening 8.8.0-alpha1 requires composer-plugin-api ^1.1 -> found composer-plugin-api[2.0.0] but it does not match the constraint. - drupal/core-dev 8.8.0-alpha1 requires drupal/core-vendor-hardening 8.8.0-alpha1 -> satisfiable by drupal/core-vendor-hardening[8.8.0-alpha1]. - Root composer.json requires drupal/core-dev ^8.8 -> satisfiable by drupal/core-dev[8.8.0-alpha1, ..., 8.9.x-dev]. You are using Composer 2, which some of your plugins seem to be incompatible with. Make sure you update your plugins or report a plugin-issue to ask them to support Composer 2. Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.",
    "stdout": "No lock file found. Updating dependencies instead of installing from lock file. Use composer update over composer install if you do not have a lock file.\nLoading composer repositories with package information\nUpdating dependencies\nYour requirements could not be resolved to an installable set of packages.\n\n  Problem 1\n    - drupal/core-dev[8.8.0-beta1, ..., 8.9.x-dev] require jcalderonzumba/mink-phantomjs-driver ^0.3.1 -> found jcalderonzumba/mink-phantomjs-driver[dev-master, 0.4.x-dev (alias of dev-master)] but it does not match the constraint.\n    - drupal/core-vendor-hardening 8.8.0-alpha1 requires composer-plugin-api ^1.1 -> found composer-plugin-api[2.0.0] but it does not match the constraint.\n    - drupal/core-dev 8.8.0-alpha1 requires drupal/core-vendor-hardening 8.8.0-alpha1 -> satisfiable by drupal/core-vendor-hardening[8.8.0-alpha1].\n    - Root composer.json requires drupal/core-dev ^8.8 -> satisfiable by drupal/core-dev[8.8.0-alpha1, ..., 8.9.x-dev].\n\nYou are using Composer 2, which some of your plugins seem to be incompatible with. Make sure you update your plugins or report a plugin-issue to ask them to support Composer 2.\nRunning update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.\n",
    "stdout_lines": [
        "No lock file found. Updating dependencies instead of installing from lock file. Use composer update over composer install if you do not have a lock file.",
        "Loading composer repositories with package information",
        "Updating dependencies",
        "Your requirements could not be resolved to an installable set of packages.",
        "",
        "  Problem 1",
        "    - drupal/core-dev[8.8.0-beta1, ..., 8.9.x-dev] require jcalderonzumba/mink-phantomjs-driver ^0.3.1 -> found jcalderonzumba/mink-phantomjs-driver[dev-master, 0.4.x-dev (alias of dev-master)] but it does not match the constraint.",
        "    - drupal/core-vendor-hardening 8.8.0-alpha1 requires composer-plugin-api ^1.1 -> found composer-plugin-api[2.0.0] but it does not match the constraint.",
        "    - drupal/core-dev 8.8.0-alpha1 requires drupal/core-vendor-hardening 8.8.0-alpha1 -> satisfiable by drupal/core-vendor-hardening[8.8.0-alpha1].",
        "    - Root composer.json requires drupal/core-dev ^8.8 -> satisfiable by drupal/core-dev[8.8.0-alpha1, ..., 8.9.x-dev].",
        "",
        "You are using Composer 2, which some of your plugins seem to be incompatible with. Make sure you update your plugins or report a plugin-issue to ask them to support Composer 2.",
        "Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems."
    ]
}
gfrankliu commented 3 years ago

The error message you posted above clearly stated:

You are using Composer 2, which some of your plugins seem to be incompatible with.

composer v2 was released between my post and your test. That's why you encountered the error but I didn't.

You can switch back to composer v1 and the error should go away. eg: you can append composer_version: 1.10.13 to the file group_vars/webservers.yml to force using composer version 1.10.13 , BEFORE you run the ansible-playbook

brentchang commented 3 years ago

Hi @gfrankliu, I tried your suggestion with composer_version: 1.10.13, it just works!

Thank you for your great solution!

cnovak commented 3 years ago

+1 for the help answering @gfrankliu , I will close this ticket.