Spaces:
No application file
No application file
Commit
·
c78bf13
1
Parent(s):
e0d2a31
Create Makefile
Browse files
Makefile
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Variables
|
2 |
+
DOCKER_COMPOSE = docker-compose
|
3 |
+
|
4 |
+
# Colors
|
5 |
+
COLOR_RESET = \033[0m
|
6 |
+
COLOR_BOLD = \033[1m
|
7 |
+
COLOR_GREEN = \033[32m
|
8 |
+
COLOR_YELLOW = \033[33m
|
9 |
+
|
10 |
+
# Check if Docker is installed
|
11 |
+
DOCKER_INSTALLED := $(shell command -v docker-compose 2> /dev/null)
|
12 |
+
|
13 |
+
# Targets
|
14 |
+
install:
|
15 |
+
ifndef DOCKER_INSTALLED
|
16 |
+
$(error Docker is not installed. Please visit https://www.docker.com/get-started to download and install Docker.)
|
17 |
+
endif
|
18 |
+
|
19 |
+
@echo "$(COLOR_BOLD)=== Putting the services down (if already running) ===$(COLOR_RESET)"
|
20 |
+
$(DOCKER_COMPOSE) down --remove-orphans
|
21 |
+
|
22 |
+
@echo "$(COLOR_BOLD)=== Setting up Docker environment ===$(COLOR_RESET)"
|
23 |
+
# Copy .env.example to .env for backend-server
|
24 |
+
# Show warning before continue, and wait for 10 seconds
|
25 |
+
@echo "$(COLOR_BOLD)=== This will overwrite your .env files, you still have some time to abort ===$(COLOR_RESET)"
|
26 |
+
@sleep 5
|
27 |
+
@echo "$(COLOR_BOLD)=== Copying .env files ===$(COLOR_RESET)"
|
28 |
+
cp -n backend-server/.env.example backend-server/.env 2>/dev/null || true
|
29 |
+
cp common.env llm-server/.env 2>/dev/null || true
|
30 |
+
$(DOCKER_COMPOSE) build #--no-cache
|
31 |
+
$(DOCKER_COMPOSE) up -d #--force-recreate
|
32 |
+
@echo "$(COLOR_BOLD)=== Waiting for services to start (~20 seconds) ===$(COLOR_RESET)"
|
33 |
+
@sleep 20
|
34 |
+
|
35 |
+
@echo "$(COLOR_BOLD)=== Clearing backend server config cache ===$(COLOR_RESET)"
|
36 |
+
$(DOCKER_COMPOSE) exec backend-server php artisan cache:clear
|
37 |
+
$(DOCKER_COMPOSE) exec backend-server php artisan config:cache
|
38 |
+
|
39 |
+
@echo "$(COLOR_BOLD)=== Run backend server migrations ===$(COLOR_RESET)"
|
40 |
+
$(DOCKER_COMPOSE) exec backend-server php artisan migrate --seed
|
41 |
+
$(DOCKER_COMPOSE) exec backend-server php artisan storage:link
|
42 |
+
|
43 |
+
@echo "$(COLOR_BOLD)=== Running backward compatibility scripts ===$(COLOR_RESET)"
|
44 |
+
$(DOCKER_COMPOSE) exec backend-server php artisan prompt:fill
|
45 |
+
|
46 |
+
$(DOCKER_COMPOSE) run -d backend-server php artisan queue:work --timeout=200
|
47 |
+
|
48 |
+
@echo "$(COLOR_BOLD)=== Installation completed ===$(COLOR_RESET)"
|
49 |
+
@echo "$(COLOR_BOLD)=== 🔥🔥 You can now access the dashboard at -> http://localhost:8000 ===$(COLOR_RESET)"
|
50 |
+
@echo "$(COLOR_BOLD)=== Enjoy! ===$(COLOR_RESET)"
|
51 |
+
|
52 |
+
run-worker:
|
53 |
+
$(DOCKER_COMPOSE) exec backend-server php artisan queue:work --timeout=200
|
54 |
+
|
55 |
+
db-setup:
|
56 |
+
$(DOCKER_COMPOSE) exec backend-server php artisan migrate:fresh --seed
|
57 |
+
|
58 |
+
down:
|
59 |
+
$(DOCKER_COMPOSE) down --remove-orphans
|
60 |
+
|
61 |
+
exec-backend-server:
|
62 |
+
$(DOCKER_COMPOSE) exec backend-server bash
|
63 |
+
.PHONY: install down
|