How to deploy a site with DDEV

Title slide: How to Deploy DDEV-Local to DDEV-Live, with screenshot of the ddev pull command

Are you running a project using the DDEV-Local development environment? Have you heard that we also offer a production environment, DDEV-Live? Here’s a handy guide to how to start with a project in DDEV-Local and walk through the steps to deploy to DDEV-Live hosting. All of the detailed documentation can be found in the DDEV docs, which we’ll link to throughout this post.

DDEV is all about end to end integration so your experience is unified from local development to deployment. Our Kubernetes-based hosting platform follows the same vision as the Docker-based local environment to give you the speed, consistency, and flexibility of containers without the learning curve. 

The key requirement is that you have a hosted Git repository for DDEV-Live to pull from, so that your code is managed and centralized, supporting GitOps best practices. You will also need up to date versions of both the ddev CLI and the ddev-live CLI (links below). Please read through all the steps so you understand what’s happening. Let’s get started!

How do I take my project from DDEV-Local to DDEV-Live?

Helpful hint: there’s loads of info in the ddev-live CLI, just run ddev-live and drill down with the --help flag on any command. 

  1. You have a project in DDEV-Local
    If you’re reading this, you likely already have a project running locally with DDEV-Local. If you don’t have a project you’d like to work with for this guide, or you’d like a clean project for testing:
    1. Install or update the ddev cli (requires Docker).
    2. Then use a quickstart guide to set up a simple Drupal, TYPO3 or WordPress site, preferably using Composer. You might also check out an existing project of your own.
      Pro tip: Use the same name for your project when configuring DDEV-Local and DDEV-Live for easy end to end integration in the future.
    3. Set up and configure Git for this project if you haven’t already.

  2. Sign up for DDEV-Live
    Follow the Getting Started Guide in the DDEV-Live documentation to set up your account and connect to our platform (If you haven’t already. If you have an older account and you need a reset please let us know). Your project must be pushed to a remote repository on GitHub or GitLab PaaS to work with DDEV. We’re continuing to build out support for GitLab.com and other Git providers
    1. Sign in at dash.ddev.com, make note of your entry for “organization” for reference in steps below.
    2. Enter payment information. A new DDEV-Live subscription includes a free 10 day trial for personal site hosting, after which you will be billed.
    3. [If using GitHub, install the DDEV-Live GitHub app.]
    4. [If using self-hosted GitLab, follow the docs here.]
    5. Install (or update!) the ddev-live CLI and authenticate the CLI with the DDEV platform.
    6. Set your default organization.

  3. Preparing for deployment
    Note: You can run Composer during the site creation on DDEV-Live in the next step. Review your configurations, –dev flags and .gitignore at this stage.
    1. Commit your local changes in Git and push to the hosted repository branch or tag you want to use for DDEV deployments. Keep in mind that any future pushes to this branch or tag will trigger a deploy to DDEV.
    2. Take note of your php version, CMS version, and docroot for the next step.

  4. Deploying your site on DDEV-Live
    This is the exciting part. Now you can create a DDEV-Live site from your Git repository. There are three CMS specific guides available, Drupal, TYPO3 and WordPress. Generic PHP support is currently under development.
    1. With your authenticated ddev-live cli, run ddev-live create site … with appropriate flags (--run-composer-install, --docroot, --php-version…) and reference to your Git repo/branch/tag. Your site will spin up on fresh resources inside DDEV-Live, returning a preview URL when it’s ready. 
    2. Use ddev-live describe site <site> to check readiness.
    3. Upload any assets such as databases and files.
    4. Configure your DNS, hostnames, and TLS as needed. 

Working with DDEV: next steps

Now that your site is live, you can keep working locally and use Git to manage your releases. For example, you may have set up DDEV-Live to track a Git tag such as “production.” Now any time you push commits to that tag they’ll deploy to DDEV.

If you need to bring your production site down to your local, or to another local machine, use the integration tool in DDEV-Local. Set up the machine with both of the cli tools, authenticate, checkout the project repository and run ddev pull to import the project assets from DDEV-Live. You will also want to ensure that you’re sanitizing the database once it’s on your computer. Continue to work with DDEV-Live as above by making commits and pushing to your DDEV-tracked repository.

There’s a lot more that’s possible with DDEV. Take a look at some tools like ddev-live exec and ddev-live config variable for starters. Send us your feedback anytime! We really appreciate it and it helps everyone using the platform. Thank you.

Conclusion: 

Now you can work with DDEV for local development and deploy quickly to our hosting platform. The things you want to achieve are actually already within reach, we just give you some structure to build on with a Git-centric workflow to reduce complexity in deployment and collaboration. We just released a couple of key features that will support these concepts. Site tagging and site expirations are already available on DDEV-Live. These features will join others this fall as we build out something along the lines of on-demand, public-facing staging and testing sites that will be ephemeral and billed separately from permanent sites.

Stay tuned via our newsletter or Twitter for updates!

Share this post: