Skip to content
This repository has been archived by the owner on Nov 19, 2023. It is now read-only.

Scripts to setup a local development environment for the GCD website (gcd-django) using Vagrant

License

Notifications You must be signed in to change notification settings

GrandComicsDatabase/gcd-django-vagrant-install

Repository files navigation

GCD Django Box

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.

References

Requirements

You need to install these applications:

Providers

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.

Windows users

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.

Installation

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

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:

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.

Load data

If you want to load real data in your box, you can follow these steps:

  1. Sign in to http://www.comics.org/download/
  2. Download the last MySQL dump (for instance: "Data last updated: MySQL: 2015-04-15 03:40:42")
  3. Once the file current.zip is downloaded, unzip it in the root of your gcd-django-vagrant-install directory (for instance, you should have: 2015-04-15.sql )
  4. 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

Index data for the search engine

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.

Development usage

The development tree

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.

Starting and stopping django

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

Logs

You'll find your web server log in /vagrant/gcd-django.log

Python Environment

The virtualenv used to run the server is located at /opt/virtualenv.

Daily VM usage

Start the VM

$ cd /path/to/your/gcd-django-vagrant-install/directory
$ vagrant up

Exit from the VM

(vm)$ exit

List available commands

(vm)$ cd /vagrant && make help

Stop the VM

$ cd /path/to/your/gcd-django-vagrant-install/directory
$ vagrant halt

Specific usage

Update the GCD Django Box

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

About

Scripts to setup a local development environment for the GCD website (gcd-django) using Vagrant

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published