summaryrefslogtreecommitdiff
path: root/README.md
blob: 8f6db5aabddcefa31df6096bf1d74b824781acb8 (plain)
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
108
109
110
111
About LEAP command line interface
===================================================

This gem installs an executable 'leap' that allows you to manage servers using the LEAP platform. You can read about the [platform on-line](https://leap.se).

Installation
===================================================

Install prerequisites:

    sudo apt-get install git ruby ruby-dev rsync openssh-client openssl rake

Optionally install Vagrant in order to be able to test with local virtual machines (recommended):

    sudo apt-get install vagrant virtualbox

NOTE: leap_cli should work with ruby1.8, but has only been tested using ruby1.9.

Install the `leap` command:

    sudo gem install leap_cli

Alternately, you can install `leap` from source:

    sudo apt-get install rake
    git clone git://leap.se/leap_cli.git
    cd leap_cli
    rake build

Install as root user (recommended):

    sudo rake install

Install as unprivileged user:

    rake install
    # watch out for the directory leap is installed to, then i.e.
    sudo ln -s ~/.gem/ruby/1.9.1/bin/leap /usr/local/bin/leap

With both methods, you can use now /usr/local/bin/leap, which in most cases will be in your $PATH.

To run directly from a clone of the git repo, see "Development", below.

Usage
===================================================

* Run `leap help` for a help with commands.
* Visit https://leap.se/docs/platform for tutorials and detailed documentation.

Development
===================================================

How to set up your environment for developing the ``leap`` command.

Prerequisites
---------------------------------------------------

Debian Squeeze

    sudo apt-get install git ruby ruby-dev rubygems
    sudo gem install bundler rake
    export PATH=$PATH:/var/lib/gems/1.8/bin

Debian Wheezy

    sudo apt-get install git ruby ruby-dev bundler

Ubuntu

    sudo apt-get install git ruby ruby-dev
    sudo gem install bundler

Install from git
---------------------------------------------------

Download the source:

    git clone git://leap.se/leap_cli
    cd leap_cli

Running from the source directory
---------------------------------------------------

To run the ``leap`` command directly from the source tree, you need to install
the required gems using ``bundle`` and symlink ``bin/leap`` into your path:

    cd leap_cli
    bundle                        # install required gems
    ln -s `pwd`/bin/leap ~/bin    # link executable somewhere in your bin path
    which leap                    # make sure you will run leap_cli/bin/leap
    leap help

If you get an error, make sure to check ``which leap``. Some versions of ``bundle`` will
incorrectly install a broken ``leap`` command in the gem bin directory when you do ``bundle``.

Why not use ``bundle exec leap`` to run the command? This works, so long as your current
working directory is under leap_cli. Because the point is to be able to run ``leap`` in
other places, it is easier to create the symlink. If you run ``leap`` directly, and not via
the command launcher that rubygems installs, leap will run in a mode that simulates
``bundle exec leap`` (i.e. only gems included in Gemfile are allowed to be loaded).

Future development
----------------------------------------------------

(1) remove supply_drop - our use of supply drop no longer makes sense, as our needs diverge and we have more and more patches against upstream. the supply drop code we use should be cherry picked and brought into leap_cli.

  (a) create a separate rsync library independent of capistrano or supply_drop.
  (b) do our own rsync for the puppet manifests (make sure to include --copy-links)
  (c) do our own puppet apply, with capture of exit status.

(2) remove capistrano. we don't need it, and it makes it awkward to do what we want (exit codes, different options for different hosts). either use another shell lib, or roll our own. maybe something like 'remotedly(hosts) do |host|....'