Skip to content

feature/add dockerfile#1

Merged
89 commits merged into
masterfrom
feature/add-dockerfile
Jan 5, 2021
Merged

feature/add dockerfile#1
89 commits merged into
masterfrom
feature/add-dockerfile

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Dec 18, 2020

https://github.com/cryptogarageinc/utxomanager/issues/573 に対するPRです

https://github.com/cryptogarageinc/utxomanager/pull/578 より移動しました。

タグ命名規則

以下の形式で実装した

${直近のタグ名}-${コミットハッシュ8桁}

脆弱性検出結果

trivy による検出結果

cryptogarageinc/electrs:v0.4.2-0f4d9309 (alpine 3.12.3)
=======================================================
Total: 0 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 0, CRITICAL: 0)

残り作業

  • docker hub に push できることを確認したら Github Actions の対象ブランチを修正する
  • 脆弱性が解消されていることを確認し、エビデンスを貼る
  • GitHub Secret の値を一時的なものから適切なものに変更してもらう

shesek added 30 commits April 21, 2020 20:41
Using a new --electrum-public-hosts argument for specifying the public
hosts where the server is reachable (as a JSON dictionary).
The limit applies if the utxo set of an address exceeds the limit at any point in history.

Set to 500 by default, can be configured with --utxos-limit.
To be used with bitcoind's blocknotify functionality, with something like:

    blocknotify=pkill -USR1 electrs
Adds the `server.add_peer` and `server.peers.subscribe` RPC commands to
support discovery of other servers, with a mechanism for running
scheduled health checks and verifying the servers availability.
Enabled when --electrum-public-hosts is set, disabled otherwise.
@ghost ghost requested review from ayuri-kn, chiba-cg and dgyoshi December 24, 2020 03:58
@ghost ghost marked this pull request as ready for review December 24, 2020 03:59
dgyoshi
dgyoshi previously approved these changes Dec 24, 2020
Copy link
Copy Markdown

@dgyoshi dgyoshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread Dockerfile
Comment thread .github/workflows/docker-build.yml Outdated
on:
push:
branches:
- new-index
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cgonoda
これ、改めてちゃんとしたbranch切りませんか。。??
CC: @k-matsuzawa

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これ、改めてちゃんとしたbranch切りませんか。。??

賛成です。 new-index はBlockStream側のブランチとして扱っておいた方が、混同しなくて済むと思います。
それこそdevelop でもいいと思うので。(見たら使ってなかった)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

master / main ?
でも良いかもしれませんね。(mainはまだシックリこないのですが、、)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

こちら、私はとくに意見ないです…

Copy link
Copy Markdown

@ayuri-kn ayuri-kn Dec 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

コメントありがとうございます。

@k-matsuzawa @cgonoda
v0.4.2 からmasterブランチを作成しました!
https://github.com/cryptogarageinc/electrs/tree/master

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ありがとうございます。
では 、on.push.branches: master としておきます。

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f46b6ad で対応しました。

Comment thread .github/workflows/docker-build.yml Outdated
branches:
- new-index
tags:
- '*'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cgonoda
v始まり。とかにしておかなくて大丈夫です?
(どのtagもimage buildしちゃいそうですが、、)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

私の思いとしては、どのtagもimage buildしちゃっていい気がしていました。

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

実際に環境で使いたいもの(の命名ルール)とそうでないもの。は、明確に分けておいた方が良いかなと思いました。

v0.41.2.zzzzzzzz
latest

のimageがあったときに、「これ、どっち使えば良いんだろう。。??」となりはしないかと思いまして。。

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

いえ、imageタグの命名ルールの話ですね。
今の設定だと、下記状況になりうる。と認識しているのですが、認識誤っているでしょうか。。?

  • 特にimageとして利用する想定ではないタグを切りたい。と思ったときも、この指定だとimageが出来てしまう(誰かが使ってしまう可能性がある
  • imageタグ自体の命名規則がなく、様々なimageが作成出来てしまう
    ※極端な話、new-imageというtagを切ると、そのimageが出来てしまう。。

ちょっと毛色が違いますが、他リポジトリではimage(binary)作成の契機をこんな感じで制御していたりします。
https://github.com/cryptogarageinc/settlenetio-v2-traderApp/blob/25d7c51a618fb6326ca7b43a071247f0df4f750a/.github/workflows/release-electron-mac-prod.yml#L7-L8

ご参考まで

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

あー、命名ルールというか、image 作成の契機がガバガバだと、作りたくないときにも作っちゃうという話ですね。
たしかにそうですね。とりあえず on.push.tags: 'v*' にしておきます。

ちなみに、命名ルールそのものについては何かコメントありますか?
https://github.com/cryptogarageinc/electrs/pull/1/files/e39ba46c0b5f1045e4c6b4acf17819ca4ef96885#diff-3414847e2ad632333f775cabb810f0dc0df61a570365df34750a08b00912fe82R42-R43

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

お願いします!
後半はこちらにコメントつけました。
https://github.com/cryptogarageinc/electrs/pull/1/files#r549197094

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f46b6ad で対応しました。

Comment thread .github/workflows/docker-build.yml Outdated

jobs:
build_and_push:
runs-on: ubuntu-latest
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

latestがどう。。という話ってありませんでしたっけ。。
CI workerの指定ってどうなんでしょうね。。??(どっちが良いか。の答えには自分はたどり着いていないのですが、、)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

現在はubuntu-18.04がlatestですけど、間もなくubuntu-20.04に切り替わりますね。。
行うことはあまりないのでlatestでも影響はほぼないと思いますが、できればversion固定しておいた方が面倒事は少ないと思います。

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

うぉ、そうでした! latest排除します。

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f46b6ad で対応しました。

@ayuri-kn ayuri-kn requested a review from k-matsuzawa December 24, 2020 06:00
@ayuri-kn
Copy link
Copy Markdown

ayuri-kn commented Dec 24, 2020

それはそうと、これってimage scannerで発見した脆弱性対応が起点ではなかったでしょうか?
https://github.com/cryptogarageinc/settlenetio-support/issues/5

Dockerhub管理だとすると、scannerは別途実装しなきゃいけないですね。。
であれば、CIにtrivyを入れておく。というのはいかがでしょう?

https://github.com/aquasecurity/trivy-action
https://qiita.com/homines22/items/7aa3cb0a16e56e41ca38

@ghost
Copy link
Copy Markdown
Author

ghost commented Dec 24, 2020

それはそうと、これってimage scannerで発見した脆弱性対応が起点ではなかったでしょうか?
cryptogarageinc/settlenetio-support#5

Dockerhub管理だとすると、scannerは別途実装しなきゃいけないですね。。
であれば、CIにtrivyを入れておく。というのはいかがでしょう?

https://github.com/aquasecurity/trivy-action
https://qiita.com/homines22/items/7aa3cb0a16e56e41ca38

trivy いれてみようと思います!

context: .
push: true
tags: |
${{ github.repository }}:latest
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/cryptogarageinc/electrs/pull/1/files#r549195571

命名ルールそのものについては何かコメントありますか?

latestって作っておいた方が良いんでしょうか。(これは素朴な質問なので、答えは自分はあまり持っていないです。。)
publicには合ったほうが親切なんでしょうけれど、僕らしか使わないといえば使わない。。

という位で、これ自体はみなさんのご意見伺いたいな。位の気持ちです。

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

「一番新しいのどれだっけ…」
「(日付で見てもいいけど) "latest"と同じ DIGEST を持ってるこれか…」
とかいうシーンがないかなぁーとは思っています。

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

なるほど!ではこのままで大丈夫です!

@ghost ghost changed the base branch from new-index to master December 28, 2020 06:21
@ghost ghost dismissed dgyoshi’s stale review December 28, 2020 06:21

The base branch was changed.

@ghost ghost changed the base branch from master to new-index December 28, 2020 06:22
@ghost
Copy link
Copy Markdown
Author

ghost commented Dec 28, 2020

f46b6ad で trivy のgithub action を追加しました。

@ghost ghost requested review from ayuri-kn and dgyoshi December 28, 2020 06:50
@ayuri-kn
Copy link
Copy Markdown

ayuri-kn commented Jan 4, 2021

@cgonoda
branchの向き先を変更お願いできますか?
new-index --> master

https://crypto-garage.slack.com/archives/CD43F2YUT/p1609123086050600

@ghost ghost changed the base branch from new-index to master January 4, 2021 09:39
Copy link
Copy Markdown

@k-matsuzawa k-matsuzawa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

Copy link
Copy Markdown

@dgyoshi dgyoshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

@ghost ghost merged commit 9c1623b into master Jan 5, 2021
@ghost ghost deleted the feature/add-dockerfile branch January 5, 2021 05:21
@ayuri-kn
Copy link
Copy Markdown

ayuri-kn commented Jan 6, 2021

@dgyoshi @k-matsuzawa @cgonoda
これ、、現在CGで使われてるとされていた、 b18f82c --> https://github.com/cryptogarageinc/electrs/releases/tag/v0.4.2
で、masterブランチを作成していたのですが、 new-index ブランチ(Blockstream側の)のHEADをマージしてしまったように見えています。。

これでも特に問題はないでしょうか??

@k-matsuzawa
Copy link
Copy Markdown

レビュー時にさっと全体を見てみましたが、大きな影響がありそうな変更は入っていないと思います。(new-indexブランチ自体はblockstreamのblock explorerで運用しているはずなので、ある程度の動作は担保できているはず)
ですのでdev/test環境でしばらく(半月位?)使って問題なければ(使用している各種モジュールに影響がなければ)Updateしても大丈夫と思っています。

@ayuri-kn
Copy link
Copy Markdown

ayuri-kn commented Jan 6, 2021

なるほど。
ある意味いい機会なので、最新アップデートに追随しておいた方が良いだろう。ということですね。
承知しました!

@ayuri-kn
Copy link
Copy Markdown

ayuri-kn commented Jan 6, 2021

だとすると、とりあえず、これでタグ切っておいた方が良いですね。。

${{ github.repository }}:latest
${{ github.repository }}:${{ steps.tagname.outputs.tagname }}-${{ steps.short-sha.outputs.sha8 }}

- name: Run Trivy vulnerability scanner
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cgonoda @dgyoshi
これ、今更指摘で恐縮ですが、build --> run scanner --> push の順序かなとおもったのですが、いかがでしょうか?
(というのは、脆弱性が見つかったものをrepositoryにpushして良いのかな?と思ったりしたので。。)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

たしかに、その順序がいいですね。
ただ、このPRはマージしてしまったので、別PRで作業させてくださいー。

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants