Version 1
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
project_root := justfile_directory()
|
||||
backend_dir := project_root + "/Backend"
|
||||
|
||||
# Format backend Go source files.
|
||||
fmt:
|
||||
cd '{{backend_dir}}' && gofmt -w ./cmd ./internal
|
||||
|
||||
# Run backend test suite.
|
||||
test:
|
||||
cd '{{backend_dir}}' && go test ./...
|
||||
|
||||
# Open a psql shell into the local Royal Pop database container.
|
||||
psql:
|
||||
docker compose -f '{{project_root}}/Docker/docker-compose.local.dev.yaml' exec postgres psql -U royalpop -d royalpop
|
||||
|
||||
# Run backend module cleanup.
|
||||
tidy:
|
||||
cd '{{backend_dir}}' && go mod tidy
|
||||
@@ -0,0 +1,26 @@
|
||||
project_root := justfile_directory()
|
||||
store_dir := project_root + "/Store"
|
||||
local_compose := project_root + "/Docker/docker-compose.local.dev.yaml"
|
||||
node_modules_volume := "royal_pop_store_node_modules"
|
||||
|
||||
# Recreate the storefront node_modules Docker volume.
|
||||
node_modules:
|
||||
docker compose -f '{{local_compose}}' rm -sf store >/dev/null 2>&1 || true
|
||||
docker volume rm -f '{{node_modules_volume}}' >/dev/null 2>&1 || true
|
||||
docker compose -f '{{local_compose}}' up -d --remove-orphans --force-recreate store
|
||||
|
||||
# Build the storefront.
|
||||
build:
|
||||
cd '{{store_dir}}' && npm run build
|
||||
|
||||
# Print the local client dashboard URL.
|
||||
client-url:
|
||||
printf '%s\n' 'Client dashboard: http://localhost:4321/client/'
|
||||
|
||||
# Print the local client orders URL.
|
||||
client-orders-url:
|
||||
printf '%s\n' 'Client orders: http://localhost:4321/client/orders/'
|
||||
|
||||
# Print the local client stock URL.
|
||||
client-stock-url:
|
||||
printf '%s\n' 'Client stock: http://localhost:4321/client/stock/'
|
||||
@@ -0,0 +1,40 @@
|
||||
project_root := justfile_directory()
|
||||
backend_dir := project_root + "/Backend"
|
||||
backend_bake := project_root + "/Backend/docker-bake.hcl"
|
||||
store_dir := project_root + "/Store"
|
||||
store_bake := project_root + "/Store/docker-bake.hcl"
|
||||
local_compose := project_root + "/Docker/docker-compose.local.dev.yaml"
|
||||
|
||||
mod frontend
|
||||
mod backend
|
||||
mod stripe
|
||||
|
||||
# Default flow: rebuild the local development images and recreate the stack.
|
||||
rebuild:
|
||||
cd '{{backend_dir}}' && docker buildx bake -f '{{backend_bake}}' dev
|
||||
cd '{{store_dir}}' && docker buildx bake -f '{{store_bake}}' dev
|
||||
docker compose -f '{{local_compose}}' up -d --remove-orphans --force-recreate
|
||||
|
||||
# Build the local development images.
|
||||
build:
|
||||
cd '{{backend_dir}}' && docker buildx bake -f '{{backend_bake}}' dev
|
||||
cd '{{store_dir}}' && docker buildx bake -f '{{store_bake}}' dev
|
||||
|
||||
# Start the local development stack in the background using the current image.
|
||||
up:
|
||||
docker compose -f '{{local_compose}}' up -d --remove-orphans --force-recreate
|
||||
|
||||
# Build first, then start the local development stack in the background.
|
||||
start: build up
|
||||
|
||||
# Stop and remove the local development stack.
|
||||
down:
|
||||
docker compose -f '{{local_compose}}' down --remove-orphans --volumes
|
||||
|
||||
# Follow logs for the local development stack.
|
||||
logs:
|
||||
docker compose -f '{{local_compose}}' logs -f
|
||||
|
||||
# Restart the local development stack.
|
||||
restart:
|
||||
docker compose -f '{{local_compose}}' restart
|
||||
@@ -0,0 +1,6 @@
|
||||
project_root := justfile_directory()
|
||||
backend_webhook_url := "http://localhost:8081/webhooks/stripe"
|
||||
|
||||
# Forward Stripe test webhooks to the local API.
|
||||
listen:
|
||||
stripe listen --forward-to '{{backend_webhook_url}}'
|
||||
@@ -0,0 +1,2 @@
|
||||
mod dev "Dev"
|
||||
mod prod
|
||||
@@ -0,0 +1,41 @@
|
||||
project_root := justfile_directory()
|
||||
env_file := project_root + "/Env/.env.production"
|
||||
backend_dir := project_root + "/Backend"
|
||||
backend_bake := project_root + "/Backend/docker-bake.hcl"
|
||||
proxy_bake := project_root + "/Proxy/docker-bake.hcl"
|
||||
local_compose := project_root + "/Docker/docker-compose.local.prod.yaml"
|
||||
api_image := "goko/royal-pop/api:local-prod"
|
||||
proxy_image := "goko/royal-pop/proxy:local-prod"
|
||||
|
||||
# Default flow: rebuild the local production images and recreate the full stack.
|
||||
rebuild:
|
||||
set -a && source '{{env_file}}' && set +a && cd '{{backend_dir}}' && docker buildx bake -f '{{backend_bake}}' --set '*.no-cache=true' prod && cd '{{project_root}}' && docker buildx bake -f '{{proxy_bake}}' --set '*.no-cache=true' prod && docker compose --env-file '{{env_file}}' -f '{{local_compose}}' up -d --remove-orphans --force-recreate
|
||||
|
||||
# Build the local production API and proxy images.
|
||||
build:
|
||||
set -a && source '{{env_file}}' && set +a && cd '{{backend_dir}}' && docker buildx bake -f '{{backend_bake}}' prod && cd '{{project_root}}' && docker buildx bake -f '{{proxy_bake}}' prod
|
||||
|
||||
# Start the local production stack in the background using the current image.
|
||||
up:
|
||||
docker compose --env-file '{{env_file}}' -f '{{local_compose}}' up -d --remove-orphans --force-recreate
|
||||
|
||||
# Build first, then start the local production stack in the background.
|
||||
start: build up
|
||||
|
||||
# Stop and remove the local production stack.
|
||||
down:
|
||||
docker compose --env-file '{{env_file}}' -f '{{local_compose}}' down --remove-orphans --volumes
|
||||
|
||||
# Follow logs for the local production stack.
|
||||
logs:
|
||||
docker compose --env-file '{{env_file}}' -f '{{local_compose}}' logs -f
|
||||
|
||||
# Restart the local production stack.
|
||||
restart:
|
||||
docker compose --env-file '{{env_file}}' -f '{{local_compose}}' restart
|
||||
|
||||
# Stop the local production stack and remove local images.
|
||||
clean:
|
||||
docker compose --env-file '{{env_file}}' -f '{{local_compose}}' down --remove-orphans --volumes
|
||||
docker image rm -f '{{api_image}}' >/dev/null 2>&1 || true
|
||||
docker image rm -f '{{proxy_image}}' >/dev/null 2>&1 || true
|
||||
@@ -0,0 +1,38 @@
|
||||
project_root := justfile_directory()
|
||||
env_file := project_root + "/Env/.env.local"
|
||||
backend_dir := project_root + "/Backend"
|
||||
backend_bake := project_root + "/Backend/docker-bake.hcl"
|
||||
store_dir := project_root + "/Store"
|
||||
store_bake := project_root + "/Store/docker-bake.hcl"
|
||||
compose_file := project_root + "/Docker/docker-compose.remote.dev.yaml"
|
||||
|
||||
# Default flow: refresh the registry images and recreate the stack.
|
||||
rebuild: up
|
||||
|
||||
# Pull the latest remote development images from the registry.
|
||||
pull:
|
||||
docker compose --env-file '{{env_file}}' -f '{{compose_file}}' pull
|
||||
|
||||
# Start the remote development stack locally using the current registry images.
|
||||
up: pull
|
||||
docker compose --env-file '{{env_file}}' -f '{{compose_file}}' up -d --remove-orphans --force-recreate
|
||||
|
||||
# Publish the remote development images to the registry.
|
||||
push:
|
||||
set -a && source '{{env_file}}' && set +a && cd '{{backend_dir}}' && docker buildx bake -f '{{backend_bake}}' dev-image && cd '{{store_dir}}' && docker buildx bake -f '{{store_bake}}' dev-image
|
||||
|
||||
# Stop and remove the remote development stack.
|
||||
down:
|
||||
docker compose --env-file '{{env_file}}' -f '{{compose_file}}' down --remove-orphans --volumes
|
||||
|
||||
# Follow logs for the remote development stack.
|
||||
logs:
|
||||
docker compose --env-file '{{env_file}}' -f '{{compose_file}}' logs -f
|
||||
|
||||
# Restart the remote development stack.
|
||||
restart:
|
||||
docker compose --env-file '{{env_file}}' -f '{{compose_file}}' restart
|
||||
|
||||
# Show remote development stack status.
|
||||
ps:
|
||||
docker compose --env-file '{{env_file}}' -f '{{compose_file}}' ps
|
||||
@@ -0,0 +1,2 @@
|
||||
mod dev
|
||||
mod prod
|
||||
@@ -0,0 +1,37 @@
|
||||
project_root := justfile_directory()
|
||||
env_file := project_root + "/Env/.env.production"
|
||||
backend_dir := project_root + "/Backend"
|
||||
backend_bake := project_root + "/Backend/docker-bake.hcl"
|
||||
proxy_bake := project_root + "/Proxy/docker-bake.hcl"
|
||||
compose_file := project_root + "/Docker/docker-compose.remote.prod.yaml"
|
||||
|
||||
# Default flow: refresh the registry images and recreate the stack.
|
||||
rebuild: up
|
||||
|
||||
# Pull the latest remote production images from the registry.
|
||||
pull:
|
||||
docker compose --env-file '{{env_file}}' -f '{{compose_file}}' pull
|
||||
|
||||
# Start the remote production stack locally using the current registry images.
|
||||
up: pull
|
||||
docker compose --env-file '{{env_file}}' -f '{{compose_file}}' up -d --remove-orphans --force-recreate
|
||||
|
||||
# Publish the remote production images to the registry.
|
||||
push:
|
||||
set -a && source '{{env_file}}' && set +a && cd '{{backend_dir}}' && docker buildx bake -f '{{backend_bake}}' prod-image && cd '{{project_root}}' && docker buildx bake -f '{{proxy_bake}}' prod-image
|
||||
|
||||
# Stop and remove the remote production stack.
|
||||
down:
|
||||
docker compose --env-file '{{env_file}}' -f '{{compose_file}}' down --remove-orphans
|
||||
|
||||
# Follow logs for the remote production stack.
|
||||
logs:
|
||||
docker compose --env-file '{{env_file}}' -f '{{compose_file}}' logs -f
|
||||
|
||||
# Restart the remote production stack.
|
||||
restart:
|
||||
docker compose --env-file '{{env_file}}' -f '{{compose_file}}' restart
|
||||
|
||||
# Show remote production stack status.
|
||||
ps:
|
||||
docker compose --env-file '{{env_file}}' -f '{{compose_file}}' ps
|
||||
Reference in New Issue
Block a user