Is there a way to preview a production droplet without pointing the production DNS to it

wordpress_sites:
  example2.com:
    site_hosts:
      - canonical: example2.com
        redirects:
          - www.example2.com
    local_path: ../site # path targeting local Bedrock site directory (relative to Ansible root)
    repo: git@github.com:blah/blah
    repo_subtree_path: site # relative path to your Bedrock/WP directory in your repo
    branch: master
    multisite:
      enabled: false
    ssl:
      enabled: true
      provider: letsencrypt
    env:
      wp_home: https://example2.com
      wp_siteurl: https://example2.com/wp
    cache:
      enabled: true

How can I check http://example2.com without pointing the existing DNS to the droplet IP?
Just using the droplet IP seems to fail and Trellis seems heavily dependent on having a DNS record present.

Yes. Edit your /etc/hosts file:

2 Likes

Yep, /etc/hosts
Don’t forget to remove the /etc/hosts entry when you’re done with it.

Let’s Encrypt won’t work until you have real DNS set up. Until then, you’ll need to set SSL to either
enabled: false
or
provider: self-signed

I have achieved that but something’s obviously wrong as it is showing the same thing as if I were typing in the server IP address; nothing :confused: I thought there might be more to it. I obviously have an error somewhere else.

That’s good to know; about the SSL though

Could you try this?
(and make sure you’re using the same <environment> for everything)

  • make sure your local machine /etc/hosts has a line like this (not remote server machine):
    12.34.56.78 example2.com (but with correct IP)
  • make sure trellis hosts/<environment> has that same IP, or uses example2.com
  • for SSL
    • enabled: true
    • provider: self-signed
  • remove these from wordpress_sites: env, wp_home, wp_siteurl (just let Trellis handle them)
  • for cache, set enabled: false (although this probably isn’t relevant)
  • run server.yml again
  • run ./bin/deploy.sh again
  • visit the site in a new browser tab

If the site still doesn’t load, you could check logs on the server, e.g.,

  • /srv/www/example2.com/logs/error.log
  • /var/log/nginx/error.log

If you end up trying SSL enabled: false, you will perhaps need to clear hsts headers for your browser, then try a new browser tab.

Interestingly I am unable to deploy… (which might explain a few things).

I’m getting the old

ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

But when I run

ssh web@12.345.67.89 'ssh -T git@github.com'

it says

Hi craigmdennis! You've successfully authenticated, but GitHub does not provide shell access.

I’ve read though Can’t deploy - and have some similar issues.

1 Like

I’m going to tear down the droplet and start over and see what happens (even though I only set this on up this morning)

1 Like

To help determine whether the problem is with your specific repo, try this alternative just for testing:
repo: git@github.com:roots/roots-example-project.com.git

Make sure your repo value includes that final .git even though you don’t see the .git in your browser url bar when you visit your repo.

1 Like

That worked. Deploys fine. So it’s definitely related to my repo (private) and not Trellis per-se.

1 Like

Having said that, I just changed the repo back and now it deploys. So some combination of creating a fresh droplet and the other debug steps I’ve done have worked…

1 Like

The only issue now, more in line with my original question, is that due to SSL (of the existing site I’m trying to override with my hosts file or the SSL setup with Trellis) I get a Chrome error about the connection not being private. It references chrome://net-internals/#hsts but I have cleared that. Revealing ‘advanced’ does not give me any option to continue.

1 Like