Skip to content

Commit

Permalink
Merge pull request #1044 from thoughtworks/improve-vagrant-flow
Browse files Browse the repository at this point in the history
Improve vagrant flow
  • Loading branch information
arikfr committed May 13, 2016
2 parents cfb852e + d4ff748 commit ed45dcb
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 23 deletions.
4 changes: 4 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "redash/dev"
config.vm.synced_folder "./", "/opt/redash/current"
config.vm.network "forwarded_port", guest: 5000, host: 9001
config.vm.provision "shell" do |s|
s.inline = "/opt/redash/current/setup/vagrant/provision.sh"
s.privileged = false
end
end
21 changes: 21 additions & 0 deletions bin/vagrant_ctl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
set -e

help() {
echo "Usage: "
echo "`basename "$0"` {start, test}"
}

case "$1" in
start)
vagrant up
vagrant ssh -c "cd /opt/redash/current; bin/run honcho start -f Procfile.dev;"
;;
test)
vagrant up
vagrant ssh -c "cd /opt/redash/current; make test"
;;
*)
help
;;
esac
28 changes: 5 additions & 23 deletions docs/dev/vagrant.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,10 @@ To get started with this box:
`Vagrant <https://www.vagrantup.com/>`__ installed.
2. Clone the Re:dash repository:
``git clone https://github.com/getredash/redash.git``.
3. Change dir into the repository (``cd redash``) and run run
``vagrant up``. This might take some time the first time you run it,
3. Change dir into the repository (``cd redash``)
4a. To execute tests, run ``./bin/vagrant_ctl.sh test``
4b. To run the app, run ``./bin/vagrant_ctl.sh start``.
This might take some time the first time you run it,
as it downloads the Vagrant virtual box.
4. Once Vagrant is ready, ssh into the instance (``vagrant ssh``), and
change dir to ``/opt/redash/current`` -- this is where your local
repository copy synced to.
5. Copy ``.env`` file into this directory (``cp ../.env ./``).
6. From ``/opt/redash/current/rd_ui`` run ``bower install`` to install
frontend packages. This can be done from your host machine as well,
if you have bower installed.
7. Go back to ``/opt/redash/current`` and install python dependencies
``sudo pip install -r requirements.txt``
8. Update database schema to the latest version:

::

bin/run ./manage.py database drop_tables
bin/run ./manage.py database create_tables
bin/run ./manage.py users create --admin --password admin "Admin" "admin"
9. Purging the Redis cache
``redis-cli -n 1 FLUSHALL``
10. Start the server and background workers with
``bin/run honcho start -f Procfile.dev``.
11. Now the server should be available on your host on port 9001 and you
Now the server should be available on your host on port 9001 and you
can login with username admin and password admin.
22 changes: 22 additions & 0 deletions setup/vagrant/provision.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash


cd /opt/redash/current
cp /opt/redash/.env /opt/redash/current
cd /opt/redash/current/rd_ui
bower install
cd /opt/redash/current

#install requirements
sudo pip install -r /opt/redash/current/requirements_dev.txt
sudo pip install -r /opt/redash/current/requirements.txt
sudo pip install pymongo==3.2.1

#update database
bin/run ./manage.py database drop_tables
bin/run ./manage.py database create_tables
bin/run ./manage.py users create --admin --password admin "Admin" "admin"

#Purge Redis cache
redis-cli -n 1 FLUSHALL

0 comments on commit ed45dcb

Please sign in to comment.