-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
67 lines (55 loc) · 1.97 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
tailwind:
tailwindcss -i ./src/main/resources/static/styles/index.css -o ./src/main/resources/static/styles/output.css
# Makefile for managing environment variables and EB deployment
# Load environment variables from .env file
include .env
export $(shell sed 's/=.*//' .env)
# Default environment name from EB config
EB_ENV = budgetai-env
.PHONY: help init deploy update-env list-env check-status wait-ready use-env
help:
@echo "Available commands:"
@echo " make init - Initialize EB environment with variables from .env"
@echo " make deploy - Deploy application to EB"
@echo " make update-env - Update EB environment variables from .env"
@echo " make list-env - List current EB environment variables"
@echo " make check-status- Check current EB environment status"
@echo " make wait-ready - Wait until environment is ready"
@echo " make use-env - Set default environment"
init:
eb init budgetai --platform "docker" --region eu-west-1
# Set default environment
use-env:
eb use $(EB_ENV)
# Check environment status
check-status:
@eb status -e $(EB_ENV)
# Wait until environment is ready
wait-ready:
@echo "Waiting for environment to be ready..."
@while [ "$$(eb status -e $(EB_ENV) | grep "Status:" | awk '{print $$2}')" != "Ready" ]; do \
echo "Environment is not ready. Current status: $$(eb status -e $(EB_ENV) | grep "Status:" | awk '{print $$2}')"; \
sleep 30; \
done
@echo "Environment is ready!"
# Deploy application to Elastic Beanstalk
deploy:
make wait-ready
eb deploy -e $(EB_ENV)
# Update EB environment variables from .env file
update-env:
make wait-ready
eb setenv -e $(EB_ENV) \
PORT=8080 \
ENVIRONMENT=production \
OPEN_AI="$(OPEN_AI)" \
AWS_ACCESS="$(AWS_ACCESS)" \
AWS_SECRET="$(AWS_SECRET)" \
JWT_AUDIENCE="$(JWT_AUDIENCE)" \
JWT_ISSUER="$(JWT_ISSUER)" \
JWT_REALM="$(JWT_REALM)" \
JWT_SECRET="$(JWT_SECRET)" \
ADMIN_EMAIL="$(ADMIN_EMAIL)"
# List current environment variables in EB
list-env:
eb printenv -e $(EB_ENV)