Roots Discourse

Trouble Starting Local Development Environment after success running vagrant up + yarn start

#1

I’ve followed the setup instructions and my directory structure appears correct, everything is installed and I can run vagrant up and see the site says “running” when I open VirtualBox. I can also run yarn start and it attempts to connect to localhost:3000 but doesn’t connect. I can’t seem to figure out how to actually get the site up in the browser either with yarn and/or vagrant/VirtualBox.

I’ve edited the yml files per the docs and do not get any errors. Attached are some screenshots from the CL and of my directory structure. I don’t get any errors when running the commands, but I’m confused how I’m supposed to proceed from here. Any help or suggestions are greatly appreciated, thanks.

0 Likes

#2

image
This make it look like you’re trying to proxy an external URL. You shouldn’t be developing on a domain that actually exists. Your local development environment should use a different URL, i.e. redegg.local. You would need to change this in your trellis configuration files. You may also want to check your hosts file to see if the correct things are being written to it.

0 Likes

#3

Okay, I updated any instance of the site/domain to redegg.local. These were found in:

/trellis/group_vars/development/wordpress_sites.yml
/trellis/group_vars/development/vault.yml
/site/.env
/themes/my-theme/resources/assets/config.json

So the external URL isn’t showing anymore, but I’m still not seeing anything in the browser.

00%20AM

Would you be able to specify how I would go about checking the hosts file as you describe and what steps I need to take there? Thank you very much for your help so far, really appreciate it as I’m very new to the trellis/bedrock workflow.

0 Likes

#4

Please share the contents of these files. Did you re-provision the server after you made the changes?

Open /etc/hosts and look for something like:

## vagrant-hostmanager-start id: a13b0be0-bd04-427f-859d-9ea5cfcb01d6
192.168.50.15   roots.test
192.168.50.15   www.roots.test
## vagrant-hostmanager-end
0 Likes

#5

Okay, I seem to have it up and running now, but based on your questions I want to see if I’m missing anything or if I made any mistakes here. First off, here are the contents of those files:

/trellis/group_vars/development/wordpress_sites.yml

wordpress_sites:
  redegg.local:
    site_hosts:
      - canonical: redegg.local
        redirects:
          - www.redegg.local
    local_path: ../site # path targeting local Bedrock site directory (relative to Ansible root)
    admin_user: redegg
    admin_email: test@example.com
    multisite:
      enabled: false
    ssl:
      enabled: false
      provider: self-signed
    cache:
      enabled: false

/trellis/group_vars/development/vault.yml

vault_mysql_root_password: redegg
vault_wordpress_sites:
  redegg.local:
    admin_password: redegg
    env:
      db_password: redegg

The steps I took to get the site running were to run vagrant provision and then re-run vagrant up and everything seemed to work. Was this the correct thing to do?

Lastly, I wasn’t able to find /etc/hosts anywhere. Are there docs explaining where this should be and what it should look like? I’m wondering why I’m unable to find it or if maybe I’m just missing something here.

Thank you both again for your help!

0 Likes

#6
wordpress_sites:
  redegg.local:
vault_wordpress_sites:
  redegg.local:

Both of these need to be your live domain

You only use the local development hostname in development/wordpress_sites.yml under site_hosts

0 Likes

#7

Got it. Thanks, I’ve updated those now. Things appear to be working as expected for development with yarn and browser sync, so all looks good there.

Hopefully the other steps I mentioned re: the vagrant commands/server provisioning were okay. Should I be concerned at all with investigating /etc/hosts for future reference?

0 Likes

#8

@benword I seem to be having another issue. After shutting down the vagrant machine, if I go back again and do vagrant run again, I get the success message that the box is ready to use, only this time in the browser I now get a 500 Internal Server Error.

Do I need to run other commands related to provisioning the server every time, or is there something in my configuration that would be causing this to happen? Nothing has changed as far as what I see in the terminal. The only difference is I didn’t run vagrant provision and I’m a little confused as to what’s happening here and how to reliably get vagrant going each time and working in the browser.

0 Likes