Trellis Deployed WP creates admin user with limited rights?

Hi everyone, I’ve just successfully deployed Trellis + Bedrock + Sage 9 (Awesome!) to a new DO instance. After the install I was presented with a WP install screen which created a new admin user. So far so good. Now when I access WP with this newly created user, it seems its powers are limited. For example I can’t see the “Update WP” screen or “Install Plugin” screens which seem to be disabled.

Is this to be expected? If that’s the case, how should I update to WordPress 4.8.1 ?

Thanks,
Kris

1 Like

Updating WP/plugins is disabled in a Trellis/Bedrock stack, since those things are meant to be managed through Composer. If you update them from within WordPress, your composer.json would fall out of sync.

To update WP, edit site/composer.json and change the version for your WordPress dependency to the WP version you want, then run composer update, commit changes, push, and reprovision/deploy (can’t remember which).

3 Likes

Just to add, it would just be a deploy needed after committing the updates :+1:t2:

1 Like

Thanks! After deploying do we need to manually yarn run build in the deployment server (and thus manually install node, webpack, etc) ?

Best,
Kris

Nope :slight_smile:

You just have your deploy-hooks/build_before.yml script in Trellis that takes care of that. For Sage 9, that would look like:

- name: Run yarn install
  command: yarn install
  connection: local
  args:
    chdir: "{{ project_local_path }}/web/app/themes/sage"

- name: Install Composer dependencies
  command: composer install --no-ansi --no-dev --no-interaction --no-progress --optimize-autoloader --no-scripts
  args:
    chdir: "{{ deploy_helper.new_release_path }}/web/app/themes/sage"

- name: Compile assets for production
  command: yarn run build:production
  connection: local
  args:
    chdir: "{{ project_local_path }}/web/app/themes/sage"

- name: Copy project local files
  synchronize:
    src: "{{ project_local_path }}/web/app/themes/sage/dist"
    dest: "{{ deploy_helper.new_release_path }}/web/app/themes/sage"
    group: no
    owner: no
    rsync_opts: --chmod=Du=rwx,--chmod=Dg=rx,--chmod=Do=rx,--chmod=Fu=rw,--chmod=Fg=r,--chmod=Fo=r

You can see the original file from the Trellis repo here: https://github.com/roots/trellis/blob/master/deploy-hooks/build-before.yml. You’ll notice this is commented out by default, so you need to go and uncomment that.

When you deploy, Trellis will take care of updating any composer dependencies, which will ensure parity from dev to staging/live, it’ll pull your latest git commit and build everything out via the commands in the above build_before.yml file.

2 Likes

Awesome! Thanks, I will try this out.