We love Roots. All of our WordPress sites are built using their three tools, Trellis, Bedrock, and Sage. For a lot of WordPress guys, all of these items are Greek. So if you’ve received a WordPress site and wondered what to do with it, hopefully this guide will help you set it up on your server.
First, some requirements:
- Server with LEMP stack (we recommend Digital Ocean)
- Access to the Git Repo
- Copy of the Database
- Copy of the Uploads folder
Once you have the necessary components, follow these steps to get your new site online.
1. Setup Server for New Site
I’m not going to go into how to set up a new site on your server since every server is different… just add a new domain to your server like you would normally do. Your web root should be set as the /web (ie. example.com/web) folder in order to work with Bedrock. Then you need to add a new database to your server and import the database you received. Make sure to note the database name, user and password associated with the database.
2. Import Git Repo and Install Bedrock and Sage
In Terminal, navigate to the newly added domain’s root folder. Once there, you’ll need to clone in your repository:
git clone git@bitbucket.org:username/repo-name.git
Once cloned, from the same folder run:
composer install
Next, you’ll need to set up your .env file. To do create your .env file, run the following command from the same folder:
cp .env.example .env
Open the newly created .env file and update all the variables starting with the database information, domain name and salts.
Navigate to /web/app/themes/{sage-theme-name} and run the following command:
composer install && yarn && yarn build
3. Upload your “Uploads” folder
I prefer to use rsync to upload the uploads folder, since the folders can get rather large in size and can take literally forever using regular (S)FTP. If you choose to use rsync, and you’re using ssh shortcuts, the command to rsync could look something like this. From the folder containing the uploads folder:
rsync -vrz uploads ssh.shortcut:example.com/web/app
Otherwise just upload the uploads folder to the /web/app folder overriding the default uploads folder set up by the composer installer.