The deployment process - GetmeUK/hangar51 GitHub Wiki

The deployment process

Fabric is used to deploy changes to and manage remote environments and provide a consistent interface for local and remote commands.

Fabric uses Python 2.7 but you will need to have activated the Python 3.4 virtual environment to use if for local environment tasks (this is not required when running tasks on remote environments).


Environments

There are typically 4 environments in which the application will run:

  • Local - An environment used when the application is run on a developer's own machine for development.
  • Production (prod) - A production (live) server environment where clients use the application.
  • Testing - An environment used to run tests against the application either on a local machine or on a remote server (e.g using a GitLab-ci runner). Note: the testing environment cannot be deployed to or managed with fab, it is managed by the test runner py.test in this case.

Deployment fab commands

  • deploy - Update the repo to the lastest master commit for the given environment.
  • manage (m) - Run a manage task in the given environment.
  • install_pip_requirements (pip) Install all pip requirements in the given environment.
  • start_app (up) Start the application in the given environment.
  • stop_app (down) Stop the application in the given environment.
  • cycle_app (cycle) Cycle/Restart the application in the given environment.
  • start_background_tasks (tasks_up) Start background tasks (celery) in the given environment.
  • stop_background_tasks (tasks_down) Stop background tasks (celery) in the given environment.

Running a fab command

By default you can run a fab command just by typing fab {command(s)} at the terminal, this will run that command in the default environment which is local. If you want to run a command in a different environment then you would type fab {environment} {command(s)}, for example to push changes to the production environment and restart the application you would use:

fab prod deploy cycle