Can deploy to production, but not staging

git should be installed during provision - https://github.com/roots/trellis/blob/49cf5de36c7bfb0661a922288da898228cc526e9/roles/common/defaults/main.yml#L27


Change https://github.com/roots/trellis/blob/49cf5de36c7bfb0661a922288da898228cc526e9/roles/deploy/tasks/update.yml:

  - name: Clone project files
    git:
      repo: "{{ project_git_repo }}"
      dest: "{{ project_source_path }}"
      version: "{{ project_version }}"
      accept_hostkey: "{{ project.repo_accept_hostkey | default(repo_accept_hostkey | default(true)) }}"
      force: yes
-   ignore_errors: true
-   no_log: true
+   ignore_errors: false
+   no_log: false
    register: git_clone

Then, re-deploy with $ ansible-playbook deploy.yml -e "site=MYSITE.com env=staging" -vvv , you will get a better error.

Here it is:

wordpress_sites:
  SITENAME.com:
    site_hosts:
      - canonical: staging.SITENAME.com
    local_path: ../site # path targeting local Bedrock site directory (relative to Ansible root)
    repo: git@github.com:SITENAME/SITENAME.com-wordpress.git # replace with your Git repo URL
    repo_subtree_path: site # relative path to your Bedrock/WP directory in your repo
    branch: staging
    multisite:
      enabled: false
    ssl:
      enabled: true
      provider: letsencrypt
      hsts_include_subdomains: false
    cache:
      enabled: false
    htpasswd:
     - name: SITENAME
       password: staging

After updating that file I get this:

TASK [deploy : Clone project files] **********************************************************************************************************************************************************************************************************************
System info:
Ansible 2.5.3; Darwin
Trellis version (per changelog): "Update xdebug tunnel configuration"
---------------------------------------------------
Local modifications exist in repository (force=no).
fatal: [staging.SITENAME.com]: FAILED! => {"before": "b0af714b56ce0f0b39ef303b653d18dbc04ad2c5", "changed": false}

Does that help determine the issue at all?

Updating force, per this link, looks like it corrected my issues:

- name: Clone project files
  git:
    repo: "{{ project_git_repo }}"
    dest: "{{ project_source_path }}"
    version: "{{ project_version }}"
    accept_hostkey: "{{ project.repo_accept_hostkey | default(repo_accept_hostkey | default(true)) }}"
    force: yes
  ignore_errors: false
  no_log: false
  register: git_clone

I was able to deploy to staging. I have since removed the force option, and can still deploy!

Thank you all for the help in pointing me in the right direction!

For those who coming here from google, the reason is that /srv/www/XXXX/shared/source being modified manually (which you should never do!)

To make deploy works again:

Option 1: Set force: true to discard local changes caught by git
Option 2: Delete /srv/www/XXXX/shared/source
Option 3 (best): Update Trellis, specifically this pull request - https://github.com/roots/trellis/pull/999

No matter which option you go for, don’t forget reverting to no_log: true as logging sometimes prints out git credentials.

Rule of thumb: If you are changing remote server source code manually, you probably doing it wrong.

1 Like

Completely agree. I think panic mode crept in when we had an issue with the site, then at the same time deployments w/staging occurred. Sometimes it’s better to take a step back. #LessonLearned.

Thanks again all!

1 Like

This topic was automatically closed after 42 days. New replies are no longer allowed.