Code Monkey home page Code Monkey logo

ezd's Introduction

Easy Deployment

Easy deployment tool for Python application. There are mainly two parts:

  • Create a virtual environment (Optional).
  • Install your application as a service.

Deploy your application with one command!

Install

It's recommended that you install this package in the Global Python Environment.

pip install ezd

On Windows, be careful if you want to uninstall this package. Make sure all services created with this tool are removed.

Usage

Config file

Run ezd init to create a config file named deploy.json.

{
  "env": {
    "name": "venv"
  },
  "service": {
    "name": "",
    "cmd": [],
    "display": "",
    "description": ""
  }
}

A list of full parameters:

Parameter Type Description Windows Linux
env.name string The name of virtual environment. ✔️ ✔️
env.lookup string Offline package lookup directory used by pip. ✔️ ✔️
env.local string A directory contains local package file. ✔️ ✔️
env.requirement bool Whether to install dependencies in requirements.txt. Default is true. ✔️ ✔️
service.name string The name of service. ✔️ ✔️
service.cmd list[string] The command line to be executed. ✔️ ✔️
service.display string Display name of service. ✔️
service.description string Description of service. ✔️ ✔️
service.start string Start type of service (demand/auto/boot/disabled/system). Default is auto. ✔️ ✔️
service.restart int Restart delay (seconds) when service failed. Default is 30. ✔️ ✔️
service.restart_policy string Configures whether the service shall be restarted when the service exits. Default is on-failure. ✔️
service.runtime_max_sec int Configures a maximum time for the service to run. Default is 0. ✔️
service.working_directory string Configures the working directory of the service. Default is .. ✔️ ✔️
service.deps list[string] Dependencies of service. ✔️ ✔️
service.interactive bool Run service in interactive mode. Default is false. ✔️
service.user string Run service with given user. ✔️ ✔️
service.password string Password of the user. ✔️
service.delayed bool Delayed start of service. ✔️

Commands

Run ezd -h to see all commands.

usage: ezd [-h] command

Easy Deployment Tool

positional arguments:
  command     Command <init|deploy|install|uninstall|start|stop>

optional arguments:
  -h, --help  show this help message and exit

Available commands:

Command Description
init Create an example config file deploy.json.
deploy Create virtual environment and install dependencies.
install Install a service (Automatically run deploy command first).
uninstall Remove service (Automatically run stop command first).
start Start service.
stop Stop service.

Update config

Upgrade or install packages

If you need to upgrade or install packages, just edit the requirements.txt file and follow the steps below:

  1. Stop the service

    ezd stop
  2. Deploy new packages

    ezd deploy
  3. Start the service

    ezd start

Update service

If you update the service settings of the config file, you must uninstall the old service first.

  1. Uninstall the service

    ezd uninstall
  2. Install service

    ezd install
  3. Start the service

    ezd start

Examples

Jupyter notebook

Create a new nb directory and start working in it.

cd nb
echo notebook > requirements.txt
ezd init

The deploy.json file looks like this:

{
  "env": {
    "name": "venv"
  },
  "service": {
    "name": "notebook",
    "cmd": [
      "jupyter-notebook.exe"
    ],
    "display": "Jupyter Notebook",
    "description": "Jupyter Notebook Service"
  }
}

We are ready to deploy now.

ezd install
ezd start

You can now visit http://localhost:8888/ to confirm jupyter notebook is running.

Ping test

Create a new pingtest directory and start working in it.

cd pingtest
ezd init

For non-python project, we can omit virtual environment since we don't need it. The deploy.json file looks like this:

{
  "service": {
    "name": "pingtest",
    "cmd": [
      "ping",
      "-t",
      "1.1.1.1"
    ],
    "display": "Ping it",
    "description": "A ping test service"
  }
}

Deploy now!

ezd install
ezd start

Let's confirm ping is running:

$ tasklist | findstr PING
PING.EXE                     19564 Services                   0      4,540 K

ezd's People

Contributors

koho avatar mmszhezhi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.