~jcsackett/charmworld/bac-tag-constraints

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
=====================
Hacking on Charmworld
=====================


Adding Dependency
=================

Charmworld uses virtualenv to isolate the environment. In order to add a new
package as a requirement you need to add it to the `requirements.txt` file and
make sure you lock the version.

The make target `make deps` will then install the new dependency.

*Note* The package must exist in the download cache. See `lp:~juju-jitsu/charmworld/download-cache`.

CSS Work
========

CSS is a `theme`_'d version of `Bootstrap`_. It requires a less compiler to
build the css. The single css file, `css/theme.css` is generated from the
`css/theme.less` file using the make target `make css`. All overrides should
be placed into the bottom of the `theme.less` file or you can change variables
defined in `variables.less`.

Helpful CSS working links:

- http://lesscss.org/
- http://bootstrap.lesscss.ru/less.html
- http://stackoverflow.com/questions/10451317/twitter-bootstrap-customization-best-practices

Auto Updating
-------------
You can use a cool like `watchdog`_ to auto update the css when you're hacking
on it. A sample watchdog command would be:

::

    bin/watchmedo shell-command \
    --patterns="*.less" \
    --command='make css' charmworld/static/css/


.. _Bootstrap: http://bootstrap.lesscss.ru/
.. _theme: http://bootswatch.com/united/
.. _watchdog: http://pypi.python.org/pypi/watchdog


Hacking with Canonistack
------------------------

::

    # Canonistack
    $ source ~/.canonistack/novarc
    $ juju bootstrap
    $ juju status

    # Wait for environment to come up
    $ juju deploy mongodb --constraints instance-type=m1.small
    $ juju set mongodb dbpath=/mnt/mongodb
    $ juju deploy cs:~charming-dev/precise/elasticsearch --constraints instance-type=m1.small
    $ juju deploy cs:~juju-jitsu/precise/charmworld --constraints instance-type=m1.small
    $ juju set charmworld error-email=<your email address>
    $ juju add-relation charmworld mongodb
    $ juju add-relation charmworld elasticsearch:essearch

    # If giving a public address (which is rare)
    $ juju expose charmworld
    $ euca-describe-instances
    $ euca-associate-address -i i-XXXXX XX.XX.XX.XX

    # Wait 15-20 minutes to complete the first ingest.
    $ sshuttle -r <charmworld ip> <charmworld ip>


Hacking with local (lxc)
------------------------

::

    $ juju bootstrap
    $ juju status
    $ juju deploy mongodb
    $ juju set mongodb dbpath=/mnt/mongodb
    $ juju deploy cs:~charming-dev/precise/elasticsearch
    $ juju deploy cs:~juju-jitsu/precise/charmworld
    $ juju set charmworld error-email=<your email address>
    $ juju add-relation charmworld mongodb
    $ juju add-relation charmworld elasticsearch:essearch

    # Wait 15-20 minutes to complete the first ingest.
    $ sshuttle -r <charmworld ip> <charmworld ip>


Hacking locally
---------------

Running locally will install a number of packages, but if you don't mind it is
a fine way to proceed.

::
    $ make sysdeps
    $ make install
    $ make run
    $ bin/enqueue --prefix=~charmers/charms/precise
    $ bin/ingest-queue