bk-django1.8.box is the name of bluking image. Including centos7+Django+a series of blueking necessary units.
vagrant box add bk bk-django1.8.box # bk is defined for this box
3. Initial
Make your own workstation path for vagrant
mkdir /Users/BK/vagrant/django18 #for example
cd /Users/BK/vagrant/django18
vagrant init bk #init.
#will auto create "Vagrantfile" for configuring, we can settings like folder share or port-forward here. If share folder's patch not set, current path will be default path.
# For user "root" and "vagrant", default password is "vagrant".
vim Vagrant
#config.vm.box = "bk"
#config.vm.network "forwarded_port", guest: 8000, host: 1234
vagrant up #start up
vagrant ssh #ssh to this environment
4.Config framework, create database
cp framework.tar.gz /Users/BK/vagrant/django18/
cd /Users/BK/vagrant/django18/
tar xf framework.tar.gz
vagrant ssh #ssh to blueking dev env
cd /vagrant/framework
mysql -u root
#create databas myapp01, myapp01 is APP_ID, will use in config file
mysql>create database myapp01 default character set utf8 collate utf8_general_ci;
#change password for root
mysql>use mysql
mysql>show
mysql>show columns from user;
mysql>select User,Host,Password from user;
mysql>update user set Password=password('vagrant') where User='root';
mysql>flush privileges;
mysql>exit
Edit ./conf/default.py
# APP_ID = 'myapp01'
# BK_PAAS_HOST = 'http://paas.bk.test.garena.com'
Edit ./conf/settings_development.py conf/settings_testing.py conf/settings_production.py
#'NAME': myapp01, # database name (same as APP_ID)
#'USER': 'root',
#'PASSWORD': 'vagrant'
cd /vagrant/framework
python manage.py migrate
5.Run server
#run
python manage.py runserver 0.0.0.0:8000
#if no DNS, you should set hosts both in bk env and your local
150.109.2.217 paas.bk.test.garena.com
150.109.2.217 cmdb.bk.test.garena.com
150.109.2.217 job.bk.test.garena.com
150.109.2.217 o.bk.test.garena.com
150.109.2.217 t.bk.test.garena.com
#for your local hosts, need one more rule
127.0.0.1 dev.bk.test.garena.com