8.1.1 Quick Start Using Vagrant

This option provides a working example of the application running in a VirtualBox virtual machine (VM) for those [operating systems supported by Vagrant. This also provides a complete example of running the application behind the Nginx ("engine x") HTTP reverse proxy server. It is suitable for development or demonstration, but not as a production system.

**Note:** Installing all the required software, including the Vagrant box involves downloading approximately 600MB of data. Perhaps more of an "easy-start" rather than a "quick-start".

  1. Download and install VirtualBox
  2. Download and install Vagrant
  3. Clone this repository to a suitable location on the machine you are going to use to host the application and VM:
    $ cd ~/projects
    $ git clone git://www.fdsd.co.uk/trip-server-2.git
    
  4. Start the Vagrant VM
    $ cd ~/projects/trip-server
    $ vagrant up debian
    

    The first time this is run, it will download a Vagrant box containing a Debian Linux distribution, then install the required Debian packages, modify the default configuration and start the TRIP server.

  5. Use your browser to navigate to http://localhost:8080/ on the host machine and login providing the above credentials
  6. When finished, halt the server with:
    $ vagrant halt debian
    

Vagrant shares the source folder with the VM so that you can modify the source files on the host server and immediately impact the deployed application. This gives you a complete working development environment.

Should you need it, e.g. for running a GUI in Vagrant, the vagrant user’s default password is usually vagrant.

Rendering of map tiles is disabled by default, in order to respect OpenStreetMap’s Tile Usage Policy. You will need to follow the instructions below, in the See Tile Server Configuration section, before map tiles are rendered.

If you forget the admin user (admin@trip.test) password, login into the VM and modify the database entry in the PostgreSQL database. Replace SECRET with your desired password.

$ cd ~/projects/trip-server
$ vagrant ssh
$ psql trip
trip=# UPDATE usertable SET password=crypt('SECRET', gen_salt('bf')) WHERE nickname='admin';
trip=# \q

You can configure the time zone and locale settings by running the following commands on the guest VM and following the prompts:

$ sudo dpkg-reconfigure tzdata
$ sudo dpkg-reconfigure locales

Optionally, apply the latest Debian updates with:

$ sudo apt-get upgrade

View the Vagrantfile configuration file in the root of the trip-server folder for some examples you can modify. E.g. you can enable the config.vm.network "public_network" option to make the VM accessible from the public network. This would allow you, for example, to test location updates, using a GPS enabled device sharing the same private LAN as the host VM. Note the warnings in the Vagrant documentation for this setting, as for convenience, the VM is insecure by default and design.