Skip to content

Commit

Permalink
enable-alpha-builds Mina-ify many things and clean up Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
lk86 committed May 19, 2021
1 parent e959357 commit 10965ca
Show file tree
Hide file tree
Showing 27 changed files with 176 additions and 300 deletions.
40 changes: 14 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ GITHASH = $(shell git rev-parse --short=8 HEAD)
GITLONGHASH = $(shell git rev-parse HEAD)

MYUID = $(shell id -u)
DOCKERNAME = codabuilder-$(MYUID)
DOCKERNAME = minabuilder-$(MYUID)

# Unique signature of libp2p code tree
LIBP2P_HELPER_SIG = $(shell cd src/app/libp2p_helper ; find . -type f -print0 | xargs -0 sha1sum | sort | sha1sum | cut -f 1 -d ' ')
Expand Down Expand Up @@ -57,33 +57,32 @@ git_hooks: $(wildcard scripts/git_hooks/*)
########################################
## Code

all: clean codabuilder containerstart build
all: clean minabuilder containerstart build

clean:
$(info Removing previous build artifacts)
@rm -rf _build
@rm -rf src/$(COVERAGE_DIR)
@rm -rf src/app/libp2p_helper/result

# TEMP HACK (for circle-ci)
libp2p_helper:
make -C src/app/libp2p_helper

GENESIS_DIR := $(TMPDIR)/coda_cache_dir

genesis_ledger:
$(info Building runtime_genesis_ledger)
ulimit -s 65532 && (ulimit -n 10240 || true) && $(WRAPAPP) env CODA_COMMIT_SHA1=$(GITLONGHASH) dune exec --profile=$(DUNE_PROFILE) src/app/runtime_genesis_ledger/runtime_genesis_ledger.exe -- --genesis-dir $(GENESIS_DIR)
ulimit -s 65532 && (ulimit -n 10240 || true) && $(WRAPAPP) env MINA_COMMIT_SHA1=$(GITLONGHASH) dune exec --profile=$(DUNE_PROFILE) src/app/runtime_genesis_ledger/runtime_genesis_ledger.exe -- --genesis-dir $(GENESIS_DIR)
$(info Genesis ledger and genesis proof generated)

build: git_hooks reformat-diff libp2p_helper
$(info Starting Build)
ulimit -s 65532 && (ulimit -n 10240 || true) && $(WRAPAPP) env CODA_COMMIT_SHA1=$(GITLONGHASH) dune build src/app/logproc/logproc.exe src/app/cli/src/mina.exe --profile=$(DUNE_PROFILE)
ulimit -s 65532 && (ulimit -n 10240 || true) && $(WRAPAPP) env MINA_COMMIT_SHA1=$(GITLONGHASH) dune build src/app/logproc/logproc.exe src/app/cli/src/mina.exe --profile=$(DUNE_PROFILE)
$(info Build complete)

build_all_sigs: git_hooks reformat-diff libp2p_helper
$(info Starting Build)
ulimit -s 65532 && (ulimit -n 10240 || true) && $(WRAPAPP) env CODA_COMMIT_SHA1=$(GITLONGHASH) dune build src/app/logproc/logproc.exe src/app/cli/src/mina.exe src/app/cli/src/mina_testnet_signatures.exe src/app/cli/src/mina_mainnet_signatures.exe --profile=$(DUNE_PROFILE)
ulimit -s 65532 && (ulimit -n 10240 || true) && $(WRAPAPP) env MINA_COMMIT_SHA1=$(GITLONGHASH) dune build src/app/logproc/logproc.exe src/app/cli/src/mina.exe src/app/cli/src/mina_testnet_signatures.exe src/app/cli/src/mina_mainnet_signatures.exe --profile=$(DUNE_PROFILE)
$(info Build complete)

build_archive: git_hooks reformat-diff
Expand Down Expand Up @@ -181,7 +180,7 @@ swap_bad_balances :
ulimit -s 65532 && (ulimit -n 10240 || true) && dune build src/app/swap_bad_balances/swap_bad_balances.exe --profile=testnet_postake_medium_curves
$(info Build complete)

dev: codabuilder containerstart build
dev: minabuilder containerstart build

# update OPAM, pinned packages in Docker
update-opam:
Expand Down Expand Up @@ -254,22 +253,20 @@ docker-toolchain-rust:

update-deps:
./scripts/update-toolchain-references.sh $(GITLONGHASH)
make render-circleci

update-rust-deps:
./scripts/update-rust-toolchain-references.sh $(GITLONGHASH)
make render-circleci

# Local 'codabuilder' docker image (based off docker-toolchain)
codabuilder: git_hooks
docker build --file dockerfiles/Dockerfile --tag codabuilder .
# Local 'minabuilder' docker image (based off docker-toolchain)
minabuilder: git_hooks
docker build --file dockerfiles/Dockerfile-toolchain --tag minabuilder .

# Restarts codabuilder
# Restarts minabuilder
containerstart: git_hooks
@./scripts/container.sh restart

docker-rosetta:
docker build --file dockerfiles/Dockerfile-rosetta --tag codaprotocol/coda:rosetta-$(GITLONGHASH) .
docker build --file dockerfiles/Dockerfile-rosetta --tag codaprotocol/mina:rosetta-$(GITLONGHASH) .

########################################
## Artifacts
Expand All @@ -289,12 +286,12 @@ deb_optimized:

build_pv_keys:
$(info Building keys)
ulimit -s 65532 && (ulimit -n 10240 || true) && $(WRAPAPP) env CODA_COMMIT_SHA1=$(GITLONGHASH) dune exec --profile=$(DUNE_PROFILE) src/lib/snark_keys/gen_keys/gen_keys.exe -- --generate-keys-only
ulimit -s 65532 && (ulimit -n 10240 || true) && $(WRAPAPP) env MINA_COMMIT_SHA1=$(GITLONGHASH) dune exec --profile=$(DUNE_PROFILE) src/lib/snark_keys/gen_keys/gen_keys.exe -- --generate-keys-only
$(info Keys built)

build_or_download_pv_keys:
$(info Building keys)
ulimit -s 65532 && (ulimit -n 10240 || true) && $(WRAPAPP) env CODA_COMMIT_SHA1=$(GITLONGHASH) dune exec --profile=$(DUNE_PROFILE) src/lib/snark_keys/gen_keys/gen_keys.exe -- --generate-keys-only
ulimit -s 65532 && (ulimit -n 10240 || true) && $(WRAPAPP) env MINA_COMMIT_SHA1=$(GITLONGHASH) dune exec --profile=$(DUNE_PROFILE) src/lib/snark_keys/gen_keys/gen_keys.exe -- --generate-keys-only
$(info Keys built)

publish_deb:
Expand All @@ -308,12 +305,6 @@ genesiskeys:
@cp _build/default/src/lib/mina_base/sample_keypairs.ml /tmp/artifacts/.
@cp _build/default/src/lib/mina_base/sample_keypairs.json /tmp/artifacts/.

codaslim:
@# FIXME: Could not reference .deb file in the sub-dir in the docker build
@cp _build/coda.deb .
@./scripts/rebuild-docker.sh codaslim dockerfiles/Dockerfile-codaslim
@rm coda.deb

##############################################
## Genesis ledger in OCaml from running daemon

Expand All @@ -323,9 +314,6 @@ genesis-ledger-ocaml:
########################################
## Tests

render-circleci:
./scripts/test.py render .circleci/config.yml.jinja .mergify.yml.jinja

test-ppx:
$(MAKE) -C src/lib/ppx_coda/tests

Expand Down Expand Up @@ -395,4 +383,4 @@ ml-docs:
# https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html
# HACK: cat Makefile | egrep '^\w.*' | sed 's/:/ /' | awk '{print $1}' | grep -v myprocs | sort | xargs

.PHONY: all build check-format clean client_sdk client_sdk_test_sigs codaslim containerstart deb dev codabuilder coda-docker coda-googlecloud coda-minikube reformat test test-all test-coda-block-production-sig test-coda-block-production-stake test-codapeers-sig test-codapeers-stake test-full-sig test-full-stake test-runtest test-transaction-snark-profiler-sig test-transaction-snark-profiler-stake update-deps render-circleci check-render-circleci docker-toolchain-rust toolchains doc_diagrams ml-docs macos-setup macos-setup-download setup-opam libp2p_helper dhall_types replayer missing_blocks_auditor extract_blocks archive_blocks genesis_ledger_from_tsv
.PHONY: all build check-format clean client_sdk client_sdk_test_sigs containerstart deb dev minabuilder mina-docker reformat update-deps docker-toolchain-rust toolchains doc_diagrams ml-docs macos-setup macos-setup-download setup-opam libp2p_helper dhall_types replayer missing_blocks_auditor extract_blocks archive_blocks genesis_ledger_from_tsv
19 changes: 0 additions & 19 deletions automation/services/daemon/Dockerfile

This file was deleted.

96 changes: 0 additions & 96 deletions automation/services/daemon/entrypoint.sh

This file was deleted.

2 changes: 0 additions & 2 deletions automation/services/daemon/version

This file was deleted.

24 changes: 12 additions & 12 deletions automation/terraform/modules/services/daemon/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Coda Daemon Module
## mina Daemon Module

This is a Terraform module that will deploy a Coda Daemon container as a service in AWS ECS.
This is a Terraform module that will deploy a mina Daemon container as a service in AWS ECS.

## Variables

Expand All @@ -14,7 +14,7 @@ This is a Terraform module that will deploy a Coda Daemon container as a service

`container_version`: The version of the container to be used when deploying the Daemon Service

`coda_wallet_keys`: A space-delimited list of AWS Secrets Manager secret IDs
`mina_wallet_keys`: A space-delimited list of AWS Secrets Manager secret IDs

`aws_access_key`: An Access Key granting read-only access to Testnet Secrets

Expand All @@ -30,28 +30,28 @@ This is a Terraform module that will deploy a Coda Daemon container as a service

`daemon_metrics_port` (Default: 10000): The port that the daemon will expose prometheus metrics on

`coda_privkey_pass`: The password for the installed keys
`mina_privkey_pass`: The password for the installed keys

## Deployment Considerations

In order to deploy a "new" version of this module, you must ensure that you have rebuilt said container. The container build is a two-step process, with the base Coda dockerfile being [here](https://github.com/CodaProtocol/coda/blob/develop/dockerfiles/Dockerfile-coda-daemon) and the more deployment-specific Dockerfile [here](https://github.com/CodaProtocol/coda-automation/blob/master/services/daemon/Dockerfile).
In order to deploy a "new" version of this module, you must ensure that you have rebuilt said container. The container build is a two-step process, with the base mina dockerfile being [here](https://github.com/minaProtocol/mina/blob/develop/dockerfiles/Dockerfile-mina-daemon) and the more deployment-specific Dockerfile [here](https://github.com/minaProtocol/mina-automation/blob/master/services/daemon/Dockerfile).

The manual commands to release each container are the following:

### Coda-Daemon Container
### Mina-Daemon Container

*(From the root of the `CodaProtocol/coda` repository)*
`./scripts/release-docker.sh -s coda-daemon -v <major>.<minor>.<patch> --extra-args "--build-arg coda_version=<CODA_VERSION> --build-arg deb_repo=<deb-repo>"`
*(From the root of the `MinaProtocol/mina` repository)*
`./scripts/release-docker.sh -s mina-daemon -v <major>.<minor>.<patch> --extra-args "--build-arg deb_version=<DEB_VERSION> --build-arg deb_release=<mina package release channel, e.g. alpha>"`

Example:
`./scripts/release-docker.sh -s coda-daemon -v 0.0.10-beta4 --extra-args "--build-arg coda_version=0.0.10-beta4-fff3b856 --build-arg deb_repo=release"`
`./scripts/release-docker.sh -s mina-daemon -v 0.0.10-beta4 --extra-args "--build-arg deb_version=0.0.10-beta4-fff3b856 --build-arg deb_release=alpha`

The `--extra-args` argument is for passing additional parameters directly to the `docker build` command. It is used here to pass the required Dockerfile variable `coda_version` but can also be used to override Dockerfile variables with default values like so `--build-arg deb_repo=release`
The `--extra-args` argument is for passing additional parameters directly to the `docker build` command. It is used here to pass the required Dockerfile variable `'deb_version` but can also be used to override Dockerfile variables with default values like so `--build-arg deb_repo=release`

### daemon Container

*(From the root of the `CodaProtocol/coda-automation` repository)*
*(From the root of the `MinaProtocol/mina/automation` folder in the mina repository)*
`./scripts/release-docker.sh -s daemon -v <major>.<minor>.<patch> --extra-args "--build-arg base_image_tag=<docker tag created in first step> "`

Example:
`./scripts/release-docker.sh -s daemon -v 0.0.10-beta4 --extra-args "--build-arg base_image_tag=0.0.10-beta4"`
`./scripts/release-docker.sh -s daemon -v 0.0.10-beta4 --extra-args "--build-arg base_image_tag=0.0.10-beta4"`
Loading

0 comments on commit 10965ca

Please sign in to comment.