diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7be7461 --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ +include base.mk + +FLY_CMD=fly diff --git a/README.md b/README.md index 838e6d3..62590be 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,10 @@ This demo effectively shows how PocketBase can be pushed closer to the edge. Aft - **This example doesn't use persistent volume** - Base snapshot and logs in Marmot nodes should be enough to get you up and running every-time. You can configure Marmot with S3/Minio snapshots for higher reliability. +## Make file + +See the Makefile and base.mk for how to fo this using make. + ## Install Flyctl - Follow the installation instructions from https://fly.io/docs/hands-on/install-flyctl/. @@ -34,6 +38,8 @@ This demo effectively shows how PocketBase can be pushed closer to the edge. Aft ## Deploy and Scale + + - Create Fly app using `fly app create`, fill in the information on prompts. - Deploy on app using `fly deploy -a `, here `application-name` will be the name of app you created - Scale the app to multiple pods you `fly scale count 3 -a `. At least have 2 pods for Marmot to diff --git a/base.mk b/base.mk new file mode 100644 index 0000000..16b399f --- /dev/null +++ b/base.mk @@ -0,0 +1,51 @@ + +NAME=marmot-pocketbase-flyio + +FLY_NAME=fly-$(NAME) +FLY_CMD=fly +FLY_CONSOLE=https://fly.io/apps/$(FLY_NAME) + +PD_ADMIN=http://$(FLY_NAME).fly.dev/_/ +PB_API=http://$(FLY_NAME).fly.dev/api/ + +print: + @echo "" + @echo "FLY_NAME: $(FLY_NAME)" + @echo "FLY_CMD: $(FLY_CMD)" + @echo "FLY_CONSOLE: $(FLY_CONSOLE)" + @echo "" + @echo "PD_ADMIN: $(PD_ADMIN)" + @echo "PB_API: $(PB_API)" + +all: dep fly-destroy fly-create fly-deploy fly-console + +dep: + # https://fly.io/docs/flyctl/ + brew install flyctl + # OR + # curl -L https://fly.io/install.sh | sh + +fly-destroy: + $(FLY_CMD) apps destroy $(FLY_NAME) +fly-create: + $(FLY_CMD) app create $(FLY_NAME) +fly-deploy: + $(FLY_CMD) deploy -a $(FLY_NAME) +fly-console: + open $(FLY_CONSOLE) +fly-scale-zero: + $(FLY_CMD) scale count 0 -a $(FLY_NAME) +fly-scale-up: + $(FLY_CMD) scale count 3 -a $(FLY_NAME) +fly-scale-down: + $(FLY_CMD) scale count 1 -a $(FLY_NAME) +fly-ls: + $(FLY_CMD) apps list +fly-stop: + $(FLY_CMD) apps stop $(FLY_NAME) + + +pb-admin: + open $(PD_ADMIN) +pb-api: + curl $(PB_API) \ No newline at end of file