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

Latest commit

 

History

History
102 lines (65 loc) · 3.36 KB

test.md

File metadata and controls

102 lines (65 loc) · 3.36 KB

Test

Having built a new version of one of the devboxes, you should thoroughly test it before deploying the new release to the Vagrant Cloud box registry.

  1. Import the base box

    From the box's root directory, ./boxes/[name]/, run the following command. This adds the ".box" file — generated in the previous step — to your current VM provider (VirtualBox). Use the --force flag to update any earlier versions of the box you may have installed previously.

    $ vagrant box add --force kieranpotts/[name] dist/[name].box

    The result should be:

    Successfully added box 'kieranpotts/[name]' (v0) for 'virtualbox'!
  2. Change to the example directory

    $ cd example
  3. Prepare for a clean build

    Destroy previous builds of the example box.

    $ vagrant destroy --force && rm -rf .vagrant
  4. Create an environment configuration

    Create an environment configuration file, .env, in the boot directory. You can just copy the example configuration file, .env-example.

    $ cp boot/.env-example boot/.env

    Optionally, you can make custom configuration changes in the .env file, for example to avoid DNS name clashes. This file is exluded from source control.

  5. Provision the example box

    From the example directory, re-provision the example box from scratch by running the following command.

    $ vagrant up --provision
  6. Hack your local DNS!

    While the text box is being provisioned, add the following configuration to your local system's hosts file. For iOS and Unix-like systems, the path to the hosts file is /etc/hosts. For Windows it is \Windows\System32\drivers\etc\hosts.

    192.168.50.10 devbox.local
    192.168.50.10 www.devbox.local
    192.168.50.10 mail.devbox.local
  7. Test

    When the provisioning is complete, reload your web browser and browse to the following resource:

    https://devbox.local/

    You will see a "Connection is Insecure / Untrusted" warning. That's OK. It means that the HTTPS connection is working fine. The reason why you see this message is because the website uses a self-signed certificate rather than one created by a trusted certificate provider. You need to "add an exception", instructing your browser to ignore the security issue and render the website as normal. If you are not able to add an exception because of "HSTS", follow the instructions in this article.

    The HTTP response message should be similar to the following:

    HTTP/1.1 200 OK
    Content-Type: text/html
    
    It works!

    You can also request the example app using the www domain prefix. Example:

    https://www.devbox.local/

    The plain http:// scheme for the application's main hostname and its alias should redirect to the HTTP Secure Protocol.

    Finally, you can test requests to static content by requesting this URL:

    https://devbox.local/static.html
  8. Finish

    Power down the example box by running the following command from your terminal.

    $ vagrant halt

If the tests are successfully, you can deploy the new build of the box to Vagrant Cloud.