Git Product home page Git Product logo

auto-deploy-image-docker-compose's Introduction

auto-deploy-image-docker-compose

The GitLab Auto-Devops deploy stage image for deploy to non-k8s server with docker-compose.

Prerequisites

  • Docker 17.06.0+ (for supporting docker-compose 3.3 format)
  • Install Traefik
  • Create docker network traefik-proxy

Setup Traefik

The quick way, remember to replace {YOUR_EMAIL} to yours:

version: "3.3"

services:

  traefik:
    image: "traefik:v2.4"
    container_name: "traefik"
    command:
    # - "--log.level=DEBUG"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
    # - "--entrypoints.web.http.redirections.entrypoint.to=websecure"
    # - "--entrypoints.web.http.redirections.entrypoint.scheme=https"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.myresolver.acme.httpchallenge=true"
      - "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web"
      - "--certificatesresolvers.myresolver.acme.email={YOUR_EMAIL}"
      - "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
    # - "--certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - "./letsencrypt:/letsencrypt"
      - "/var/run/docker.sock:/var/run/docker.sock:ro"

networks:
  default:
    external:
      name: traefik-proxy

Usage

Put below codes to your .gitlab-ci.yml and replace {YOUR_HOST_URL}.

include:
  - template: Auto-DevOps.gitlab-ci.yml

production:
  stage: production
  image: ghcr.io/larvatatw/auto-deploy-image-docker-compose:main
  variables:
    WORK_DIR: "/home/ubuntu/$CI_PROJECT_NAME/$CI_ENVIRONMENT_NAME"
  allow_failure: false
  script:
    - auto-deploy generate_docker_compose
    - auto-deploy prepare_ssh_enviroment
    - auto-deploy deploy
  rules:
    - if: '$STAGING_ENABLED'
      when: never
    - if: '$CANARY_ENABLED'
      when: never
    - if: '$INCREMENTAL_ROLLOUT_ENABLED'
      when: never
    - if: '$INCREMENTAL_ROLLOUT_MODE'
      when: never
    - if: '$CI_COMMIT_BRANCH == "master"'
      when: manual
  environment:
    name: production
    url: {YOUR_HOST_URL}

auto-deploy-image-docker-compose's People

Contributors

happiness9721 avatar zx1986 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.