Error deploying

@jdaquila Great job!!!

Just a side note that I suspect may clarify some things:

  • dev: dev.yml will provision your vm and install WordPress
  • stag/prod: server.yml provisions server generally, deploy.yml deploys specific website.

The point I want to make is that it is very unlikely you would use either server.yml or deploy.yml for dev, as I think you may have tried at one point.


Some resources – some you have seen already:
Sage README, Docs, book, screencast
Bedrock README, Docs, screencast
Trellis README, Docs, blog post about deploying

Search discourse and google for your questions, error messages, etc. Most of the getting started issues have been covered. Searching may feel painstaking and slow, but you’ll actually be learning a lot in the process, even when it feels like you aren’t finding the specific answer you’re seeking. You’ve proven you can find the answers and figure things out, but if/when you’ve searched long and hard and are truly stuck, you’ll be able to describe the steps you’ve taken etc. and the discourse community will be more eager to help.


Below is a sparse overview of one possible process for using the Roots tools to build a WordPress site as a solo developer. I’m listing it to offer the general concepts. Any specifics are for you to work out using the resources listed above.

Dev

  • vagrant up to create vm
  • develop theme using vagrant vm (edit php, css, js, etc.)
  • run gulp [--production] to compile assets whenever desired. Assuming this vm is on your local machine, the synced folders will update the dev site in real time.

Staging or Production

  • commit the edits you’ve made to sage/bedrock/trellis to your remote repo so that when you have Trellis run deploy.yml, it can checkout/clone those updated source files from the remote repo.
  • because you’re on Windows, run gulp --production on your local machine instead of relying on Trellis to do it for you during deploy.yml
  • run server.yml to provision a remote server
  • set up Trellis to sync your compiled assets to your server using the example build-before.yml file (see notes below; see docs about deploy hooks).
  • run deploy.yml to deploy your site

Keep iterating

  • on dev vm, continue editing as desired and run gulp to compile
  • commit changes to remote repo as desired
  • use deploy.yml to have Trellis deploy your remote repo’s changes to your site/server and to sync your compiled assets (dist) to your site/server. You don’t need to re-run server.yml if you’ve only changed your site/theme files.
  • on the rare occasion you need to update the config to your server (perhaps to update to latest Trellis configs), run server.yml

Using build-before.yml as a Windows user, you’ll probably want to run npm, bower, and gulp commands manually on your Windows machine (vs. having Trellis run these commands). Then you can have Trellis sync to your server the compiled assets (stuff gulp builds into your sage dist folder).

To achieve this sync, you’ll probably want to uncomment and use the single task below, making the one change for Trellis to know where to find the files on your vm.

 - name: Copy project local files
   synchronize:
-    src: "{{ project.local_path }}/web/app/themes/sage/dist"
+    src: "{{ project_root }}/current/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

Keep an eye on ansible_local coming soon to Trellis, which should simplify some of your steps on Windows.

1 Like