Skip to content
This repository was archived by the owner on Jan 7, 2022. It is now read-only.

Commit e214f18

Browse files
shirishagaddiashwin31
authored andcommitted
Added documentation - features, installation, setup and list of all functions (#5)
1 parent 7662688 commit e214f18

File tree

6 files changed

+272
-9
lines changed

6 files changed

+272
-9
lines changed

docs/source/commands.rst

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
Commands
2+
===========
3+
4+
Usage
5+
-------
6+
7+
.. code-block:: python
8+
9+
fab <run_local/run_stage/run_live> <command_name>
10+
11+
12+
**List Commands** - shows the list of all available fab commands
13+
14+
15+
.. code-block:: python
16+
17+
fab -l
18+
19+
20+
Install Requirements
21+
----------------------
22+
23+
* To install the requirements on your local system:
24+
25+
.. code-block:: python
26+
27+
fab run_local activate_env_install_requirements
28+
29+
(or)
30+
31+
fab activate_env_install_requirements
32+
33+
* To install the requirements on your remote staging servers:
34+
35+
.. code-block:: python
36+
37+
fab run_stage activate_env_install_requirements
38+
39+
* To install the requirements on your remote live servers:
40+
41+
.. code-block:: python
42+
43+
fab run_live activate_env_install_requirements
44+
45+
46+
Rsync project to remote server(stage/live)
47+
---------------------------------------------
48+
49+
To rsync project local files to remote destination server -
50+
51+
* with settings file -
52+
53+
.. code-block:: python
54+
55+
fab <run_stage/run_live> rsync_with_settings
56+
57+
* without settings file -
58+
59+
.. code-block:: python
60+
61+
fab <run_stage/run_live> rsync_without_settings
62+
63+
64+
Deploy To Server
65+
------------------
66+
67+
This commands copy local project files to destination(stage/live) servers, installs requirements, applies migrations and finally runs uWSGI server(both in debug and deployment modes)
68+
69+
.. code-block:: python
70+
71+
fab <run_stage/run_live> deploy_to_server
72+
73+
By default, this command rsyncs project files without settings file and runs touch command for project uwsgi file under /etc/uwsgi/vassals/ folder.
74+
75+
* To rsync with settings file and to run uwsgi in debug mode:
76+
77+
.. code-block:: python
78+
79+
fab <run_stage/run_live> deploy_to_server:sync_with_setting='true',debug='true'
80+
81+
82+
.. note::
83+
84+
It automatically creates project_root, env in server if not exists
85+
86+
87+
Local database backup
88+
-----------------------
89+
90+
.. code-block:: python
91+
92+
fab take_local_backup
93+
94+
95+
Server database backup
96+
------------------------
97+
98+
.. code-block:: python
99+
100+
fab <run_stage/run_live> take_server_backup
101+
102+
103+
Restore Server database to Local
104+
---------------------------------
105+
106+
.. code-block:: python
107+
108+
fab <run_stage/run_live> take_server_backup
109+
fab restore_to_local
110+
111+
112+
Reset Local database
113+
-----------------------
114+
115+
.. code-block:: python
116+
117+
fab reset_local_db
118+
119+
120+
Reset Server database
121+
-----------------------
122+
123+
.. code-block:: python
124+
125+
fab <run_stage/run_live> reset_server_db
126+
127+
128+
Run Management Commands
129+
--------------------------
130+
131+
This function is used to run management commands -
132+
133+
.. code-block:: python
134+
135+
fab <run_local/run_stage/run_live> manage_py:<management_command_name>
136+
137+
* To apply migrations
138+
139+
.. code-block:: python
140+
141+
fab <run_local/run_stage/run_live> migrate
142+
143+
* Execute collect static
144+
145+
.. code-block:: python
146+
147+
fab <run_local/run_stage/run_live> collect_static
148+
149+
* Rebuild search index
150+
151+
.. code-block:: python
152+
153+
fab <run_local/run_stage/run_live> rebuild_index
154+
155+
* To restart celery in remote servers
156+
157+
.. code-block:: python
158+
159+
fab <run_stage/run_live> restart_celery
160+
161+
* To restart supervisorctl in remote servers
162+
163+
.. code-block:: python
164+
165+
fab <run_stage/run_live> restart_supervisior
166+
167+
* To restart uwsgi in remote servers
168+
169+
.. code-block:: python
170+
171+
fab <run_stage/run_live> restart_uwsgi
172+
173+
* To restart remote servers
174+
175+
.. code-block:: python
176+
177+
fab <run_stage/run_live> restart_server
178+

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
# The theme to use for HTML and HTML Help pages. See the documentation for
120120
# a list of builtin themes.
121121
#
122-
html_theme = 'alabaster'
122+
html_theme = 'sphinx_rtd_theme'
123123

124124
# Theme options are theme-specific and customize the look and feel of a theme
125125
# further. For a list of options available for each theme, see the

docs/source/configuration.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Setup
2+
=========
3+
4+
* First, create an YAML file similar to `sample_config.yaml`_ and fill the configuration details.
5+
6+
* Next, create a file named :code:`fabfile.py` in your project directory and import all functions(fab commands/tasks) from `django_spanner`.
7+
8+
* Finally, call the :code:`setup()` function with your configuration yaml file path.
9+
10+
11+
**Here is an example fabfile** -
12+
13+
.. code-block:: python
14+
15+
# fabfile.py
16+
from django_spanner.commands import *
17+
setup("config_file_name.yaml")
18+
19+
20+
.. _`sample_config.yaml`: https://github.com/MicroPyramid/django-spanner/blob/master/django_spanner/sample_config.yaml
21+

docs/source/features.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Features
2+
===========
3+
4+
* Install requirements in a virtualenv.
5+
* Migrate database.
6+
* Execute any management command.
7+
* Rsync files to destination server(stage/live) with and without settings file.
8+
* Deploy the django application to server(Installs requirements, migrates database, rsync files, runs uwsgi server).
9+
* Take database backups(server backups as well as local).
10+
* Restore local and server databases.
11+
* Reset local and server databases.
12+
* Restart server, celery, supervisor, uwsgi.
13+
* Rebuild index, collect static.
14+
15+
16+
.. note::
17+
18+
You can execute all these commands in local as well as remote servers.
19+

docs/source/index.rst

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,49 @@
33
You can adapt this file completely to your liking, but it should at least
44
contain the root `toctree` directive.
55
6-
Welcome to django_spanner's documentation!
7-
==========================================
86
9-
Contents:
7+
Django Spanner
8+
================
9+
10+
Django Spanner is a simple package used to deploy and manage `Django`_ applications. Django Spanner is a set of commands used to deploy and manage django projects. It internally uses `Fabric`_. This can also be called as **Deploying Django with Fabric**.
11+
12+
* You can use this to deploy & manage any django application with just few configurations. Configure once and run many times.
13+
14+
* As well as you can deploy & manage single django application on multiple remote servers (multiple staging servers, multiple live servers). You can specify different configuration for each type of server (stage/live) like here `sample config file`_
15+
16+
* Also used to manage local django project to install requirements, run make migrations, migrate, take database backups and many more...
17+
18+
19+
This package is developed by `MicroPyramid`_ team. Please refer the `github repository`_ for the django-spanner source code. It's free and open source.
20+
21+
22+
Github Repository
23+
********************
24+
25+
Django Spanner - `https://github.com/MicroPyramid/django-spanner`_
26+
27+
28+
Contents
29+
----------
1030

1131
.. toctree::
1232
:maxdepth: 2
1333

34+
features
35+
installation
36+
configuration
37+
commands
38+
39+
40+
.. _`Django`: https://www.djangoproject.com/
41+
42+
.. _`Fabric`: http://www.fabfile.org/
43+
44+
.. _`MicroPyramid`: https://micropyramid.com/
1445

46+
.. _`github repository`: https://github.com/MicroPyramid/django-spanner
1547

16-
Indices and tables
17-
==================
48+
.. _`https://github.com/MicroPyramid/django-spanner`: https://github.com/MicroPyramid/django-spanner
1849

19-
* :ref:`genindex`
20-
* :ref:`modindex`
21-
* :ref:`search`
50+
.. _`sample config file`: https://github.com/MicroPyramid/django-spanner/blob/master/django_spanner/sample_config.yaml
2251

docs/source/installation.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Installation
2+
=============
3+
4+
The recommended way to install the django-spanner into a virtualenv using pip::
5+
6+
pip install django-spanner
7+
8+
9+
Or, install using the latest version from GitHub::
10+
11+
git clone https://github.com/MicroPyramid/django-spanner.git
12+
13+
cd django_spanner
14+
15+
python setup.py install
16+

0 commit comments

Comments
 (0)