Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

typisttech/vagrant-trellis-sequel

Repository files navigation

Vagrant Trellis Sequel

Gem Gem license Twitter Follow @TangRufus Hire Typist Tech

Open Trellis databases in Sequel Pro with a single command

Built with ♥ by Typist Tech


Vagrant Trellis Sequel is an open source project and completely free to use.

However, the amount of effort needed to maintain and develop new features is not sustainable without proper financial backing. If you have the capability, please consider donating using the links below:

GitHub via Sponsor Sponsor via PayPal More Sponsorship Information


Usage

$ vagrant trellis-sequel open --help
Usage: vagrant trellis-sequel open [options] [vm-id]

        --site [site]                Site whose database going to be opened.
        --vault-password-file [VAULT_PASSWORD_FILE]
                                     Vault password file.
        --vault-pass [VAULT_PASS]    Vault password.
    -h, --help                       Print this help

Noob

$ vagrant trellis-sequel open

This works for most of the cases:

  • vault.yml is unencrypted
  • vault.yml is encrypted and .vault_pass contains the vault password
  • running from within the Trellis directory
  • open the first found database

Specify which site's database

$ vagrant trellis-sequel open --site example.com

Use the --site option to specify which site's database to open. By default, the first site's database will be opened. Note: This is the site key of vault_wordpress_sites in vault.yml, usually ends with .com.

Specify vault password file

$ vagrant trellis-sequel open --vault-password-file .my_vault_password_file
$ vagrant trellis-sequel open --vault-password-file /my/top/secret.txt

Use the --vault-password-file option to specify path to the vault password file, either relative path from Trellis root or absolute path. Default value is .vault_pass if vault.yml is encrypted.

Specify vault password

$ vagrant trellis-sequel open --vault-pass my-top-secret

Use the --vault-pass option to provide vault password if you encrypted vault.yml but don't have a vault password file.


Typist Tech is ready to build your next awesome WordPress site. Hire us!


Installation

$ vagrant plugin install vagrant-trellis-sequel

Common Errors

DB password not found for example_dev

That means you passed wrong --site or vault.yml is malformed.

# group_vars/development/vault.yml

vault_wordpress_sites:
  example.com:
    admin_password: admin
    env:
      db_password: bye
  www.typist.tech:
    admin_password: admin
    env:
      db_password: hello

For the above vault.yml, these 3 commands are valid:

$ vagrant trellis-sequel open # Open one of the DB, most likely the first one
$ vagrant trellis-sequel open --site example.com
$ vagrant trellis-sequel open --site www.typist.tech

HMAC encoded in the file does not match calculated one

That means vault password is incorrect.

Connection Errors

This part is stolen from from Sequel Pro for Chassis.

If you get a connection error, the first thing to attempt to debug is to check the details that Sequel Pro gives you (under the Show Details button).

key_load_public: No such file or directory

If you get this error on macOS Sierra, it's possible that you have too many SSH keys loaded into your ssh-agent. If you're using multiple boxes with this setup in your SSH config (AddKeysToAgent yes), each new box you add will be added to your agent. With too many of these, SSH will hit the authentication retries limit before getting to the correct key.

The simple solution is to add this to your ~/.ssh/config file:

  # Disable checks on Vagrant machines
  Host 127.0.0.1
    # Skip adding to agent
    AddKeysToAgent no

    # Only use key specified on CLI
    IdentitiesOnly yes

    # Skip known hosts
    UserKnownHostsFile /dev/null
    StrictHostKeyChecking no

This disables using system-level keys (both from the agent, and your regular SSH keys), and disables host checks (which are not necessary for localhost). This does not affect vagrant ssh, which already uses these options.

FAQs

What about remote databases?

If you want to open non-vagrant databases, i.e: production or staging databases on remote sevrers, use $ trellis db open instead.

What to do when getaddrinfo: nodename nor servname provided, or not known

Make sure your hosts file (/etc/hosts) contains all the domains you're self-signing.

Usually it can be rectified by $ vagrant reload --provision or $ vagrant hostmanager.

Ask on Root Discourse if the problem persists.

It looks awesome. Where can I find some more goodies like this

Where can I give 5-star reviews?

Thanks! Glad you like it. It's important to let me knows somebody is using this project. Please consider:

Feedback

Please provide feedback! We want to make this project as useful as possible. Please submit an issue and point out what you do and don't like, or fork the project and send pull requests. No issue is too small.

Security Vulnerabilities

If you discover a security vulnerability within this project, please email us at [email protected]. All security vulnerabilities will be promptly addressed.

Credits

Vagrant Trellis Sequel is a Typist Tech project and maintained by Tang Rufus, freelance developer for hire.

Inspired from Sequel Pro for Chassis.

Special thanks to the Roots team whose Trellis make this project possible.

Full list of contributors can be found here.

License

Vagrant Trellis Sequel is released under the MIT License.