Get a backup of your SiteFarm site onto your local machine.
We are going to assume that you already have a SiteFarm site (If you do not, please Request a SiteFarm Site).
Once you have a site, read about Site Factory and request an account on the hosting service. Once your account is active, you can log into SiteFactory to manage it.
Once you have logged into SiteFactory you can create a backup of your site. Be sure to check all the boxes to get a complete backup for your local environment.
Preparing to Run the Site Locally
Download a Backup of Your Site
After your site has finished backing up, download it to your machine.
The backup of the site will look something like mywebsite_13253_465463154261253.tag.gz. Go ahead and unzip it. The folder name look like mywebsite_13253_465463154261253. Rename it to an appropriate name for your project. For this demo we will be using mywebsite as the example project/site name. We would recommend keeping it to lowercase characters with dashes, and do not put in any empty character spaces.
Now you can move this folder anywhere to run the project, but we have run into permission issues when running websites from locations like the Desktop. We recommend creating a folder in your user folder called websites and relocating the project directory there.
Before building your local environment you will need DDev installed on your machine. DDev is an open source docker-based tool that you can use to quickly and easily set up local development environments for your web projects. Here is a link to DDev documentation for requirements and installation.
Starting Your Project
Build a Local Environment Using DDev
Once you have DDev installed you will need to build a local environment and you will need a local code editor.
Here are some examples:
Once you have the code editor of your choice installed Open your project in the editor.
- Open a Terminal window, and navigate to the root of the unpacked folder that you downloaded from Site Factory.
- Be sure you're in the root of that directory. If you run the command
ls -alyou should see files with names: .docksal, acquia-pipelines.yml, composer.lock, etc.
- Be sure you're in the root of that directory. If you run the command
- Run one command:
$ ddev themer-init
You will then see a message to enter a site name. Enter whatever name you would like to use.
Creating .ddev/config.local.yaml file. Use this file to change ddev settings.
Enter site name to set in .ddev/config.local.yaml (default: ): mywebsiteThis should kickoff the project build.
Upon completion it should provide you with a local link to view your website. Copy the link and paste it in a browser and you should see a working version of your website.
DDev Commands
- Get all the DDev commands and help
ddev ddev startStart a DDEV projectddev stopStops a project and removes its memory usage (but does not throw away any data).
The only custom commands listed when you run ddev that you should be using are ddev themer-init the first time you create your project, and ddev themer-refresh The other one is ddev themer-generate-subtheme. When you want to rebuild the database from the database.sql file in the root of your site project. This is covered in more detail on the Update Code and Files for Local Development page.