frostfs-aio/Makefile
Alex Vanin ce00bcee2d Do not use build-arg for image-aio-local
There is not arguments in Dockerfile.local

Signed-off-by: Alex Vanin <a.vanin@yadro.com>
2024-11-08 17:35:17 +03:00

140 lines
4.1 KiB
Makefile

#!/usr/bin/make -f
include .env
include help.mk
# Common variables
REPO=$(notdir $(shell pwd))
VERSION ?= "$(shell git describe --tags --match "v*" 2>/dev/null || git rev-parse --short HEAD | sed 's/^v//')"
# Variables for docker
AIO_IMAGE ?= "truecloudlab/frostfs-aio"
LOG_DIR ?= "/var/log"
# Variables for compose
COMPOSE_CMD_UP ?= docker-compose up -d
COMPOSE_CMD_DOWN ?= docker-compose down
COMPOSE_V2 = "$(shell docker compose version --short | grep -q '^2' && echo true)"
ifeq ($(COMPOSE_V2), "true")
COMPOSE_CMD_UP = docker compose up -d --wait
COMPOSE_CMD_DOWN = docker compose down
endif
# Variables for S3
S3_BEARER_RULES ?= "/config/bearer-rules.json"
S3_GATE_PUBLIC_KEY ?= "0312fe65b101565de74eedf477afb43417ff5f795732506cfddc8e044c5a030d76"
# Build aio Docker image
image-aio:
@echo "⇒ Build aio docker image"
@docker build \
--rm \
-f Dockerfile \
--build-arg FROSTFS_CORE_TAG=$(FROSTFS_CORE_TAG) \
--build-arg FROSTFS_HTTP_GATE_TAG=$(FROSTFS_HTTP_GATE_TAG) \
--build-arg FROSTFS_S3_GATE_TAG=$(FROSTFS_S3_GATE_TAG) \
--build-arg FROSTFS_S3_LIFECYCLER_TAG=$(FROSTFS_S3_LIFECYCLER_TAG) \
--build-arg NEOGO_TAG=$(NEOGO_TAG) \
-t $(AIO_IMAGE):$(AIO_VERSION) .
# Build aio Docker image from all local pre-built binaries
image-aio-local:
@echo "⇒ Build aio docker image from all local pre-built binaries"
@docker build \
--rm \
-f Dockerfile.local \
-t $(AIO_IMAGE):$(AIO_VERSION) .
# Build aio Docker image with custom binaries
image-aio-custom:
@echo "⇒ Build aio Docker image with custom binaries"
@docker build \
--rm \
-f Dockerfile.custom \
--build-arg FROSTFS_CORE_TAG=$(FROSTFS_CORE_TAG) \
--build-arg FROSTFS_HTTP_GATE_TAG=$(FROSTFS_HTTP_GATE_TAG) \
--build-arg FROSTFS_S3_GATE_TAG=$(FROSTFS_S3_GATE_TAG) \
--build-arg FROSTFS_S3_LIFECYCLER_TAG=$(FROSTFS_S3_LIFECYCLER_TAG) \
--build-arg NEOGO_TAG=$(NEOGO_TAG) \
-t $(AIO_IMAGE):$(AIO_VERSION) .
# Start AIO
up:
@$(COMPOSE_CMD_UP)
# Stop AIO
down:
@$(COMPOSE_CMD_DOWN)
# Clean up
clean: down
@$(COMPOSE_CMD_DOWN) --volumes
# Generate S3 credentials
s3cred:
@docker exec aio /usr/bin/issue-creds.sh s3
# Generate S3 credentials based on imported wallets
s3cred-custom:
@docker exec aio /usr/bin/issue-creds.sh s3 $(wallet)
# Register user-wallet.json in FrostFS ID contract
cred:
@docker exec aio /usr/bin/issue-creds.sh native
# Register custom wallet in FrostFS ID contract
cred-custom:
@docker exec aio /usr/bin/issue-creds.sh native $(wallet)
enable-oracle:
@docker exec aio neo-go contract invokefunction -r http://localhost:30333 \
--wallet-config /config/node-config.yaml \
--out /config/tx.json 49cf4e5378ffcd4dec034fd98a174c5491e395e2 designateAsRole \
int:8 [ bytes:02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2 ] \
-- NfgHwwTi3wHAS8aFAN243C5vGbkYDpqLHP
@docker exec aio neo-go wallet sign --in /config/tx.json \
-r http://localhost:30333 \
--wallet-config /config/node-config.yaml \
-a NfgHwwTi3wHAS8aFAN243C5vGbkYDpqLHP
# Tick new epoch in side chain
tick.epoch:
@docker exec aio /usr/bin/frostfs-adm --config /config/frostfs-adm.yml morph force-new-epoch
# Create new wallet
WALLET?=wallets/wallet1.json
.PHONY: wallet
wallet:
@! test -f "$(WALLET)" || { echo "File exists: $(WALLET)"; exit 1; }
@docker exec -it aio /usr/bin/neo-go wallet init -a -w "$(WALLET)"
# Refill GAS in arbitrary WALLET (must be under wallets/ directory)
GAS?=50.0
.PHONY: refill
refill:
@docker exec aio /usr/bin/frostfs-adm --config /config/frostfs-adm.yml \
morph refill-gas --storage-wallet=/$(WALLET) --gas=$(GAS)
@$(MAKE) --no-print-directory balance
# Show wallet balance
.PHONY: balance
balance:
@echo "Balance for $(WALLET)"
@docker exec aio /usr/bin/neo-go wallet nep17 balance -r http://localhost:30333 -w "$(WALLET)"
# Show current version
version:
@echo "aio:" $(VERSION)
@echo "frostfs-node: $(FROSTFS_CORE_TAG)"
@echo "frostfs-s3-gw: $(FROSTFS_S3_GATE_TAG)"
@echo "frostfs-http-gw: $(FROSTFS_HTTP_GATE_TAG)"
@echo "neo-go: $(NEOGO_TAG)"
# Show all logs of the FrostFS service
logs/%:
@docker exec aio cat ${LOG_DIR}/$*
# Streaming of the frostFS service logs
logs-stream/%:
@docker exec aio tail -f ${LOG_DIR}/$*