# VirtualBox. Trellis. Ansible. Bedrock All Set. Now what

**URL:** https://discourse.roots.io/t/virtualbox-trellis-ansible-bedrock-all-set-now-what/9197
**Category:** bedrock
**Created:** 2017-03-25T21:04:27Z
**Posts:** 22

## Post 1 by @takuyashim — 2017-03-25T21:04:27Z

Hello!

I installed them all – I have the example/by-default Wordpress site up and running locally. It’s all because our developer created the Wordpress site with Bedrock framework and I am forced to learn this…which is a great incentive to step up to the next level.

Anyway, I have a “site” folder containing all files (composer.json, web folder, config folder etc.) from the developer. I also have a MySQL dump file.

What are the steps to take from here, if I want to run the site our developer created?

Here is what I am guessing…

1. vagrant ssh and replace the database file, somehow.
2. replace “site” folder
3. update Wordpress\_sites.yml
4. vagrant up.
5. tada!

Is this basically it? Right now, I am trying to make Sequel Pro work to connect to the database in VirtualBox. It’s been pain… “SSH tunnel has unexpectedly closed”.

---

## Post 2 by @swalkinshaw — 2017-03-25T22:04:24Z

So to confirm: you set up a brand new Trellis project locally and got it all working with a default site?

Now you want to get it working with a project another developer gave you?

Your steps are generally correct. Although if that developer didn’t use Trellis you’ll need to do a DB search and replace to update paths.

Also if you update the name of a site, you’ll need to do `vagrant reload` to update synced folders. Or just destroy it and start over.

For Sequel Pro, did you follow [https://roots.io/trellis/docs/database-access/](https://roots.io/trellis/docs/database-access/)?

---

## Post 3 by @takuyashim — 2017-03-25T22:26:55Z

**So to confirm: you set up a brand new Trellis project locally and got it all working with a default site?**  
Yes

**Now you want to get it working with a project another developer gave you?**  
Yes

**Your steps are generally correct. Although if that developer didn’t use Trellis you’ll need to do a DB search and replace to update paths.**  
Yes. I did that already, forgot including in the steps.

**Also if you update the name of a site, you’ll need to do vagrant reload to update synced folders. Or just destroy it and start over.**  
The name of the site, as in, the domain? I’ll probably destroy it anyway.

**For Sequel Pro, did you follow [https://roots.io/trellis/docs/database-access/1](https://roots.io/trellis/docs/database-access/1)?**  
Yes. I did. Actually, I just successfully connected to the database! My misunderstanding was the username “example\_com”. Since the username isn’t defined in vault.yml, I was using “root” as username as number of tutorials on other websites suggested. Anyway, thank you for reminding me the page. I’ve spend 3 hours on this… a stupid mistake…

This is a huge leap from the regular WP development but I am slowly getting it…

Thanks!

---

## Post 4 by @takuyashim — 2017-03-26T01:39:23Z

After bunch of trials and errors, I was able to run the site… with some errors (class-wp-hook.php related) I believe they are caused by the PHP version. It needs to be PHP 5.6 (not PHP 7). How do I downgrade the PHP version in Virtualbox? I found this:

> **[Downgrade PHP 7 to PHP 5.6 on Ubuntu 16.04 Xenial - GeekDecoder](http://geekdecoder.com/ubuntu-16-04-xenial-downgrade-php-7-php-5-6/)**
>
> How to install PHP 5.6 on Ubuntu 16.04 Xenial and replace php 7. Let’s assume you have a fresh Ubuntu 16.04 server. Install add-apt-repository: # sudo apt-get install python-software-properties Add …

---

## Post 5 by @swalkinshaw — 2017-03-26T02:54:52Z

You’d have to search the Trellis codebase for `php7.1` and replace with a suitable 5.6 package. Honestly I’d assume it’s easier to make the code work with PHP 7.

---

## Post 6 by @takuyashim — 2017-03-26T12:45:37Z

You are right. I decided to go that route. I did some digging after that. It seemed like something to do with a custom theme the developer created. After I disabled some add\_filter function on the theme, everything works fine.

Now I am onto the fun part, deploying.

> **[Deploys | Trellis Documentation | Roots](https://roots.io/trellis/docs/deploys/)**
>
> Trellis offers one-command deploys out of the box with little configuration needed. Hooks let you customize what happens at each step of the process.

---

## Post 7 by @MWDelaney — 2017-03-26T16:02:38Z

Remember that deploy doesn’t include your uploads or database; you’ll need to do those yourself or employ additional deployment tools. I usually do the following:

1. `vagrant ssh` to my development VM, `cd /srv/www/example.com/current` and `wp db export`

2. (s)ftp the dump file (which is now in your `site` directory) and my uploads to `current` and `shared` respectively on my deployed server, ssh the server(`cd` to `current`) and do a `wp db import file name.sql`

It’s not the world’s most efficient method but it’s deliberate and I know I didn’t miss anything if I use these steps.

---

## Post 8 by @takuyashim — 2017-03-26T21:25:44Z

Thanks Delaney!

I used the domain “example.dev” locally. I have my test domain(say, [staging1.example.com](http://staging1.example.com)) pointing to one of servers in [DigitalOcean.com](http://DigitalOcean.com). Here is my guess:

1. vagrant ssh to my Virtualbox and export db.
2. The db has references to example.dev. Search and replace them all with [staging1.example.com](http://staging1.example.com)
3. Make necessary changes on files under ansible/group\_vars/staging/
4. Put [staging1.example.com](http://staging1.example.com) on ansible/hosts/staging file as a server hostname.
5. Push my files to git repo.
6. Deploy my staging files to a server.
7. SFTP the SQL dump file/upload folder to current folder (and shared?) and do the import.

After this, I can open [staging1.example.com](http://staging1.example.com) and my site is up and running beautifully! (in theory)

Am I missing anything?

---

## Post 9 by @takuyashim — 2017-03-27T03:26:55Z

Here is my update.

I published them all to a live server. When I accessed to the site, the site said usual “Welcome to Wordpress!” and the rest of form fields including site name and password. I did not complete that.

Instead, I started importing db. When I finished the import & I was thinking the site is up and running, I was wrong - the white page with nothing. No error.

Should I complete the Welcome to Wordpress AND THEN replace the db? Or… Am I doing something wrong?

to be continued…

---

## Post 10 by @MWDelaney — 2017-03-27T11:55:01Z

Make sure you do a `wp search-replace devurl liveurl` after importing.

---

## Post 11 by @takuyashim — 2017-03-27T16:15:23Z

I did that before I imported the sql.

---

## Post 12 by @takuyashim — 2017-03-28T01:54:13Z

Despite the blank page, I was able to access to admin dashboard URL. When I got there, There was a message “Database Update Required” . So I hit YES. Then I was able to get into the admin dashboard directly. At that point, I realized there was no plugin installed - including advanced-custom-fields. That explains why the homepage was completely blank. Is the database update something to do with this?

I feel this is getting really really close!

---

## Post 13 by @strarsis — 2017-03-28T14:39:14Z

Very nice tool for transferring database + uploaded files (the actual data) - it will also update the URLs: [Leveraging WP-CLI Aliases in Your WordPress Development Workflow](https://discourse.roots.io/t/leveraging-wp-cli-aliases-in-your-wordpress-development-workflow/8414/22)

---

## Post 14 by @karel — 2017-03-28T21:00:12Z

> [@takuyashim](#):
>
> Should I complete the Welcome to Wordpress AND THEN replace the db? Or… Am I doing something wrong?

You should complete and log in with production user-pass at first. After you do push db, then you need your dev user-pass if they are different.

---

## Post 15 by @strarsis — 2017-03-29T13:22:20Z

I run this WP CLI command to finish the setup, it is idempotent,  
which means that it doesn’t change an existing finished WordPress setup.

```
wp @production core install --url=<the-url> --title="<the-title>" --admin_user=<the-user> --admin_password="<the-password>" --admin_email=<the-email>
```

Edit: WP CLI can also be used for activating plugins + theme, installling languages packs and updating them - ideal as install hook.

Edit: Related thread: [Install & update WordPress languages with WP-CLI](https://discourse.roots.io/t/install-update-wordpress-languages-with-wp-cli/6454)

---

## Post 16 by @takuyashim — 2017-04-01T00:31:25Z

After I uploaded all plugins through sFTP, everything is working fine now. Thanks for the advices, everyone! I sense there is a better way to upload plugins but I’ll learn little by little.

---

## Post 17 by @MWDelaney — 2017-04-01T01:40:29Z

Are you managing your plugins with composer? If so they should download automatically in the deploy process.

---

## Post 18 by @takuyashim — 2017-04-01T11:52:52Z

No. And I knew that’s part of process that I needed to take. I cheated it. That’s what I am going to do next. One of the mistery is that…how about premium plugins and homegrown plugins?

---

## Post 19 by @mockey — 2017-04-01T13:09:07Z

> [@takuyashim](#):
>
> One of the mistery is that…how about premium plugins and homegrown plugins?

You can add them to your composer.json in several ways, e.g.:

> **[WordPress Plugins with Composer](https://roots.io/wordpress-plugins-with-composer/)**
>
> See how to create Composer packages for custom WordPress plugins, along with private plugins and 3rd party plugins with the composer.json file.

[https://discourse.roots.io/t/best-way-to-install-private-paid-plugins-with-composer/1045](https://discourse.roots.io/t/best-way-to-install-private-paid-plugins-with-composer/1045)

---

## Post 20 by @MWDelaney — 2017-04-01T13:34:36Z

[This is the method I use](https://discourse.roots.io/t/best-way-to-install-private-paid-plugins-with-composer/1045/27?u=mwdelaney). I keep a private github repo for each of my custom and premium plugins so that I can use them across projects. Which is mostly wishful thinking but hey, you never know.

Updating premium plugins becomes a chore (I have to download the update, then commit it to my repo for that plugin, then `composer update` each project that uses it) but it’s still “cleaner” than other options.

If you use ACF, there’s an even better way outlined [here](https://discourse.roots.io/t/acf-pro-as-a-composer-dependency-without-committing-your-license-key/6690). Sadly it only works for ACF right now.

---

## Post 21 by @swalkinshaw — 2017-04-01T14:09:42Z

Closing this thread as its served its purpose. We don’t like to encourage these ongoing threads since they make it harder to find solutions in.

---

## Post 22 by @swalkinshaw — 2017-04-01T14:09:45Z


