Work on WordPress locally

Run a copy of your WordPress site on your own computer with cubli pull and cubli dev.

With the CLI you bring a WordPress site from Cubli to your own computer, with all its files and the database. It runs there in Docker, as it does on Cubli. Handy for testing a theme or plugin without touching your live site.

What you need

  • The Cubli CLI, logged in. See CLI commands.
  • Docker with docker compose, on your computer.
  • An empty folder.

1. Get the site

mkdir bakery && cd bakery
cubli pull --project <id> --service wordpress

cubli projects shows your project’s id; the service name is your site’s name in the project. The CLI puts in the folder:

  • public_html/: all your site’s files, as on a server: WordPress itself, wp-config.php and wp-content with your themes, plugins and uploads;
  • the database as a dump;
  • a docker-compose.yml that runs the site with Cubli’s image.

If the folder uses git, your site’s data stays out of git. It holds your customers’ data: keep it safe and delete it once you are done.

2. Start the site

cubli dev

The first time, Docker builds Cubli’s image; that takes a while. Your site then opens at http://localhost:8080, or the next free port. The addresses in the database are changed to your local address once for this. Sign in at /wp-admin with your usual details.

Mail does not go out from this copy.

Command What it does
cubli dev --port 8090 Use another port
cubli dev --stop Stop the local site
cubli dev --fresh Start over with the database as it is now in the folder, for example after a new cubli pull

A new cubli pull in the same folder gets the site again. Whatever was in your local wp-content is set aside by the CLI, so you lose nothing.

3. Send files to staging

You don’t deploy from this folder with cubli up. Want to see your local wp-content on Cubli? Send it to staging:

cubli push --staging

All of the site’s files on staging are replaced by your local wp-content. That is why the CLI first asks you to type the site’s name. Staging is offline for a moment meanwhile. Your project needs staging for this; see Staging, promote and roll back.

The database does not go along. Want it on staging too? Import it separately with cubli db import <dump> --database <staging database id>.

You cannot yet move files and database from staging to production yourself. If you want that, mail support@cubli.io.

Was this helpful?

Stuck? Mail support@cubli.io, or ask from your dashboard: Help