Coder Social home page Coder Social logo

telnetmanwf's Introduction

TelnetmanWF (WorkFlow)

Overview

This is a tool to create workflow with Telnetman. overview

Install

A. VM or Bare Metal

  1. install minimal CentOS7
  2. git clone https://github.com/takahiro-eno/TelnetmanWF.git
  3. cd TelnetmanWF
  4. sudo sh TelnetmanWF_install.sh
  5. cd ..
  6. rm -rf TelnetmanWF
  7. sudo reboot

https://server address/


B. Docker Container

  1. git clone https://github.com/takahiro-eno/Telnetman2.git
    git clone https://github.com/takahiro-eno/TelnetmanWF.git
  2. cd TelnetmanWF
  3. sudo docker-compose build
  4. sudo docker-compose up -d

https://host address:8443/
https://host address:9443/


C. OpenShift Origin v3.9

Structure
Demo

Make config file

  • PVC Config
cat <<EOF > telnetmanwf-pvc.yml
apiVersion: "v1"
kind: "List"
items:

- apiVersion: "v1"
  kind: "PersistentVolumeClaim"
  metadata:
   name: "telnetmanwf-database"
  spec:
   accessModes:
    - ReadWriteMany
   resources:
     requests:
          storage: 2Gi
   storageClassName: "glusterfs-storage"

- apiVersion: "v1"
  kind: "PersistentVolumeClaim"
  metadata:
   name: "telnetmanwf-file"
  spec:
   accessModes:
    - ReadWriteMany
   resources:
     requests:
          storage: 2Gi
   storageClassName: "glusterfs-storage"
EOF
  • Build config
    Set triggers arbitrarily.
cat <<EOF > telnetmanwf-build.yml
apiVersion: "v1"
kind: "List"
items:

- apiVersion: "v1"
  kind: "ImageStream"
  metadata:
    name: "telnetmanwf-db"

- apiVersion: "v1"
  kind: "ImageStream"
  metadata:
    name: "telnetmanwf-mem"

- apiVersion: "v1"
  kind: "ImageStream"
  metadata:
    name: "telnetmanwf-web"

- apiVersion: "v1"
  kind: "ImageStream"
  metadata:
    name: "telnetmanwf-cron"
  
- apiVersion: "v1"
  kind: "BuildConfig"
  metadata:
    name: "telnetmanwf-db"
  spec:
    runPolicy: "Serial"
    source: 
      type: "Git"
      git:
        uri: "https://github.com/takahiro-eno/TelnetmanWF"
        ref: "master"
      contextDir: "./"
    strategy: 
      type: "Docker"
      dockerStrategy:
        dockerfilePath: "Dockerfile-db"
    output: 
      to:
        kind: "ImageStreamTag"
        name: "telnetmanwf-db:latest"
    triggers:
      -
        type: "GitHub"
        github:
          secret: "<SECRET>"

- apiVersion: "v1"
  kind: "BuildConfig"
  metadata:
    name: "telnetmanwf-mem"
  spec:
    runPolicy: "Serial"
    source: 
      type: "Git"
      git:
        uri: "https://github.com/takahiro-eno/TelnetmanWF"
        ref: "master"
      contextDir: "./"
    strategy: 
      type: "Docker"
      dockerStrategy:
        dockerfilePath: "Dockerfile-mem"
    output: 
      to:
        kind: "ImageStreamTag"
        name: "telnetmanwf-mem:latest"
    triggers:
      -
        type: "GitHub"
        github:
          secret: "<SECRET>"

- apiVersion: "v1"
  kind: "BuildConfig"
  metadata:
    name: "telnetmanwf-web"
  spec:
    runPolicy: "Serial"
    source: 
      type: "Git"
      git:
        uri: "https://github.com/takahiro-eno/TelnetmanWF"
        ref: "master"
      contextDir: "./"
    strategy: 
      type: "Docker"
      dockerStrategy:
        dockerfilePath: "Dockerfile-web"
        env:
          - name: "SSLPORT"
            value: "8443"
          - name: "DBSERVER"
            value: "telnetmanwf"
          - name: "MEMSERVER"
            value: "telnetmanwf"
          - name: "TELNETMA2"
            value: "telnetman2"
    output: 
      to:
        kind: "ImageStreamTag"
        name: "telnetmanwf-web:latest"
    triggers:
      -
        type: "GitHub"
        github:
          secret: "<SECRET>"

- apiVersion: "v1"
  kind: "BuildConfig"
  metadata:
    name: "telnetmanwf-cron"
  spec:
    runPolicy: "Serial"
    source: 
      type: "Git"
      git:
        uri: "https://github.com/takahiro-eno/TelnetmanWF"
        ref: "master"
      contextDir: "./"
    strategy: 
      type: "Docker"
      dockerStrategy:
        dockerfilePath: "Dockerfile-openshift-cron"
        env:
          - name: "DBSERVER"
            value: "telnetmanwf"
          - name: "MEMSERVER"
            value: "telnetmanwf"
          - name: "TELNETMA2"
            value: "telnetman2"
    output: 
      to:
        kind: "ImageStreamTag"
        name: "telnetmanwf-cron:latest"
    triggers:
      -
        type: "GitHub"
        github:
          secret: "<SECRET>"
EOF
  • Deployment Config
    <Project Name> : Youer project name.
    <openshift_master_default_subdomain> : A value defined in inventory file.
cat <<EOF > telnetmanwf-deploy.yml
apiVersion: "v1"
kind: "List"
items:

- apiVersion: "v1"
  kind: "DeploymentConfig"
  metadata:
    name: "telnetmanwf"
  spec:
    template: 
      metadata:
        labels:
          name: "telnetmanwf"
      spec:
        containers:
          - name: "telnetmanwf-web"
            image: "docker-registry.default.svc:5000/<Project Name>/telnetmanwf-web:latest"
            ports:
              - containerPort: 8443
                protocol: "TCP"
              - containerPort: 8080
                protocol: "TCP"
            volumeMounts:
              - mountPath: "/var/TelnetmanWF"
                name: "telnetmanwf-file-dir"
          - name: "telnetmanwf-db"
            image: "docker-registry.default.svc:5000/<Project Name>/telnetmanwf-db:latest"
            ports:
              - containerPort: 3306
                protocol: "TCP"
            volumeMounts:
              - mountPath: "/var/lib/mysql"
                name: "telnetmanwf-database-dir"
          - name: "telnetmanwf-mem"
            image: "docker-registry.default.svc:5000/<Project Name>/telnetmanwf-mem:latest"
            ports:
              - containerPort: 11211
                protocol: "TCP"
        volumes:
          - name: "telnetmanwf-file-dir"
            persistentVolumeClaim:
              claimName: "telnetmanwf-file"
          - name: "telnetmanwf-database-dir"
            persistentVolumeClaim:
              claimName: "telnetmanwf-database"
    replicas: 1
    triggers:
      - type: "ConfigChange"
      - type: "ImageChange"
        imageChangeParams:
          automatic: true
          containerNames:
            - "telnetmanwf-web"
          from:
            kind: "ImageStreamTag"
            name: "telnetmanwf-web:latest"
      - type: "ImageChange"
        imageChangeParams:
          automatic: true
          containerNames:
            - "telnetmanwf-db"
          from:
            kind: "ImageStreamTag"
            name: "telnetmanwf-db:latest"
    strategy: 
      type: "Rolling"
    paused: false
    revisionHistoryLimit: 2 
    minReadySeconds: 0

- apiVersion: "v1"
  kind: "Service"
  metadata:
    name: "telnetmanwf"
  spec:
    ports:
    - name: "8443-tcp"
      protocol: "TCP"
      port: 8443
      targetPort: 8443
    - name: "8080-tcp"
      protocol: "TCP"
      port: 8080
      targetPort: 8080
    - name: "3306-tcp"
      protocol: "TCP"
      port: 3306
      targetPort: 3306
    - name: "11211-tcp"
      protocol: "TCP"
      port: 11211
      targetPort: 11211
    selector:
      deploymentconfig: "telnetmanwf"

- apiVersion: "v1"
  kind: "Route"
  metadata:
    name: "telnetmanwf"
  spec:
    host: "telnetmanwf-<Project Name>.<openshift_master_default_subdomain>"
    port:
      targetPort: "8080-tcp"
    tls:
      termination: "edge"
    to:
      kind: "Service"
      name: "telnetmanwf"
EOF
  • CronJob Config
    <Project Name> : Youer project name.
cat <<EOF > telnetmanwf-cron.yml
apiVersion: "v1"
kind: "List"
items:

- apiVersion: "batch/v2alpha1"
  kind: "CronJob"
  metadata:
    name: "telnetmanwf-check"
  spec:
    schedule: "*/1 * * * *"
    jobTemplate:
      spec:
        template:
          metadata:
            labels:
              parent: "telnetmanwf"
          spec:
            containers:
              - name: "telnetmanwf-check-10"
                image: "docker-registry.default.svc:5000/<Project Name>/telnetmanwf-cron:latest"
                command: ["perl", "/usr/local/TelnetmanWF/pl/check_status.pl",  "-w",  "10"]
                volumeMounts:
                  - mountPath: "/var/TelnetmanWF"
                    name: "telnetmanwf-file-dir"
              - name: "telnetmanwf-check-30"
                image: "docker-registry.default.svc:5000/<Project Name>/telnetmanwf-cron:latest"
                command: ["perl", "/usr/local/TelnetmanWF/pl/check_status.pl",  "-w",  "30"]
                volumeMounts:
                  - mountPath: "/var/TelnetmanWF"
                    name: "telnetmanwf-file-dir"
              - name: "telnetmanwf-check-50"
                image: "docker-registry.default.svc:5000/<Project Name>/telnetmanwf-cron:latest"
                command: ["perl", "/usr/local/TelnetmanWF/pl/check_status.pl",  "-w",  "50"]
                volumeMounts:
                  - mountPath: "/var/TelnetmanWF"
                    name: "telnetmanwf-file-dir"
            volumes:
              - name: "telnetmanwf-file-dir"
                persistentVolumeClaim:
                  claimName: "telnetmanwf-file"
            restartPolicy: "Never"

- apiVersion: "batch/v2alpha1"
  kind: "CronJob"
  metadata:
    name: "telnetmanwf-logrotate"
  spec:
    schedule: "42 4 1 * *"
    jobTemplate:
      spec:
        template:
          metadata:
            labels:
              parent: "telnetmanwf"
          spec:
            containers:
              - name: "telnetmanwf-logrotate"
                image: "docker-registry.default.svc:5000/<Project Name>/telnetmanwf-cron:latest"
                command: ["sh", "/usr/local/bin/logrotate.sh", "/var/TelnetmanWF/log/sql_log"]
                volumeMounts:
                  - mountPath: "/var/TelnetmanWF"
                    name: "telnetmanwf-file-dir"
            volumes:
              - name: "telnetmanwf-file-dir"
                persistentVolumeClaim:
                  claimName: "telnetmanwf-file"
            restartPolicy: "Never"
EOF
  1. oc create -f telnetmanwf-pvc.yml
  2. oc create -f telnetmanwf-build.yml
  3. oc start-build telnetmanwf-db
    oc start-build telnetmanwf-web
    oc start-build telnetmanwf-cron
    oc start-build telnetmanwf-mem
    wait for building
  4. oc create -f telnetmanwf-deploy.yml
  5. oc create -f telnetmanwf-cron.yml

https://telnetmanwf-<Project Name>.<openshift_master_default_subdomain>/

telnetmanwf's People

Contributors

takahiro-eno avatar

Watchers

James Cloos 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.