-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Adding Fabric overview and example #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
|
||
| 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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
| ---- | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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:: bashto get shell syntax highlighting.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
been driving me crazy :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4c68f91
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.