Skip to content

wuttinanhi/autodeploy

Repository files navigation

AUTODEPLOY

a docker image listening for commit changes and automatic deploy to server.

Table of Contents

About The Project

Have you tired of SSH to your server and run deployment command?
Did you make a small project and need test on the server quickly but you don't want to setup continuous integration?
Have you tired of managing SSH key?
Well, this thing might make it easy for you.

Getting Started

To get start you need to have some Docker knowledge.
If you want to modify this repository. you need JavaScript and Node.js.

Prerequisites

Installation

docker run -it -d \
	--name="github-autodeploy" \
	--restart="always" \
	-e GITHUB_USERNAME="" \
	-e GITHUB_KEY="" \
	-e GITHUB_REPOSITORY="wuttinanhi/test-compose" \
	-e GITHUB_BRANCH="test" \
	-e DEPLOY_DIRECTORY="//autodeploy-repo" \
	-e REFRESH_RATE=30000 \
	-v /var/run/docker.sock:/var/run/docker.sock \
	-v /autodeploy:/autodeploy-repo \
	wuttinanhi/autodeploy:latest

Available Environment Variable:

GITHUB_USERNAME (Optional)
Your GitHub username.

GITHUB_KEY (Optional)
Your GitHub Personal Access Token.
You can get it at https://github.com/settings/tokens repo scope are needed.

GITHUB_REPOSITORY (Required)
Repository to listening for change.
Example value: wuttinanhi/test-compose

GITHUB_BRANCH (Required)
Branch to listening for change.
Example value: test production

DEPLOY_DIRECTORY (Optional)
Directory path for store downloaded repository.
Default value: repo
Example value: //autodeploy-repo

REFRESH_RATE (Optional)
Wait for amount of milliseconds to see changes again.
Default value: 15000
Example value: 30000 (wait for 30 seconds) 60000 (wait 1 minute)

Volume:

(REQUIRED) Socket path are needed for contact docker daemon.

  • For Windows: -v //var/run/docker.sock:/var/run/docker.sock

  • For Linux: -v /var/run/docker.sock:/var/run/docker.sock


(Optional) Volume for store downloaded repository.
*Environment variable DEPLOY_DIRECTORY and mounted path need to be the same.
Example value:

  • Relative path:
    • -e DEPLOY_DIRECTORY=repo
    • -v /autodeploy:/nodejs/repo
  • Absolute path:
    • -e DEPLOY_DIRECTORY=//autodeploy-repo
    • -v /autodeploy:/autodeploy-repo

Known issues

  • Rate limiting
    if you encounter this issue you can solve this by authentication with GITHUB_USERNAME and GITHUB_KEY
    or change the amount of REFRESH_RATE.
    reference about this issue

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch
  3. Commit your Changes
  4. Push to the Branch
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.