minimized

This commit is contained in:
Nathan Price 2024-12-03 17:48:27 -05:00
parent e489466df2
commit a8905adfd6
Signed by: gravityfargo
SSH key fingerprint: SHA256:bjq+uA1U+9bFMd70q2wdNtwaYxGv84IBXalnYvZDKmg

View file

@ -2,44 +2,33 @@ REGISTRY=forgejo.gravityfargo.dev
OWNER=gravityfargo OWNER=gravityfargo
IMAGE=bluesky-pds IMAGE=bluesky-pds
TAG=0.4.74 TAG=0.4.74
CONFIG_FILE=config/pds.env DOMAIN=sheltersky.social
export DOCKER_BUILDKIT=1 export DOCKER_BUILDKIT=1
# export BUILDKIT_PROGRESS=plain # export BUILDKIT_PROGRESS=plain
.PHONY: build .PHONY: build-tag
build: build-tag:
docker build --tag $(REGISTRY)/$(OWNER)/$(IMAGE):$(TAG) . docker build --tag $(REGISTRY)/$(OWNER)/$(IMAGE):$(TAG) .
.PHONY: create-config .PHONY: build
create-config: build:
@if [ -f $(CONFIG_FILE) ]; then \ docker build --no-cache --tag $(REGISTRY)/$(OWNER)/$(IMAGE) .
echo "Config already exists. Exiting."; \
exit 0; \
else \
mkdir -p config; \
echo "PDS_JWT_SECRET=" >> $(CONFIG_FILE); \
echo "PDS_ADMIN_PASSWORD=" >> $(CONFIG_FILE); \
echo "PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX=" >> $(CONFIG_FILE); \
echo "PDS_HOSTNAME=" >> $(CONFIG_FILE); \
echo "Done."; \
echo "run 'make generate' to generate secrets"; \
fi
.PHONY: generate-secrets .PHONY: wsdump
generate-secrets: wsdump:
@echo "Generating secrets..." wsdump "wss://$(DOMAIN)/xrpc/com.atproto.sync.subscribeRepos?cursor=0"
$(eval GENERATE_SECURE_SECRET_CMD=openssl rand --hex 16)
$(eval GENERATE_K256_PRIVATE_KEY_CMD=openssl ecparam --name secp256k1 --genkey --noout --outform DER | tail --bytes=+8 | head --bytes=32 | xxd --plain --cols 32)
$(eval PDS_ADMIN_PASSWORD=$(shell ${GENERATE_SECURE_SECRET_CMD}))
$(eval PDS_JWT_SECRET=$(shell ${GENERATE_SECURE_SECRET_CMD}))
$(eval PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX=$(shell ${GENERATE_K256_PRIVATE_KEY_CMD}))
@sed -i "s/^PDS_ADMIN_PASSWORD=.*/PDS_ADMIN_PASSWORD=${PDS_ADMIN_PASSWORD}/" $(CONFIG_FILE) || echo "PDS_ADMIN_PASSWORD=${PDS_ADMIN_PASSWORD}" >> $(CONFIG_FILE) .PHONY: generate-env
@sed -i "s/^PDS_JWT_SECRET=.*/PDS_JWT_SECRET=${PDS_JWT_SECRET}/" $(CONFIG_FILE) || echo "PDS_JWT_SECRET=${PDS_JWT_SECRET}" >> $(CONFIG_FILE) generate-env:
@sed -i "s/^PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX=.*/PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX=${PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX}/" $(CONFIG_FILE) || echo "PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX=${PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX}" >> $(CONFIG_FILE) $(eval PDS_JWT_SECRET=$(shell openssl rand --hex 16))
$(eval PDS_ADMIN_PASSWORD=$(shell openssl rand --hex 16))
$(eval PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX=$(shell openssl ecparam --name secp256k1 --genkey --noout --outform DER | tail --bytes=+8 | head --bytes=32 | xxd --plain --cols 32))
@echo "Done." @echo "PDS_JWT_SECRET=$(PDS_JWT_SECRET)" > .env
@echo "PDS_ADMIN_PASSWORD=$(PDS_ADMIN_PASSWORD)" >> .env
@echo "PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX=$(PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX)" >> .env
@echo "PDS_HOSTNAME=$(DOMAIN)" >> .env
.PHONY: run .PHONY: run
run: run: