Coder Social home page Coder Social logo

cder's Introduction

publish to dockerhub

cder

Main idea is to update container instances directly from git repos or artifacts

Build

untillpro/cder:v{ver} and untillpro/cdernode:v{ver} docker containers will be created and pushed to Dockerhub on pushing tag to github (build.sh will be executed by github action). The tag should be v*.

Containers used

  • golang:1.14.0
  • node:10.16.1

Usage

  • cd command
    • Watches over git repositories and rebuilds if changed
    • Each --timeout seconds
      • --repo pulled to <--working-dir>/repos/lastURI(<--repo>) folder. The last commit differs from the stored one -> deployAll is executed
        • --extraRepo if processed
          • --extraRepo <url> form is used
            • is checked out to --workDir/ ???
            • go.mod: replace <url> => ../<lastURI(url)> appended
          • --extraRepo <urlFrom>=<urlTo> form is used
            • is checked out to --workDir/ ???
            • go.mod: replace <urlFrom> => ../<lastURI(urlTo)> appended
        • go build -o <--output>
        • stop currently executing process (if is)
          • SIGINT is sent (does nothing on windows (not supported))
          • not finished in 30 seconds -> kill
        • built exectable is moved to <--working-dir> and launched
          • --args are provided in command line
        • After deploy all repos (even those which wasn't changed) are reseted using git reset --hard
          • go.mod is reverted to original state
    • each --extraRepo url is pulled to <--working-dir>/repos/lastURI(<--extraRepo>). The last commit differs from the stored one -> deploy is executed
      • nothing is made for golang repos
    • deploy.sh used instead golang delpyer if exists at --working-dir
  • cdurl command
    • watches over specified url and executes deploy scripts if changed
    • content from --url is downloaded each --timeout seconds
      • should consist of 2 lines separated by \n
    • 1st line changed i.e. new artifact version is released
      • <--working-dir>/artifacts/<--url>/work-dir dir is recreated
      • content from 1st line url is downloaded and saved as <--working-dir>/artifacts/<--url>/<lastURI.ext>
      • unzipped to <--working-dir>/artifacts/<--url>/work-dir
      • assume 2nd line is changed
    • 2nd line changed
      • content from 2nd line url is downloaded and saved as <--working-dir>/artifacts/<--url>/work-dir/deploy.sh and executed
  • cdGotify command
    • watches over Git repositories using Gotify server and rebuilds if changed
      • push -> curl "https://gotify.untill.changeip.com/message?token=<appToken>" -F "title=<lastCommitHash>"
      • each message from Gotify server is considered as the last commit hash
      • Gotify server is pulled each --timeout seconds
      • Could not use websocket poll because Gotify replies on poll if push is made after poll start only. Pushes made right before the poll will be lost.
    • Each repo is cloned once on start. Further is the same as for cd command
    • --gToken - Gotify token to access to the server
    • --gURL - Gotify server URL
  • -v means verbose mode
  • --option1 arg1 arg2 are passed to out.exe

Custom deployer (deploy.sh)

  • deployer is executed using env command
  • Working directory is one specified by -w flag
  • First argument is one of the following:
    • stop
    • deploy
      • Executed for any changed repo
      • First argument is absolute path to changed repo
    • deploy-all
      • Executed once when any repo is changed
      • Absolute paths to ALL repositories folders are passed as arguments
  • Environment variables for deployer can be supplied with --deployer-env <name>=<value> argument

Seeding Single Repo

./cder cd --repo https://github.com/untillpro/directcd-test \
  -o directcd-test.exe \
  -t 10 \
  -w .tmp

Seeding Few Repos

./cder cd \
  --repo https://github.com/untillpro/directcd-test \
  --extraRepo https://github.com/untillpro/directcd-test-print=https://github.com/maxim-ge/directcd-test-print \
  -v \
  -o out.exe \
  -t 10 \
  -w .tmp \
  -- --option1 arg1 arg2

Seeding URL

./cder cdurl \
  --url https://github.com/untillpro/url 
  -v \
  -t 10 \
  -w .tmp \

Links

Hooks

Stop process

Misc

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.