Commands¶
Usage¶
fab <run_local/run_stage/run_live> <command_name>List Commands - shows the list of all available fab commands
fab -l
Install Requirements¶
To install the requirements on your local system:
fab run_local activate_env_install_requirements (or) fab activate_env_install_requirements
To install the requirements on your remote staging servers:
fab run_stage activate_env_install_requirements
To install the requirements on your remote live servers:
fab run_live activate_env_install_requirements
Rsync project to remote server(stage/live)¶
To rsync project local files to remote destination server -
with settings file -
fab <run_stage/run_live> rsync_with_settingswithout settings file -
fab <run_stage/run_live> rsync_without_settings
Deploy To Server¶
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)
fab <run_stage/run_live> deploy_to_serverBy default, this command rsyncs project files without settings file and runs touch command for project uwsgi file under /etc/uwsgi/vassals/ folder.
To rsync with settings file and to run uwsgi in debug mode:
fab <run_stage/run_live> deploy_to_server:sync_with_setting='true',debug='true'Note
It automatically creates project_root, env in server if not exists
Local database backup¶
fab take_local_backup
Server database backup¶
fab <run_stage/run_live> take_server_backup
Restore Server database to Local¶
fab <run_stage/run_live> take_server_backup
fab restore_to_local
Reset Local database¶
fab reset_local_db
Reset Server database¶
fab <run_stage/run_live> reset_server_db
Run Management Commands¶
This function is used to run management commands -
fab <run_local/run_stage/run_live> manage_py:<management_command_name>
To apply migrations
fab <run_local/run_stage/run_live> migrateExecute collect static
fab <run_local/run_stage/run_live> collect_staticRebuild search index
fab <run_local/run_stage/run_live> rebuild_indexTo restart celery in remote servers
fab <run_stage/run_live> restart_celeryTo restart supervisorctl in remote servers
fab <run_stage/run_live> restart_supervisiorTo restart uwsgi in remote servers
fab <run_stage/run_live> restart_uwsgiTo restart remote servers
fab <run_stage/run_live> restart_server