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) host : string
DeployServer will listen this interface.
# default
'host': '0.0.0.0'
'host': 'localhost'
(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
Links
Repository: https://github.com/codex-team/deployserver
Report a bug: https://github.com/codex-team/deployserver/issues
PyPI Package: https://pypi.python.org/pypi/deployserver
CodeX Team: https://ifmo.su
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for deployserver-0.5.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee74fb7601d4be2eda87d831f49c553528378c71e60543701f70afbed2ad2a9b |
|
MD5 | c58f16a13151f0476d7f94153be40a25 |
|
BLAKE2b-256 | b0236596d8589f542bec8cd998bef796ee7576101dc01e86225894d45f341b4f |