|
| 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 | +
|
0 commit comments