Skip to content

Commit

Permalink
Updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rmed committed Sep 22, 2015
1 parent a612927 commit 4716a71
Show file tree
Hide file tree
Showing 7 changed files with 135 additions and 48 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ __pycache__/
# Distribution / packaging
.Python
env/
.env
build/
develop-eggs/
dist/
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 0.3.0 - Sep 22nd, 2015

### Added
- Allow connecting with password instead of public key
- Added `use-password` and `password` fields to deployment file

### Changed
- Improved output format
- Changed how remote command output is displayed


## 0.2.0 - May 9th, 2015

### Added
Expand Down
93 changes: 73 additions & 20 deletions docs/deployment_file.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Deployment file

The deployment file is named `fumi.yml` and should be located in the root directory of the project. This file follows standard YAML syntax, so it should not be too difficult to modify manually.
The deployment file is named `fumi.yml` and should be located in the root
directory of the project. This file follows standard YAML syntax, so it should
not be too difficult to modify manually.

---

Expand All @@ -18,7 +20,10 @@ chibi:
deploy-path: /home/yangtze
```
Here, we specify that we want to upload our project from a local directory (which happens to be the directory that contains `fumi.yml`), that our remote server can be accessed from `wu.site` with user `zhuge` and that the [deployment path](quickstart.md#the-deployment-directory).
Here, we specify that we want to upload our project from a local directory
(which happens to be the directory that contains `fumi.yml`), that our remote
server can be accessed from `wu.site` with user `zhuge` and that the
[deployment path](quickstart.md#the-deployment-directory).

Of course, you may have as many deployment configurations as you want:

Expand Down Expand Up @@ -50,14 +55,16 @@ These fields must be present for *fumi* to work.

### **source-type**

The `source-type` is used to find which basic actions must be taken in order to get the project into the remote server. Available types are:
The `source-type` is used to find which basic actions must be taken in order to
get the project into the remote server. Available types are:

- **local**: compress local directory and upload it to server through SSH.
- **git**: clone a git repository directly in the remote server.

### **source-path**

The `source-path` is used to tell *fumi* where to get the project from. Depending on the `source-type`:
The `source-path` is used to tell *fumi* where to get the project from.
Depending on the `source-type`:

- **local**: local directory in which the source can be found (usuarlly specifying the current directory with `.` is enough).
- **git**: the git url needed for the `git clone URL` command to be executed in the server.
Expand All @@ -68,11 +75,14 @@ The remote `host` that *fumi* must connect to. Make sure SSH is enabled!

### **user**

User that will be in charge of performing the deployments. You may want to create a special user for this, just in case.
User that will be in charge of performing the deployments. You may want to
create a special user for this, just in case.

### **deploy-path**

The directory that will contain current deployment and past revisions as detailed in the [deployment directory section](quickstart.md#the-deployment-directory).
The directory that will contain current deployment and past revisions as
detailed in the [deployment directory
section](quickstart.md#the-deployment-directory).

---

Expand All @@ -82,23 +92,32 @@ These fields are optional, but may be helpful in most cases.

### **default**

The `default` field will allow you to run `fumi deploy` without specifying a configuration name. If you choose to specify it manually, add the following to any configuration:
The `default` field will allow you to run `fumi deploy` without specifying
a configuration name. If you choose to specify it manually, add the following
to any configuration:

default: true

Note that *fumi* will obtain the list of configurations alphabetically, so take that into account if you write the field in several configurations.
Note that *fumi* will obtain the list of configurations alphabetically, so take
that into account if you write the field in several configurations.

### **host-tmp**

By default, when using the `local` source type, the compressed source will be uploaded to `/tmp`. With this field you can specify the directory in which to upload the file instead.
By default, when using the `local` source type, the compressed source will be
uploaded to `/tmp`. With this field you can specify the directory in which to
upload the file instead.

### **keep-max**

Integer number that can be used to specify the maximum number of revisions to keep in the `rev` directory. After deploying, *fumi* will check this number and the number of revisions stored remotely and remove several of them until the maximum allowed is satisfied.
Integer number that can be used to specify the maximum number of revisions to
keep in the `rev` directory. After deploying, *fumi* will check this number and
the number of revisions stored remotely and remove several of them until the
maximum allowed is satisfied.

### **predep**

Pre-deployment commands. These commands are executed before uploading/cloning the source in the remote server. This field has a structure similar to:
Pre-deployment commands. These commands are executed before uploading/cloning
the source in the remote server. This field has a structure similar to:

```yaml
predep:
Expand All @@ -107,15 +126,21 @@ predep:
- remote: 'service apache stop'
```

The order in this list will be preserved at the time of execution of the commands, so it is possible to alternate between local and remote commands easily.
The order in this list will be preserved at the time of execution of the
commands, so it is possible to alternate between local and remote commands
easily.

Local commands are executed **relative to the current directory** while remote commands are executed **relative to the user's directory**.
Local commands are executed **relative to the current directory** while remote
commands are executed **relative to the user's directory**.

Following YAML convention, the command should be escaped with single quotes in order to parse it as a raw string.
Following YAML convention, the command should be escaped with single quotes in
order to parse it as a raw string.

### **postdep**

Post-deployment commands. These commands are executed after the source has been uploaded/cloned in the server and linked to the `current` directory. An usage example of this field would be when deploying a ruby on rails application:
Post-deployment commands. These commands are executed after the source has been
uploaded/cloned in the server and linked to the `current` directory. Here is an
example for a ruby on rails application:

```yaml
postdep:
Expand All @@ -125,15 +150,23 @@ postdep:
- remote: 'touch tmp/restart.txt'
```

The order in this list will be preserved at the time of execution of the commands, so it is possible to alternate between local and remote commands easily.
The order in this list will be preserved at the time of execution of the
commands, so it is possible to alternate between local and remote commands
easily.

Local commands are executed **relative to the current directory**, while remote commands are executed **relative to directory of current deployment** (`current`)
Local commands are executed **relative to the current directory**, while remote
commands are executed **relative to directory of current deployment**
(`current`)

Following YAML convention, the command should be escaped with single quotes in order to parse it as a raw string.
Following YAML convention, the command should be escaped with single quotes in
order to parse it as a raw string.

### **local-ignore**

Use this field if you are performing a *local* deployment type and you want *fumi* to ignore specific files and/or directories when compressing the source. For instance, this is how this field would look like for a project such as *fumi*:
Use this field if you are performing a *local* deployment type and you want
*fumi* to ignore specific files and/or directories when compressing the source.
For instance, this is how this field would look like for a project such as
*fumi*:

```yaml
local-ignore:
Expand All @@ -145,4 +178,24 @@ local-ignore:
- fumi.yml
```

This way, directories `.git`, `docs`, `build`, `dist` and files `.gitignore`, `fumi.yml` will not be added to the compressed file.
This way, directories `.git`, `docs`, `build`, `dist` and files `.gitignore`,
`fumi.yml` will not be added to the compressed file.

### **use-password**

*Introduced in 0.3.0*

This boolean field indicates whether a password will be used to connect or not.
If this field is not present, its value **defaults to `false`**, meaning that
*fumi* will rely on public key authentication.

If the field is set to `true`, then you may either specify the password using
the `password` field or manually introduce it when deploying.

### **password**

*Introduced in 0.3.0*

The password needed to connect to the server. Note that if `use-password` is
set to `true` and you do not provide the password (e.g. so it is not included
in version control), you will be asked for the password in each deployment.
12 changes: 8 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,25 @@

A small and (hopefully) simple deploying tool.

Source code available at [https://github.com/rmed/fumi](https://github.com/rmed/fumi)
Source code available at
[https://github.com/rmed/fumi](https://github.com/rmed/fumi)

---

## Installation

*fumi* is available in the Python Package Index. In order to install it, you can use **pip**:
*fumi* is available in the Python Package Index. In order to install it, you
can use **pip**:

$ pip install fumi

It is also possible to install *fumi* manually by downloading and extracting the source and running:
It is also possible to install *fumi* manually by downloading and extracting
the source and running:

$ python setup.py install

Note that *fumi* is compatible with Python >= 2.6 and Python 3 (tested with 2.7 and 3.4), so you may use `pip3`, `python3`, etc in order to install.
The code is compatible with Python >= 2.6 and Python 3+ (tested with 2.7 and
3.4), so you may use `pip3`, `python3`, etc in order to install.

In addition, the following dependencies will be installed:

Expand Down
34 changes: 25 additions & 9 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Quickstart

This section covers the (fast) setup of a deployment configuration and the deployment of your project using that configuration. Check the [installation section](index.md#installation) for installation instructions.
This section covers the (fast) setup of a deployment configuration and the
deployment of your project using that configuration. Check the [installation
section](index.md#installation) for installation instructions.

## Commands

Expand All @@ -11,13 +13,15 @@ This section covers the (fast) setup of a deployment configuration and the deplo
- **new**: create a new deployment configuration with the bare minimum
- **remove**: remove an existing configuration.

You will most likely be using `deploy` the most, so you just need to remember that you can use it in two ways:
You will most likely be using `deploy` the most, so you just need to remember
that you can use it in two ways:

By simply running:

$ fumi deploy

in your project's directory, which will use the default configuration, or ask you for a default configuration.
in your project's directory, which will use the default configuration, or ask
you for a default one.


Or by running:
Expand All @@ -34,7 +38,10 @@ In order to create a basic configuration with the bare minimum:

$ fumi new CONF

This will create a `CONF` configuration in the `fumi.yml` file that you can adapt to your project's needs. However, you should take a look at the [structure of the deployment file](deployment_file.md) for advanced options and details.
This will create a `CONF` configuration in the `fumi.yml` file that you can
adapt to your project's needs. However, you should take a look at the
[structure of the deployment file](deployment_file.md) for advanced options and
details.

---

Expand All @@ -44,7 +51,8 @@ Once you are happy with your configuration, run:

$ fumi deploy CONF

to make your first deployment. Remember that you can also set it as default by running:
to make your first deployment. Remember that you can also set it as default by
running:

$ fumi deploy

Expand All @@ -63,14 +71,22 @@ The remote deployment directory has the following structure:
20150329183900/
YOUR_PROJECT_FILES

Each time you deploy your project, a new revision will be created in the `rev` directory, using timestamp of the deployment as name. This directory is then *symlinked* to the `current` directory, which is were the live version of your project can be accessed from.
Each time you deploy your project, a new revision will be created in the `rev`
directory, using timestamp of the deployment as name. This directory is then
*symlinked* to the `current` directory, which is were the live version of your
project can be accessed from.

---

## Things to consider

*fumi* performs deployments through SSH. You may notice that you are not asked for a password when deploying a project. This is due to *fumi* expecting your public key configured in the remote server.
*fumi* performs deployments through SSH. Since version 0.3.0, it is possible to
specify a password for the connection in the configuration file or introduce it
when deploying. Public key authentication is also available.

The tool is language-agnostic, hence it is up to you to decide how your project must be deployed and what commands to execute in the remote host (or locally) before and after deployment.
The tool is language-agnostic, hence it is up to you to decide how your project
must be deployed and what commands to execute in the remote host (or locally)
before and after deployment.

You will not be prompted for superuser password if you issue a *sudo* command or similar.
You will not be prompted for superuser password if you issue a *sudo* command
or similar.
30 changes: 16 additions & 14 deletions fumi/fumi.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import yaml
if sys.version[0] == "3": raw_input=input

__version__ = "0.2.1"
__version__ = "0.3.0"

CWD = os.getcwd()
DEP_CONF = os.path.join(CWD, 'fumi.yml')
Expand Down Expand Up @@ -149,21 +149,23 @@ def new_config(name):
sys.exit("Configuration '%s' already exists" % name)

content[name] = {
"source-type": "",
"source-path": "",
"source-type" : "",
"source-path" : "",

"predep": {
"local": None,
"remote": None
"predep" : {
"local" : None,
"remote" : None
},
"postdep": {
"local": None,
"remote": None
"postdep" : {
"local" : None,
"remote" : None
},

"host": "",
"user": "",
"deploy-path": "",
"host" : "",
"user" : "",
"use-password" : True,
"password" : "",
"deploy-path" : "",
}

write_yaml(content)
Expand Down Expand Up @@ -196,7 +198,7 @@ def read_yaml():
try:
content = yaml.load(fumi_yml)

except (yaml.YAMLError, e):
except yaml.YAMLError as e:
sys.exit("Error in deployment file:", e)

return content
Expand All @@ -209,7 +211,7 @@ def write_yaml(content):
try:
yaml.dump(content, fumi_yml, default_flow_style=False)

except (yaml.YAMLError, e):
except yaml.YAMLError as e:
sys.exit("Error writing yaml to deployment file:", e)

def init_parser():
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

setup(
name='fumi',
version='0.2.1',
version='0.3.0',

description='A small and (hopefully) simple deployment tool',
long_description=long_description,
Expand Down

0 comments on commit 4716a71

Please sign in to comment.