Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion docs/scenarios/admin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,42 @@ Systems Administration
Fabric
------

.. todo:: Write about Fabric
Fabric is a library for simplifying system administration tasks. While Chef
and Puppet tend to focus on managing servers and system libraries,
fabric is more focused on application level tasks such as deployment.

Install Fabric:

::

pip install fabric

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throughout the rest of the guide, we use $ as an indicator of a shell command, we should try to do so here, too. You can also do .. code-block:: bash to get shell syntax highlighting.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

been driving me crazy :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in the updated pull request. I thought I had got all of them, but apparently missed one.

@dcrosta thanks for the code-block note, I have done little work in Sphinx before and was unaware.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to help! That's what we're here for.


The following code will ssh into both of our servers, cd to our project
directory, activate the virtual environment, pull the newest codebase,
and restart the application server.

::

from fabric.api import cd, env, prefix, run, task

env.hosts = ['my_server1', 'my_server2']

@task
def deploy():
with cd('/var/www/project-env/project'):
with prefix('. ../bin/activate'):
run('git pull')
run('touch app.wsgi')

With the previous code saved in a file named fabfile.py, we merely need to run
the following command to deploy our application to both of our servers.

::

$ fab deploy

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay dollar sign!


Additional features include parallel execution, interaction with remote
programs, and host grouping.

Chef
----
Expand Down