Installing Roots with Sage 9

In this document, we’re going to cover creating a Roots WordPress project using best practices. We’re using the full Roots stack including Trellis, Bedrock, and Sage 9.

  1. If you already have your SSH key added to DigitalOcean, skip to step 4.
  2. If you already have an SSH key, but it’s not connected to your DigitalOcean, you only need to do steps 3.5-7.
  3. If you don’t have an SSH key yet in your command line, go to your root directory and create a new SSH key:
    1. To create RSA key pair- run: ssh-keygen -t rsa
    2. Create file path run: /Users/[username]/.ssh/[key-name]
    3. When it says “Enter passphrase:”, leave it blank and press enter. (Because Ansible likes to have no passphrase for deploys)
    4. Enter same passphrase again: (leave blank again, and press enter)
    5. Catenate the public key run: cat /Users/[username]/.ssh/[key-name].pub
    6. When you hit enter, it will show you your public key
    7. Select,and copy the public key [cmd+c]
  4. Signup/Login to your Digital Ocean account:
    1. Add a new droplet
    2. Select pricing plan (I recommend $5/m for most setups)
    3. Select the Region closest to you (or your target market)
    4. Select a Ubuntu default image.
    5. If you already have your SSH key added, just select it.
    6. If you just created or copied a new SSH key in Steps 2 or 3, click Add\’a0SSH Key and paste the public key. (Note: I like to name it by [key-name] and then specify which machine it exists on, like “MasonMBP”.)
    7. Add a hostname (I usually version mine 1.0. 1.1, etc)
    8. Create the droplet\’96 after about a minute your droplet will be spun up.
    9. Copy the IP address from droplet.
  5. Back in Terminal:
    1. Catchall command\’96 run: sudo nano ~/.ssh/config (enter password)
    2. Grab\’a0the IP address\’a0from your Digital Ocean droplet:’a0Screen Shot 2015-07-15 at 12.51.31 PM
    3. Inside of the config file, type\’a0this in (note that my [key-name] is id_rsa:’a0Screen Shot 2017-04-09 at 8.02.18 PM
    4. Exit out, now let’s test our SSH connection from the web user, run: ssh root@[hostname]
    5. If it asks you if you’re sure, type: yes
    6. Now you should be connected to your server via SSH
    7. You can exit your SSH server by hitting ctrl + d
    8. Troubleshooting: If you can’t connect via SSH by running: `ssh web@host` then your public key probably isn’t in ~/.ssh/authorized_keys. You can put it in by running: sudo nano ~/.ssh/authorized_keys, and manually pasting it
  6. Install Trellis:
    1. From your systems root directory, make sure you have all the\’a0requirements‘a0installed on your machine\
      1. Ansible: easiest to install it via Python. (check v. with ansible --version)
      2. VirtualBox install\’a0is pretty straight forward. (check v. with virtualbox -v)
      3. Vagrant install is just as straight forward. (check v. with vagrant -v)
      4. Vagrant-bindfs is distributed as a Ruby gem. You can install it as any other Vagrant plugin with\’a0vagrant plugin install vagrant-bindfs (check v. with vagrant-bindfs -v)
      5. Go to where you want your site to live, and create a new project folder.\’a0Name it the name of your project\’96 run: cd ~/sites && mkdir example-project && cd example-project
      6. Clone Trellis and remove .git folder, run:
        git clone --depth=1 && rm -rf trellis/.git && cd trellisInstall Trellis:
      7. To install the Vagrant host-manager run: vagrant plugin install vagrant-hostmanager
      8. To install the Vagrant host-manager run: vagrant plugin install vagrant-hostmanager
  7. Install Bedrock: Back out to your project root folder, clone Bedrock and remove .git folder, run:’a0cd .. && git clone --depth=1 site && rm -rf site/.git
  8. Install Sage:
    1. Install all of Sage’s requirements.
    2. Use Composer to install Sage-9, run: cd site/web/app/themes && composer create-project roots/sage sage dev-master(‘sage’ is interchangeable with whatever you choose to name the theme, but keep in mind that it could mess things up. I usually prefer to keep it just ‘sage’.)
    3. Your file hierarchy should look like this.
    4. Add Soil, run: cd .. &&\'a0cd .. &&\'a0cd .. &&\'a0composer require roots/soil 3.7.1
      • You might want to check for the latest version here.
    5. *If the command isn’t found, you’ll need to install composer globally first.
    6. Configure Sage, at least run:
      1. cd web/app/themes/sage &&\'a0yarn
  9. Commit and publish the entire project on Github
  10. Development:
    1. Setup Local Development Environment:
    2. Tip: You can open your project from the Github app by right clicking it, and selecting Open in Atom
      1. Configure\’a0trellis/group_vars/development/wordpress_sites.yml
      2. Cofigure\’a0trellis/group_vars/development/vault.yml like
      3. Note: I added my github username to all/vault.yml and uncommented it.
      4. To use browsersync:
        1. Open the project/site/web/app/themes/sage/assets/config.json file in a text editor
        2. Change the devUrl from \’93\’94 to desired address (i.e. \’\’94)
        3. Also, make sure that the pubic path is updated is you name the theme anything other than ‘sage’.
        4. Got to your Trellis\’a0directory and run: vagrant up
        5. Run: cd .. && cd site/web/app/themes/sage && yarn run start to make sure it’s working locally.

Leave a Reply

Your email address will not be published. Required fields are marked *

Let's Grow