This repository is a set of puppet modules and scripts to setup a local development environment for the Grand Comics Database website (gcd-django) using Vagrant.
- Grand Comics Database website
- Grand Comics Database documentation
- Grand Comics Database Google groups:
You need to install these applications:
You can use other providers like VMWare Fusion or Parallels Desktop with this box but we only provide support for VirtualBox.
The official documentation to manage providers with Vagrant is available here.
The easiest way to install git
on Windows and manage repositories is to use the official application of Github.com available here. It provides also some tools like PowerShell
, msysGit
and posh-git
.
PowerShell console allows you to proceed commands like Unix users, as needed here.
The official documentation to get started with Github for Windows is available here.
To get started with the GCD Django Box, simply run:
$ cd /path/to/your/gcd-django-vagrant-install-parent-directory
$ git clone --recurse-submodules https://github.com/GrandComicsDatabase/gcd-django-vagrant-install
$ cd gcd-django-vagrant-install
$ cp ./puppet/environments/local/parameters_private.yaml.sample ./puppet/environments/local/parameters_private.yaml
Notes about the parameters_private.yaml file
- This file helps you define optional custom parameters for:
- The theme for oh-my-zsh (the default theme is
gianu
) - Some optional customization file contents
- The theme for oh-my-zsh (the default theme is
Then run:
$ vagrant up --provision
$ vagrant ssh
If you are using the Windows or Mac GitHub client, it should handle recursively checking out the submodules automatically. The provisioning will work even if the submodules are not checked out, but the resulting git repo will only function properly within the VM. Checking out the submodules before provisioning results in a repo that works in both the host and the VM.
To run off of beta
(which should be the base branch for most work), once connected in your VM, run:
(vm)$ cd /vagrant && make install
To run off of a different branch, first configure your tracking branch, then check it out, and then run make install:
(vm)$ cd /vagrant/www
(vm)$ git checkout other-branch
(vm)$ cd /vagrant && make install
Running make install
with the different branch checked out only really matters if your python packages or database migrations are different on that branch.
Congratulations, just after a little while, you should have a new box running with a fresh GCD development installation. Simply visit these links to test them:
- 192.168.63.30:8000 - GCD Website
- 192.168.63.30:9200 - Elasticsearch end point
- 192.168.63.30:9200/_plugin/marvel/ - Marvel access
Preinstalled accounts are:
Username | Password |
---|---|
admin | admin |
editor | editme |
[email protected] | test |
Other stuff
- The oh my zsh framework to customize your
zsh
configuration. - The tig command is installed to help you deal with
git
in command line.
If you want to load real data in your box, you can follow these steps:
- Sign in to http://www.comics.org/download/
- Download the last MySQL dump (for instance: "Data last updated: MySQL: 2015-04-15 03:40:42")
- Once the file
current.zip
is downloaded, unzip it in the root of yourgcd-django-vagrant-install
directory (for instance, you should have: 2015-04-15.sql ) - Then, if you have the file 2015-04-15.sql, execute these commands:
$ cd /path/to/your/gcd-django-vagrant-install/directory
$ vagrant ssh
(vm)$ cd /vagrant && make load-data MYSQL=2015-04-15.sql
WARNING: Indexing the public data dump takes much, much longer than loading it, so you might want to run this command overnight.
Most of the site's search features run MySQL queries directly. However, the "Everything" search and a few other places use Elasticsearch, which requires a separate search index. If you want to use Elasticsearch, run the following command to build the index.
WARNING: This command drops all existing search engine data and rebuilds it from scratch, so you generally do not want to use it unless you have completely changed your data set.
$ cd /path/to/your/gcd-django-vagrant-install/directory
$ vagrant ssh
(vm)$ cd /vagrant && make index-data
NOTE: You will need to set USE\_ELASTICSEARCH=True
in your
/vagrant/www/settings\_local.py
file in order for the site to use this index.
The gcd-django repository
is cloned at /vagrant/www
, and you can do your development work there.
See the README for that repository for a guide to the branches and other
information.
Normally, Django should pick up changes that you make automatically. However,
if you have restart it for some reason, gcd-django
is registered as an
init(8)
service, so start gcd-django
, stop gcd-django
, restart gcd-django
,
etc. all work. man initctl
for more information on the avialable commands.
You can see exactly what is going on for this in /etc/init/gcd-django.conf
You'll find your web server log in /vagrant/gcd-django.log
The virtualenv used to run the server is located at /opt/virtualenv
.
$ cd /path/to/your/gcd-django-vagrant-install/directory
$ vagrant up
(vm)$ exit
(vm)$ cd /vagrant && make help
$ cd /path/to/your/gcd-django-vagrant-install/directory
$ vagrant halt
To apply Puppet modifications (like a new theme for oh-my-zsh), run:
- If your box is halted:
$ cd /path/to/your/gcd-django-vagrant-install/directory
$ git pull
$ vagrant up --provision
- If your box is already up:
$ cd /path/to/your/gcd-django-vagrant-install/directory
$ git pull
$ vagrant provision