GithubHelp home page GithubHelp logo

attendance-slack's Introduction

attendance-slack

Usage

setup

起動

  • 設定ファイルの編集

    $ cp envfile.sample envfile
    # envfileはDocker用の環境変数
    # localで起動するときはexportで設定するように修正する
    $ [editor] envfile

docker

dockerhubにupload済みのdocker imageで起動

localからdocker imageを作成して起動

  • image作成

    $ docker build -t [image_name]:[tag_name] .
  • 起動

    $ docker run --env-file=envfile [image_name]:[tag_name]

local

  • 起動

    $ source envfile_local
    $ python run.sh

Kubernetes

検証したkubectlのversionは v1.18.0

secret.yamlの生成

$ cp kubernetes/base/secret_sample.yaml kubernetes/base/secret.yaml
# echo -n [value] | base64 でencode dataをenvfile.sampleに相当する値を生成する
$ [editor] kubernetes/base/secret.yaml

secret.yamlのdata/akashi_user_infoの更新

  • akashi_user_infoはuser:tokenの組み合わせ(dict)になっている

  • 以下のことを想定してツールを/bin配下に設置している

    1. 登録するユーザが増える
    2. 登録していたユーザを削除する
    3. 登録しているユーザのtokenを更新する(akashiのtokenは1ヶ月でexpireされる)
    4. etc...
  • 各種ツールの使い方は --help で参照

    $ poetry run python bin/append_user.py --help
    usage: append_user.py [-h] -c CONFIG -n NAME -t TOKEN [-r]
    
    optional arguments:
      -h, --help            show this help message and exit
      -c CONFIG, --config CONFIG
                            k8sのsecret yamlのファイルパス
      -n NAME, --name NAME  追加するuser名
      -t TOKEN, --token TOKEN
                            userのtoken
      -r, --raw             user情報をjsonのまま出力する

Kubernetesへのデプロイ

$ kubectl kustomize kubernetes/base | kubectl apply -f -

Kubernetesのリソース削除

$ kubectl kustomize kubernetes/base | kubectl delete -f -

slackでの使い方

  • botにメンションをつけて特定のmessageを付与する
  • plugin.pyの @respond_to を編集することでmessageの編集ができる
  • 以下はSlack内の例
    出勤の例

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.