Introducing the ComputeStacks Vagrant Dev Environment

We now have a Vagrant development environment available to make building & testing ComputeStacks even easier. With just a single virtual machine, you can run a fully working installation of ComputeStacks.

To get started, clone our controller to your local computer.

  1. Copy envrc.sample to .envrc and update values appropriately.
    • Take note that the GITHUB_GEM_PULL_TOKEN is a personal access token with the read_packages permission.
  2. Copy config/database.sample.yml to config/database.yml.
    • No changes are required.
  3. Copy Vagrantfile.sample to Vagrantfile and make any relevant changes, however it should work out of the box without any modification.
  4. Bring up with vagrant up. This will take a few minutes depending on your computer – compiling ruby takes a bit.

Enter the vagrant VM with: vagrant ssh

  1. Install NodeJS & Yarn

    1. Install nodejs with nvm install --lts
    2. Install yarn npm -g install yarn
  2. cd ~/controller and run:

    1. direnv allow .
    2. bundle
      • if you did not setup your .envrc correctly, you will get an authorization error. Our provision script will automatically take the credentials in your .envrc file and authenticate with Github, but please also reference this document if you run into issues: Working with the RubyGems registry - GitHub Docs
  3. Once all the gems have been installed, bootstrap your database with:

    1. bundle exec rails db:create
    2. bundle exec rails db:schema:load
    3. bundle exec rails db:seed
  4. Bootstrap the controller assets (from inside ~/controller in vagrant)

    1. Run yarn
    2. Run bundle exec rake assets:precompile
  5. (optional) Install our default CS theme. Skip if you’re building your own.

    mkdir ~/controller/public/assets/custom
    wget -q -O ~/controller/public/assets/custom/application.css https://storage.googleapis.com/cstacks/provision_assets/branding/application.css
    wget -q -O ~/controller/public/assets/custom/application.css.map https://storage.googleapis.com/cstacks/provision_assets/branding/application.css.map
    wget -q -O ~/controller/public/assets/custom/logo-login.png https://storage.googleapis.com/cstacks/provision_assets/branding/logo-login.png
    
  6. (optional) Run our test suite with: bundle exec rails test

You may now launch ComputeStacks by running overmind s from the ~/controller directory within the vagrant vm.

Next, proceed to your browser and visit http://localhost:3005 – the default credentials are admin@cstacks.local / changeme!

To aid in your debugging efforts, the Vagrantfile will also forward Prometheus on port 9090 and consul on 8500. The Consul token can be found in the vagrant virtual machine at /home/vagrant/consul.token.

1 Like