Giter Site home page Giter Site logo

docker-compose-deployer's Introduction

Docker Compose Deployer

Deployer for your Docker Compose services

Requirements

  1. Use variable as image tag in the docker compose file

    alpine:
      image: alpine:$ALPINE_IMG_TAG
  2. Create .env file in the same folder with the docker compose file, and declare variables in the .env file

    ALPINE_IMG_TAG=3.15.0

Use cases

  1. Run command in your CD pipeline

    Usage:
      docker-compose-deployer deploy <service name> <image tag> [flags]
    
    Flags:
          --compose-v2            Use Docker Compose v2
      -f, --file stringArray      Compose configuration files
      -h, --help                  help for deploy
      -p, --project-name string   Compose project name
          --sudo                  Execute commands with sudo
      -v, --verbose               Show more output
      -w, --workdir string        Specify an alternate working directory (default ".")
  2. Start a http server, and make http request in your CD pipeline

    Usage:
      docker-compose-deployer server [flags]
    
    Flags:
          --compose-v2            Use Docker Compose v2
      -f, --file stringArray      Compose configuration files
      -h, --help                  help for server
          --port int              The server port (default 8000)
      -p, --project-name string   Compose project name
          --secret string         JWT secret
          --sudo                  Execute commands with sudo
      -v, --verbose               Show more output
      -w, --workdir string        Specify an alternate working directory (default ".")

    The server uses JWT for authorization. The payload should has following fields at least.

    {
        "sub": "alpine",
        "jti": "3.14.3",
        "iat": 1516239000
    }

    sub represents the service name and jti represents the image tag need to be deployed.

    If you are not familiar with JWT, visit jwt.io. It will generate JWT automatically after you input your secret and payload.

    Q: Why no https?

    A: We can use Nginx with SSL as a reverse proxy.

Command options

You can also see this information by running docker-compose-deployer --help from the command line.

Several environment variables are available for you to configure the command-line behavior.

Flag Environment Variable Description
--compose-v2 DEPLOYER_COMPOSE_V2 Use Docker Compose v2
-f, --file stringArray DEPLOYER_FILE Compose configuration files
-p, --port int DEPLOYER_PORT The server port
-s, --secret string DEPLOYER_SECRET JWT secret
--sudo DEPLOYER_SUDO Execute commands with sudo
-v, --verbose DEPLOYER_VERBOSE Show more output
-w, --workdir string DEPLOYER_WORKDIR Specify an alternate working directory

References

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.