Skip to main content

Deploy your project automatically when git branch was updated.

Project description

Deploy your project automatically when git branch was updated via GitHub or BitBucket webhooks.

Usage

Install deployserver from pip.

$ pip3 install deployserver

To start your first autodeploy daemon you need to create deploy.py script file in your project.

import deployserver


deployserver.init({
    'server_address': 'http://mydomain.com',
    'port': 1234,
    'deploy': 'cd /var/www/myProject;' \
              'git pull;'
})

To start autodeploy with multiple branches

import deployserver


deployserver.init({
    'server_address': 'http://mydomain.com',
    'port': 1234,
    'branches': [
        {
            'name': 'master',
            'script': '/var/www/myProject/master-deploy.sh'
        },
        {
            'name': 'deploy/test',
            'script': '/var/www/myProject/test-deploy.sh',
        },
        {
            'regexp': r'feature/.*',
            'script': '/var/www/myProject/feature-deploy.sh'
        }
    ]
})

Then you need to run this script.

$ python3 deploy.py

If you want to run autodeploy daemon in background, use Screen.

$ screen -dmS deployserver_myProject python3 deploy.py

Screen docs: https://www.gnu.org/software/screen/manual/screen.html

Initial params

For initiation deployserver params dict is required.

server_address : string

Enter a domain name for this server with http protocol.

'server_address': 'http://mydomain.com'
'server_address': 'http://8.8.8.8'
'server_address': 'http://0a1b2c3d.ngrok.io'

port : integer

deployserver will listen this local port.

'port': 2345

deploy : string

Bash commands sequence which should be initiated on branch update.

'deploy': 'cd /var/www/myProject;' \
          'git pull;'
'deploy': '/var/www/myProject/deploy.sh'

(optional) branch : string

Which branch push event should initiate deploy function.

# default
'branch': 'master'
'branch': 'current-sprint'
'branch': 'ver2'

(optional) uri : string

Callback uri.

# default
'uri': '/callback'
'uri': '/'

(optional) secret_token : string

Secret token. Check if it is set.

# default
'secret_token': None
'secret_token': 'a96529a4af7864e7f6e11035d10b7db5'

Requirements

  • Python >= 3.5

  • aiohttp

  • asyncio

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deployserver-0.5.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

deployserver-0.5.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file deployserver-0.5.0.tar.gz.

File metadata

  • Download URL: deployserver-0.5.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.9.1 pkginfo/1.4.1 requests/2.18.4 setuptools/38.4.0 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.5.2

File hashes

Hashes for deployserver-0.5.0.tar.gz
Algorithm Hash digest
SHA256 2e9ed7be8a8a25ee0189e8acf3aaba7b9acbec3430cc40724b204c65377f144e
MD5 daa387d0beb260e463dd0fba0c8ab4c9
BLAKE2b-256 5db182be17e04243e686247d6f80decfc54761828cc62cdce385be5e212a8b42

See more details on using hashes here.

File details

Details for the file deployserver-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: deployserver-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.9.1 pkginfo/1.4.1 requests/2.18.4 setuptools/38.4.0 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.5.2

File hashes

Hashes for deployserver-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d9f4fe2437ebc6671acb0af233698eaedb8c57878d428a2b9bcc889fa0dd0011
MD5 e193dbae3a28c849dae0bb3a5622a0c8
BLAKE2b-256 5d7668a0f53a0d12251ab8ef880bdbc306f18bb7689b38f8c00dacec245c2a58

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page