Vagrant is a popular way to run pre-packaged software on virtual machines like VirtualBox and VMware.
Before starting a Bubble Vagrant box, you’ll need install some software if you don’t already have it:
There are a few environment variables you can use to configure how the Vagrant box is initialized.
Do you have anything already listening on port 8090? If so, set the BUBBLE_PORT
environment
variable to some free port where the Bubble API can listen. Otherwise, it defaults to 8090.
Do you want to use this setup as a local launcher to start new Bubbles? If so, set
the LETSENCRYPT_EMAIL
environment variable to an email address that will be registered with
LetsEncrypt when your Bubbles need to install SSL certificates.
Read the Bubble Vagrantfile for full information on all settings.
To start the Bubble Vagrant box, run:
vagrant up
To start the Bubble Vagrant box with some environment variables (for example):
LETSENCRYPT_EMAIL=someone@example.com BUBBLE_PORT=8080 vagrant up
The first time vagrant up
runs it will take a long time to complete, since it needs to
download and build a lot of stuff. Depending on the speed of your computer and internet,
it could take anywhere from 5 to 20 or more minutes.
For future runs of vagrant up
, startup times will be much faster.
When the command completes, you’ll have a Vagrant box with the Bubble source code and all dependencies fully built and ready to run a local launcher.
To stop the Vagrant box, run:
vagrant halt
To delete the Vagrant box, run:
vagrant destroy [-f]
If you supply -f
then you will not be asked for confirmation.
When your Vagrant box is ready, you can login to it:
vagrant ssh
You can develop directly on the Vagrant box by editing the source files in ${HOME}/bubble
, then
building and running from there.
Alternatively, you can develop locally on the host and periodically synchronize your source and/or build assets to the Vagrant box, where you then (maybe build and) run the Bubble API.
The /vagrant
directory on the Vagrant guest box is a shared folder. On the host side, it
is the directory that the Vagrantfile
is in (the top-level of the bubble repository).
For various reasons, the Vagrant box does not build and work in this directory directly. Instead,
when the box is created, /vagrant
is copied to ${HOME}/bubble
and we run things from there.
So, if you are doing development and building locally (on the host), and want to see your changes on the Vagrant box (guest), then copy your bubble jar from the host to the guest:
cp /vagrant/bubble-server/target/bubble-server-*.jar ${HOME}/bubble/bubble-server/target/
To synchronize the entire directory (for example if you’re editing sources on the host and building the jar on the guest):
rsync -avzc /vagrant/* /vagrant/.* ${HOME}/bubble/
Read Bubble Developer Tasks to understand how to keep the code up to date, run the API server, rebuild the jar, and more.
If you’ve started the Bubble API already using run.sh
, and want to launch a Bubble,
continue with activation.