Skip to main content

deployserver

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

Webhooks

Currently support three types of webhooks:

Custom Webhooks

Send HTTP POST request to the callback URL with JSON payload.

{
    "branch": "master",
}

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) host : string

deployserver will listen this local address (default 0.0.0.0).

'host': '127.0.0.1'

(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

Release files for deployserver 0.5.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for deployserver 0.5.2
File Size Uploaded
deployserver-0.5.2.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for deployserver 0.5.2
File Interpreter ABI Platform
deployserver-0.5.2-py3-none-any.whl Python 3 none any Details

Total release size: 11.1 kB

Release files / deployserver-0.5.2.tar.gz

Download URL deployserver-0.5.2.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8a7cdcc73ee9148e80f35a4df6342e1836dcb1daa0ca87937beaf8853c1fdd21
BLAKE2b-256 checksum
How to use checksums
3bdebf7404d5549a8180569c3590f9484c46c176610c673c06cc9b6be5fa5985
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.1

Release files / deployserver-0.5.2-py3-none-any.whl

Download URL deployserver-0.5.2-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
46099c8641b24f3f1cc782ffcbdf459b2724d2df74d008b264916415c0b44c64
BLAKE2b-256 checksum
How to use checksums
b9201f1a3ea9d2eadcd3c5729748bfa2425415085c4d016cf37e81d60efec872
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.1

Release history Release notifications | RSS feed

This release

0.5.2 This release

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

3 release files

0.3.1

2 release files

0.2.0

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page