Skip to content

Instantly share code, notes, and snippets.

@ethicka
Last active May 4, 2020 07:24
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ethicka/3cac46cedfedd30070f3ec8698290f45 to your computer and use it in GitHub Desktop.
Save ethicka/3cac46cedfedd30070f3ec8698290f45 to your computer and use it in GitHub Desktop.
How to build and deploy a Roots / Sage 9 WordPress theme on Deploybot

Deploying Roots Sage 9 via Deploybot

Sage 9 is the latest and greatest from Roots, but the build process is much more complicated than Sage 8 (i.e. gulp --production and profit). The following took me quite a bit of time to figure out, but is probably not comprehensive. Please comment if you need clarity. I hope it saves you some time!

Build the Container

Deploybot allows you to create your own containers. Go to Settings > Containers > Create a container. Based off the Ubuntu 16.04 container add the following build commands and save as Sage 9:

# Update PHP
add-apt-repository ppa:ondrej/php
apt-get update
apt-get  install -y php7.1 php7.1-common php7.1-mbstring php7.1-xml gcc g++ make nodejs
a2enmod php7.1
# Install Composer
apt-get install -y composer
composer install
# Update npm
npm install npm@latest -g
# Install Yarn + Composer
npm install --global yarn webpack

Configure the Server

Now go to the server settings for your deployment. The following are the settings for each section that needs to configured.

1. Compile, compress, or minimize your code

  • Select Sage 9 from the dropdown for your container.
  • Add the following command: yarn build:production

2. Run shell commands before deployment

  • You need to make sure composer is installed on your server – Sage 9 depends on it. In Debian/Ubuntu you can run apt-get install composer to install.
  • Add the following command: composer install

3. Exclude certain paths from being uploaded

.cache-loader
.git
node_modules
composer.lock
yarn.lock
composer.json
package-lock.json
package.json
LICENSE.md
.eslintrc.js
phpcs.xml
.editorconfig
.gitignore

4. Advanced options

In Cached build commands add the following command: yarn

Save the changes and deploy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment