Skip to content

Latest commit

 

History

History
82 lines (63 loc) · 2.09 KB

deploygen.md

File metadata and controls

82 lines (63 loc) · 2.09 KB

deploygen

deploygen is a standalone tool for deployment, using json as schema to generate one-key deployment script for machines defined in hosts.

Usage

usage:
    python deploygen.py [user] [cmd_file] [host_file] > [output]
sample:
    python deploygen.py cmd.json hosts > deploy.sh
    python deploygen.py jobs cmd.json hosts > deploy.sh

Configuration

You can write host_file like this:

192.168.1.101
192.168.1.102
192.168.1.103

Fill IP or domain for each line, and split them by newline.

A complete example of configuration file:

[
    {
        "key": "ssh",
        "value":
        [
            "cd /data/",
            "test -d tmp || mkdir -p tmp",
            "cd /var/www/html/",
            "test -f status.html || echo \"ok\" > status.html"
        ]
    },
    {
        "key": "scp",
        "value":
        [
            { "local": "nginx.tar.gz", "remote": "/data/tmp/nginx.tar.gz" },
            { "local": "upgrade.sh", "remote": "/data/tmp/" }
        ]
    },
    {
        "key": "ssh",
        "value":
        [
            "cd /data/tmp/",
            "rm -rf nginx",
            "tar -zxf nginx.tar.gz -C .",
            "cd /data/tmp/nginx/",
            "sh Config.sh",
            "make -j",
            "make install",
            "cd /data/tmp/",
            "rm -rf nginx",
            "rm -f nginx.tar.gz"
        ]
    }
]

Structure

key
value => scp_cmds or ssh_cmds
      scp_cmd

Limitation

Special tags

  • @index_place_holder : please refer to ssh_cmds

Previous

Home