-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ stagingブランチを設定する事でstaging環境でデプロイされるように #2488
base: master
Are you sure you want to change the base?
Conversation
https://github.com/traPtitech/traQ/blob/master/.github/workflows/master.yml#L6 これここに一行 |
タグ変えてるのか(というかmaster固定なのか) |
#2488 (comment) |
.github/workflows/master.yml
Outdated
if: ${{ github.event.inputs.commit != '' }} | ||
run: echo "TRAQ_REVISION=${{ github.event.inputs.commit }}" >> $GITHUB_ENV | ||
- name: Set TRAQ_REVISION env (fallback) | ||
if: ${{ github.event.inputs.commit == '' }} | ||
run: echo "TRAQ_REVISION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(下の方)イメージタグは"master"固定で大丈夫ですか?
(わかりやすさ的に)
@@ -4,6 +4,15 @@ on: | |||
push: | |||
branches: | |||
- master | |||
workflow_dispatch: | |||
inputs: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ブランチ指定で動かすのは特に設定なしでできます
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
workflow_dispatch:
だけでも良さそうですが、説明とデフォルト付けた方が良いかなと思うので残しておこうと思ってます。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
流石にデフォルトはレポジトリのデフォルトブランチになるんじゃ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
なるほど、なら workflow_dispatch:
だけで良さそうですね。ありがとうございます。
|
||
env: | ||
IMAGE_NAME: traq | ||
IMAGE_TAG: master | ||
IMAGE_TAG: ${{ github.event.inputs.branch || 'master' }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ちゃんとsanitizeするか、"dev"とか"staging"でとりあえず固定するのが楽じゃないですか?
今のデプロイ側の仕組み的にも
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
固定はしたくないなら、デプロイスクリプトもcomposeの中のイメージ名書き換えるようにしましょう
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stagingで固定しちゃおうと思います
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ならデプロイスクリプト側もmaster参照からstaging参照にする必要がありますね
作業忘れないようにしてください
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
正直イマイチ方針がよく分かってないのですが、以下の流れで良いでしょうか?
デプロイスクリプトは → https://git.trap.jp/SysAd/tokyotech.org/src/branch/master/roles/traq/files/deploy.sh です。
このスクリプトは、引数でtraq-backend
を受け取り、 https://git.trap.jp/SysAd/tokyotech.org/src/branch/master/roles/traq/templates/docker-compose.yml.j2 に記述されているコンテナをpullして起動する。
なので、
traq-backend:
image: ghcr.io/traptitech/traq:latest
となっているところを、
traq-backend:
image: ghcr.io/traptitech/traq:staging
に変更する。(traq-frontendに対しても同等の事を行う? 他の箇所にも影響が出そうで怖い)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
それは本番の方じゃないですか?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
あ、確かにそうかもです。
traQ/compose.yaml の方を変更すればいいんですかね?(traQのレポジトリに deploy.sh が見当たらなくて...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
これはm011に繋いでいるはずです
traQ/.github/workflows/master.yml
Line 72 in 9918b0c
run: ssh -o LogLevel=QUIET -t ${{ secrets.STAGING_DEPLOY_USER }}@${{ secrets.STAGING_DEPLOY_HOST }} "sudo sh /srv/traq/deploy.sh traq-backend" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(stagingで固定するなら時すでに遅しで使わなそうだけど) git tagからimage tagを生成するはこういうのがあるらしい
https://github.com/docker/metadata-action
ステージング環境を自由に立ててデバッグするための仮案(とりあえずの実装)