Business Development

Process driven.

Results driven.

Installing Roots with Sage 9

Last updated By
  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 DigitalOceanyou only need to do steps 3.5-7.
  3. If you don’t have an SSH key yet\’96 in your command line,\’a0go to your root directory and\’a0create a new SSH key:
    1. To create RSA key pair- run:\’a0ssh-keygen -t rsa
    2. Create file path\’96 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\’96 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 run: sudo nano ~/.ssh/config (enter password)
    2. Grab\’a0the IP address from your Digital Ocean droplet
    3. Inside of the config file, type this in (note that my [key-name] is id_rsa:
    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 vagrant 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. Name it the name of your project run: cd ~/sites && mkdir example-project && cd example-project
      6. Clone Trellis and remove .git folder, run:
        git clone --depth=1 git@github.com:roots/trellis.git && 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: cd .. && git clone --depth=1 git@github.com:roots/bedrock.git 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. To build scaffolding, run: yarn && yarn build
    4. Your file hierarchy should look like this.
    5. Add Soil, run: cd .. && cd .. && cd .. && cd .. && composer require roots/soil 3.7.3
      • You might want to check for the latest version here.
    6. *If the command isn’t found, you’ll need to install composer globally first.
    7. Configure Sage, at least run:
      1. cd web/app/themes/sage && yarn
  9. Commit and publish the entire project on Github
  10. Development:
    1. Setup Local Development Environment:
      1. Tip: You can open your project from the Github app by right clicking it, and selecting Open in Atom
      2. Configuretrellis/group_vars/development/wordpress_sites.yml
      3. Cofiguretrellis/group_vars/development/vault.yml like
      4. Note: I added my github username and correct SSH key path to all/vault.yml and uncommented it.
      5. Got to your Trellis directory and run: vagrant up
      6. If you ever get a NFS error, check this out.
      7. 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 *