Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make automation #4

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include base.mk

FLY_CMD=fly
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/.
Expand All @@ -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 <application-name>`, here `application-name` will be the name of app you created
- Scale the app to multiple pods you `fly scale count 3 -a <application-name>`. At least have 2 pods for Marmot to
Expand Down
51 changes: 51 additions & 0 deletions base.mk
Original file line number Diff line number Diff line change
@@ -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)