Skip to content

Instantly share code, notes, and snippets.

@flenter
Created September 22, 2014 09:49
Show Gist options
  • Save flenter/42e488fe0f1703ec6b05 to your computer and use it in GitHub Desktop.
Save flenter/42e488fe0f1703ec6b05 to your computer and use it in GitHub Desktop.
Fabric enabled wercker.yml
box: wercker/python
services:
- wercker/redis
# Build definition
build:
# The steps that will be executed on build
steps:
# A step that sets up the python virtual environment
- virtualenv:
name: setup virtual environment
# A step that executes `pip install` command.
- pip-install
- script:
name: flask tests
code: python app_test.py
deploy:
steps:
- add-to-known_hosts:
hostname: $EC2_HOST
# Create temp file for private key
- mktemp:
envvar: PRIVATEKEY_PATH
# Set content to temp private key file
- create-file:
name: write key
filename: $PRIVATEKEY_PATH
content: $SSH_KEY
overwrite: true
# Install fabric
- virtualenv
- pip-install:
requirements_file: ""
packages_list: "Fabric"
# Basic setup of the server: apt-get update, install packages and create
# /var/local/sites/product-demo together with python virtualenv
- script:
name: setup server
code: |
fab -f deploy/fabfile.py refresh_packages_list -H $EC2_HOST -i $PRIVATEKEY_PATH
fab -f deploy/fabfile.py install_packages -H $EC2_HOST -i $PRIVATEKEY_PATH
fab -f deploy/fabfile.py prepare_location -H $EC2_HOST -i $PRIVATEKEY_PATH
# Rsync with server.
- script:
name: sync site code
code: |
fab -f deploy/fabfile.py sync_data -H $EC2_HOST -i $PRIVATEKEY_PATH
# Update/create supervisor scripts
# Update nginx for new site
- script:
name: update and restart services
code: |
fab -f deploy/fabfile.py update_application_logic -H $EC2_HOST -i $PRIVATEKEY_PATH
fab -f deploy/fabfile.py prepare_nginx -H $EC2_HOST -i $PRIVATEKEY_PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment